Previous Section: Using Cmix Built-in Subcommands

Advanced MINC features


Parameters may be replaced by MINC variables, which can also be used to store values returned by MINC built-in functions. Because MINC is an interpreted language, variables do not have to be declared before they are used. MINC will automatically declare and type variables (the default type is floating point), but variables can be declared in a scorefile to guarantee a specific type (such as int). The following scorefile fragment will generate a random pitch between middle C (8.00) and the F above middle C (8.05):

In the above example, the variables offset and mypitch will be automatically declared as floating-point variables by MINC. MINC understands most of the basic arithmetic operators (+, -, *, /, >, <, ==, !=, <=, >=, **, etc.), but it does not parse pre- or post-fix operators (i.e. i++; ++i). Notice that MINC does not require terminating semicolons on each line.

It is also possible to utilize several of the basic C control constructions within MINC. for loops, while loops and if-then-else constructions can all be used in a CMIX scorefile. The above fragment of code could be easily modified to generate a cluster of 16 pitches randomly distributed between 8.00 and 8.05:

Control structures can also be nested in MINC; quite complicated scorefile "programs" can be built. This programmable aspect of MINC is a very powerful tool, a tool which is part of every CMIX instrument.

One feature missing from MINC is the ability to define functions within the MINC language. Instead, C programs must be made to look like CMIX instruments. These "instruments" do no real sound work, but they can return values back to the MINC level. Unfortunately, adding utility functions in this manner requires the recompilation of the main CMIX object (cmix.o); or the functions can be added as subcommands to a specific CMIX instrument -- they will not be accessible from other CMIX instruments.


Next Section: Playing Sounds(rescaling soundfiles)
Minc manual page
Paul Lansky's Minc Tutorial
What is CMIX?
- Index -
Cmix Home Page