The following SAL code shows a process definition and a sprout command. The output is sent to FOMUS if the output filename in *filename* contains an
extension that FOMUS recognizes. Common Music automatically sets the filename setting before processing the score.
process myproc (n, r) repeat n fms:note(dur: r, pitch: between(48, 73)) wait r end sprout(myproc(16, 1/2), *filename*) |
|
Figure 8.1: Process
The next example produces the same result without sprouting processes.
A new score must be created using new-score, after which all information is entered using function calls.
run is called at the end to process the score.
|
|
Figure 8.2: Direct
Integer, rational and floating point types are preserved when they are sent to FOMUS. It's generally better to use integers and rationals whenever possible.
fms:new-score(*filename*) ; define a new score object fms:note(time: 0, dur: 1/2, pitch: 60) fms:note(time: 0.5, dur: 0.5, pitch: 62.0) fms:note(time: 1, dur: 1/3, pitch: 64) fms:note(time: 1.333, dur: 1/3, pitch: 66.0) fms:note(time: 5/3, dur: 0.333, pitch: 68) fms:run() ; run FOMUS |
|
Figure 8.3: Numbers
Time stamps in SAL/Common Music processes are floating point numbers.
Symbols and keywords can be used whenever fomus requires a string value. The symbol characters are always converted to lower case.
|
|
Figure 8.4: Symbols/Strings
Any FOMUS setting documented as requiring a “yes/no” value is a boolean value and may be entered using ‘#t’ or ‘#f’.
|
|
Figure 8.5: Boolean Values
Lists or nested lists in FOMUS are simply entered with SAL lists. Settings that are described as “mappings” from strings to values are also entered with lists.
|
|
Figure 8.6: Lists