
footils – Using the foo Sound Synthesis System as an Audio Scripting Language Martin RUMORI Klanglabor, Academy Of Media Arts Peter-Welter-Platz 2 D-50676 Cologne Germany [email protected] Abstract UNIX shell scripts are often used for recur- foo is a versatile non-realtime sound synthesis and ring custom tasks closely related to the operat- composition system based on the Scheme program- ing system itself, such as system administration, ming language (Eckel and Gonz´alez-Arroyo, 1994; maintenance and file management. Apart from Rumori et al., 2004; Rumori, 2005). It is mainly that, there are many scripting languages for used for sound synthesis and algorithmic compo- special purposes, such as text processing (awk, sition in an interactive type-render-listen-loop (the Perl). Scripts written in one of these languages musician’s read–eval–print-loop) or in conjunction can be seamlessly integrated with UNIX shell with an editor like the inferior mode of emacs. Un- like with other sound synthesis languages, foo pro- scripting by means of the so called interpreter grams are directly executable like a shell script by directive at the beginning of a script (as docu- use of an interpreter directive. foo therefore allows mented in execve(2)): for writing powerful sound processing utilities, so 1 called footils. #!/usr/bin/perl Keywords Those scripts appear and behave like any foo, scheme, scripting, algorithmic composition, sound utilities other UNIX program or shell script and thus get scriptable itself. This property of being “re- 1 Introduction cursive” makes shell scripting so powerful. Scripting has played a major role in the develop- ment of computer systems since the early days. 2 Scripting and computer music Scripting often means being a user and a pro- 2.1 Standalone applications grammer at the same time by accessing func- In the field of computer music, composers of- tions of applications or operating systems in an ten deal with graphical standalone applications, automated, “coded” way rather than interac- such as Ardour or Pd, or with dynamic lan- tively. guages in an interactive fashion, such as Super- A major design principle of the UNIX oper- Collider. While these tools are very powerful ating system is to create several simple appli- in terms of harddisk recording, sound synthesis cations or tools which are suitable for exactly or composition (like Perl for text processing), one purpose and to combine them in a flexible they do not integrate in the same way with the way to implement more complex functionalities. operating system’s command line interface as This is possible through the well-known UNIX textual scripts (unlike Perl for text processing). concepts of pipes and file redirections. A pow- In most cases, however, this is not necessary or erful command line interpreter, the shell, allows desirable. for accessing these concepts both in interactive Pd can be launched without showing its GUI. mode as well as in so called shell scripts. It the patch to be executed can be given at the is quite easy to generalize an interactive shell command line, including initial messages to be command for using it in a script and vice versa. sent to the patch. SuperCollider’s language In fact, the UNIX shell programming language client, sclang, may be fed with code through its has started to blur the distinction between user standard input which then is interpreted. This and programmer. level of shell automation is already sufficient for 1Use of the term footils by courtesy of Frank tasks such as starting a live session or an inter- Barknecht, see http://www.footils.org active sound installation. LAC2006 91 2.2 Soundfile utilities 2.3 Scriptable audio applications A major task when using a computer for any Apart from that, there are operations on sound- task is file maintenance. This is especially files which are much closer related to the artis- true for dealing with soundfiles. Common tasks tic work with sound itself, such as filtering or include conversion between different soundfile effects processing of any kind, mixing, arrang- types, changing the sample rate or the sam- ing or simply “composing” based on algorithms ple format, separating and merging multichan- and/or underlying sound material. While re- nel files, concatenating soundfiles, removing DC questing scripting capabilities is evident for do- offset or normalizing. As for sorting or archiving ing file related tasks mentioned above, the latter text files, this kind of tasks are often applied to procedures are mostly done inside single stan- many soundfiles at a time and therefore should dalone applications or sound synthesis systems. be scriptable. Attempts have been made to open the pro- In order to accomplish those tasks, a lot of cessing scheme of the audio data to a script in- command line utilities are available which fully terface. One approach was realized in the Com- integrate which shell scripting in the above- puter Audio Research Laboratory (CARL) Soft- mentioned sense. Examples for such utili- ware Distribution at CRCA (CME) since 1980 ties are sndinfo and denoi included in Csound (Moore and Apel, 2005). The CARL system (Boulanger, 2005), the tools bundled with lib- consists of several independent small UNIX pro- sndfile sndfile-info, sndfile-play and sndfile- grams for reading and writing soundfiles, as well convert, or sndfile-resample from libsamplerate as sound synthesis, effects processing and ana- (de Castro Lopo, 2006). Another example is the lyzing audio data. They communicate with each well known sox program, which also allows for other via ordinary UNIX pipes. This way it is some effects processing (Bagwell, 2005). possible to generate a kind of signal processing Those tools can be called from a shell script in patches as in Pd, but by means of an arbitrary order to apply them comfortably to a large num- shell scripting language: ber of files. The following bash script might be used to remove mains power hum from a num- $ fromsf infile.ircam | \ ber of soundfiles specified on the command line: filter bandreject.fir | \ tosf -if -os outfile.ircam #!/bin/bash This approach is quite smart, as it allows for SOX=sox using the UNIX command line for audio pro- FREQUENCY=50 # european origin cessing in the same way as for text processing. BANDWIDTH=6 It is even possible to set up parallel processing SUFFIX="_br" pipes with the para program. since the shell while getopts ":f:b:s:" OPTION; do language is not powerful enough for expressing case $OPTION in those parallel pipes, this program has to use its f ) FREQUENCY=$OPTARG ;; own syntax, which unfortunetaly causes some b ) BANDWIDTH=$OPTARG ;; deformation to the aesthetical integrity of the s ) SUFFIX=$OPTARG ;; CARL approach. esac; done Another approach was implemented by Kai Vehmanen in his ecasound application (Vehma- shift $(($OPTIND - 1)) nen, 2005). ecasound allows for creating flexi- ble so called signal processing chains. The pa- for INFILE; do OUTFILE=‘echo $INFILE | sed -r -e \ rameters for these chains are specified via com- "s/^(.*)(\.[^\.]*)$/\1${SUFFIX}\2/g"‘ mand line options or from files containing the $SOX $INFILE $OUTFILE \ chain rules. Therefore ecasound is fully script- bandreject $FREQUENCY $BANDWIDTH; able from the commandline or from inside shell done scripts. While using command line soundfile tools this $ ecasound -i:infile.aiff -o:outfile.aiff \ way might be quite elegant, they still can only -efr:50,6 run as they are. It is not possible to directly access and manipulate the audio data itself from Ecasound allows for building up parallel pro- inside such a script. cessing chains at the same grammatical level of LAC2006 92 the scripting language used for simpler tasks. (score). Nevertheless, it is easily possible to ex- ecasound does not only operate on soundfiles, press a Csound-like semantics of orchestra and but may also record, process and play audio in score with foo, or the concept of behavioral ab- realtime, optionally using controller data such stractions as in Nyquist. as MIDI. By means of the foo primitives, static signal Both the CARL tools and ecasound are exam- processing patches can be generated and exe- ples for tools which allow for directly accessing cuted. Temporal relationships are expressed in the audio processing scheme. by calling them hierarchical time frames which are relative to from inside a shell script, similar to the sox ex- the surrounding one. ample above, one is able to create very sophis- Higher level concepts, such as envelopes or ticated sound processing utilities. musical processes, are entirely implemented in Scheme in the control library by Ram´on 3 Using foo for writing audio Gonz´alez-Arroyo, which is part of foo. processing scripts This openness allows for using foo for very foo’s approach for allowing scripting is different different tasks: apart from algorithmic compo- from the abovementioned ones. foo is neither sition based on highly abstracted Scheme con- a closed standalone application nor a utility es- structs as found in the control library, it is also pecially designed for scripting. foo is a sound possible to use foo on the kernel level for sim- synthesis and composition environment for non- ple tasks like converting soundfiles, extracting realtime use based on the dynamic, general pur- or merging channels, or effects processing. pose programming language Scheme. Like CLM, foo is usually used interactively by entering and evaluating Scheme expressions, 3.1 History of foo which construct signal processing patches or foo was developed by Gerhard Eckel and Ram´on render them into soundfiles. It is also common Gonz´alez-Arroyo in 1993 at ZKM, Karlsruhe, to use foo in conjunction with an editor, such as for the NeXTStep platform. The low-level the inferior-mode of emacs.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages6 Page
-
File Size-