CMIX < some_score.file
will use Minc to parse the score and make the appropriate function
calls to run RTcmix. There are other options, including the ability
to run RTcmix from
perl,
python,
imbedded
within another application, or through a
TCP/IP socket.
Minc does contain a number of handy features, including C-like flow-of-control features such as for and while loops, if decision-constructs, etc. See the RTcmix tutorial (especially the later sections about algorithmic composition) for examples of Minc use.
This is from the original cmix Minc documentation:
Minc, has two modes of operation: batch and interactive (the default). The only difference between them is that loops cannot be executed in interactive mode. To run in batch mode a -b flag must be specified on the Cmix command line, and all data must be entered either by redirecting input from a file, or by typing all data followed by a <cntrl-D>. Comments are inclosed by /* and */ as in C. Any user function which returns a value can return that value to Minc if it is declared as a type double and introduced in the profile.c file.
The following is Lars Graf's formal statement of the language:
Order of precedents:
||
&&
= !=
< > <= >=
+ -
* /
** ^
CASTS
Syntax:
prg: stml
stml : stmt
| stml stmt
| stmt ;
| stml stmt ;
stmt: float idl /* declare ids */
| id = exp
| IF bexp stmt
| IF bexp stmt ELSE stmt
| WHILE bexp stmt
| FOR ( stmt , bexp , stmt ) stmt
| id ( expl ) /* a call to a cmix function */
| { stml }
idl: id /* like: fnct_name(arg1,arg2,arg3) */
| idl , id
id: any letter/digit/"_" combination, but start with letter
expl: exp
| exp ',' expl
| or no function argument
bexp: exp
| ! bexp
| bexp && bexp
| bexp || bexp
| bexp = bexp /* note the comparison of booleans */
| exp < exp
| exp > exp
| exp != exp
| exp <= exp
| exp >= exp
| TRUE
| FALSE
exp: exp ** exp
| - exp
| exp * exp
| exp / exp
| exp + exp
| exp - exp
| ( bexp )
| any number: e.g. 34 -645.34 234.E23 ...
Note:
1) Semicolon and are optional.
2) '=' is used for assignments and boolean expressions.
3) False = 0; True = 1(or nonzero).
Samples:
/* this is a legal comment */
float foo,x;
if i=3 && foo>4 say_mumble( foo**i , i-foo*3)
else mumble_foo()
while x=3 {
this_is_a_cmix_function_call()
x= 5 * (foo=i) /* this is slime */
while true nested_loops_are_possible()
}
for (x=1, x <= 10,x=x+1) dispatch(x)
Minc also has the following facilities:
1) function calls can return values
e.g. i = rand(j)
NOTE: those are calls to your own C-functions.
You may adjust your dispatcher and your functions accordingly
The function must be introduced in the profile, and must
be of type double.
2) assignment statements have the value of the assignment.
e.g. i = j = 5
while (i=j) == 5 { mumblings .. }
3) strings can be passed as arguments.
e.g. file_id = open("name of file",2)
printf("some string %f %f0,i,j)
/* of course, the dispatcher has to know about printf */
NOTE: the string pointer is passed as a double; to convert
back, you have to first cast it into an integer, and then
you have to cast the integer into a char*.
4) use '=' for assigment; and '==' as the booleam equal operator.
Here is a simple example file:
open("sf/bigsound",0,0)
open("sf/bigmix",1,2)
sfclean(1)
float a,b,c,d
a=2 b=3 c=28000 d=-4
sound(a,b,c,1,22*19,d=d-a)
sound(a=a+2, b+.1, 99, d=d-a+2)