Previous Section: Structure of the Cmix Scorefile
Using CMIX built-in subcommands
Commands such as sfcreate can be executed from within the CMIX scorefile by using the CMIX built-in subcommand system. The system subcommand can execute arbitrary Unix commands:
system("sfcreate -r 44100 -c 1 -i funsound.snd")
output("funsound.snd")
etc.
CMIX has a number of built-in subcommands which are part of the default MINC environment compiled into every CMIX instrument. Many of these built-in subcommands return values to the MINC environment that can be used in other subcommands. For example, the pchcps subcommand converts numbers from cycles-per-second to an octave.pitch-class representation (8.00 is middle C, 8.03 is the D-sharp above middle C, 7.00 is the C one octave below middle C, etc.). The playinst instrument perhaps requires that pitch be specified in octave.pitch-class notation. To create a sound with a pitch of exactly 149 cycles-per-second, the following statement:
playinst(0, 7, pchcps(149.0), 1000, 0.3, 0.4)
would work. Notice that CMIX built-in subcommands can be nested within other subcommands -- MINC always interprets from the "inside" out, just like C.
Other CMIX built-in subcommands include several random-number generators, various pitch conversion functions, and other utility programs. The file ug_intro.c in the cmix/sys directory contains a list of all of the CMIX built-in subcommands.
Next Section: Advanced MINC Features
What is CMIX? - Index -
Cmix Home Page