Algorithmic Composition: A Gentle Introduction to Music Composition Using Common LISP and Common Music
Skip other details (including permanent urls, DOI, citation information) :This work is protected by copyright and may be linked to without seeking permission. Permission must be received for subsequent distribution in print or electronically. Please contact mpub-help@umich.edu for more information. :
For more information, read Michigan Publishing's access and usage policy.
Appendix B: Using Common Music with Csound
Use the Common Music function in-syntax to use Csound.
In order to implement the Csound score file output, define an object named i1 using the Common Music macro DEFOBJECT. The new object is a subclass of csound-note. A standard class i1 is created that corresponds to the i1 statement in the Csound scorefile. Additional slots for object i1 are dur, freq, and amp. Parameters for the I-statement are instrument number (ins), start time or rhythm (time ), duration (dur ), amplitude (amp ), and frequency (freq ). These parameters correspond to the parameter fields p1, p2, p3, p4, and p5 in the Csound scorefile.
Example B.1
When Common Music evaluates the code in Example B.1, it responds:
#<Package "COMMON-MUSIC">
#<STANDARD-CLASS I1>
Now that Common Music knows the current syntax is Csound and the parameter fields for an i1 object, we program a generator to output i1 statements:
When Common Music evaluates the code in Example B.2, it responds:
#<GENERATOR: Csound-Test>
Open a stream to a file so Common Music can output the results of the generator csound-test. The Common Music OPEN command opens a stream to the file named csound.sco. The Common Music MIX command calculates the slot values and writes the result to csound.sco. We do not play the file since we will use csound.sco as input to the Csound compiler.
; Common Music output of 3-May-100 14:21:17
You may add additional parameter fields by adding slots to the parameter list and specifying the order in which the values should be output to the parameter list. Example B.3 extends Example B.2 by adding a parameter field for pan.