Signal Analysis and Music ProcessingLanguage ProposalMike Haskel, Mike Glass, Morgan Rhodes, and Navarun JagatpalFebruary 7, 2007SAMPL is a simple, func tional, strictly typed, potentially platform-independent,translated, high-performance signal processing language.1 IntroductionSAMPL is a language used for signal and music processing. It producesprograms that take in audio streams as input and outputs the modified audiostream along with text output. SAMPL also allows for the sampling ofthe audio file to be transparent to the user, with the user defining desiredbehavior for the program and the actual loop f or the sampling happening inthe background. As a program designed for the processing of music, it hasdomain-specific types. SAMPL has primitive types including time, frequency,and intensity, along with string and integer types. SAMPL has the potentialfor platform-independence as it will be translated to C. Possible applicationsof SAMPL are as simple as frequency filters, effects(such as reverb), and ascomplex as identifying and filtering a particular instrument.2 FunctionalSAMPL is a functional programming language in which programs define theoutput stream in terms of various operations on the input stream. Programsconsist of a series of recursive definitions. The language provides functionsfor sampling the input stream, such as1frequency(200 hz, 5 s)rmsvolume(500 ms)i.e. samples of the input which vary over timeandclip(stream, 50db)mix(stream1, stream2)highpass(stream, 400hz)i.e. functions for mutating streams to produce other streams3 Strictly TypedSAMPL is strictly typed, providing types directly related to signal processingsuch as frequency, time, and intensity. It also provides string and integertypes. Programs specify values of these types by specifying units, as in300 hz, 20 db, or 50.3 ms. The language supports basic operations such ascomparing, adding, or scaling values of a given type, and provides functionsfor converting between types in meaningful ways (such as frequency–time).4 Control FlowOne of the key features of SAMPL is that the process of scanning and sam-pling input is transparent to the user. Ordinarily, a program for signal pro-cessing would need to implement a tight loop which encapsulates the processof reading the input and updating state as necessary. This process is concep-tually distinct from the specification of the audio transformations and usersshouldn’t need to implement it. To accommodate this, SAMPL implementsthis loop in the background, and a program’s control flow is based uponconstructs for applying filters when certain conditions hold.Such constructs include “if-then-else”, which takes on a different valuedepending on some condition, as inif rmsvolume(500 ms) > 60 dblowpass(input, 5000 hz)elseinputend2which applies a low-pass filter to the input when and only when the input issufficiently loud. Another important construct is “wait-until”, w hich transi-tions between values whe n specified conditions are met, as influte_playing =waitfalseuntil flute_attacktrueuntil flute_dropoffflute_playingendwhich defines fluteplaying to be false until a flute starts to play, then trueuntil it stops, then repeating as if from the beginning. These control struc-tures limit the layers of indirection between the programs and their intendedeffects.5 Possible ApplicationsSAMPL has a number of possible applications, ranging from simple to com-plex processing tasks. Simple applications in SAMPL will allow low or highpass filters to be applied to the stream, outputting the filtered stream. An-other application will be applying reverb to the input stream. These appli-cations can be made more complex in applying a high pass filter whenever athere is a frequency lower than a specified frequency and apply reverb onlywhen the intensity exceeds a certain value. SAMPL will also make it possibleto write applications to recognize particular instruments which will make itpossible to filter out the flute, or only filter out the flute while there is atrumpet playing. Programs generated by the SAMPL compiler are them-selves inherently modular, as users can easily pipe output from one programto
View Full Document