Useful built-in Minc Commands for Cmix

"filenum" refers to the assigned file number for a soundfile, as defined by the open() command, (where file numbers can range from 0 to 11), or by the input() (file number 0), or output() (file number 1) commands.

All arguments are converted to floating point form.

The maximum number of arguments is 1024.

Numerical commands

abs(num) - returns absolute value of num

ampdb(db) - returns amplitude from decibels

boost(speakerloc) - returns multiplier as function of speaker location

cpsoct(pitch.in.linear.octaves) - returns pitch in cps, from linear octaves

cpspch(pitch.in.8ve.pc)- - returns pitch in cps from 8ve.pc form

max(num1,num2,numn) - returns maximum value of set of n numbers

mod(num,modulus) - returns number, mod modulus

octcps(pch.in.cps) - returns pitch in linear octaves from cps

octpch(pch.in.8ve.pc) - returns pitch in linear octaves from 8ve.pc

pchcps(pitch.in.cps) - returns pitch in 8ve.pc from cps

pchoct(pitch.in.linear.octaves) - returns pitch in 8ve.pc from linear octaves

pow(num,exponent) - returns num to the exponent power

rand() - returns random number in the range - to + 1

random() - returns random number in the range 0 to +1

round(number) - returns integer part of number+.5

trunc(number) - returns integer part of number

File information

chans(filenum) - returns number of channels in file filenum

class(filenum) - returns class (2=integer, 4=float) of file filenum

dur(filenum) - returns duration of file filenum

peak(filenum) - returns peak amplitude of file filenum

right_peak(filenum) - returns peak amplitude of right channel of file filenum

left_peak(filenum) - returns peak amplitude of left channel of file filenum

sr(filenum) - returns sampling rate of file filenum

sfprint(filenum) - prints out stats of file filenum

File commands

open("filename",filenum,protection) - opens "filename" with number filenum and protection (0=readonly, 1=writeonly, 2=read/write).

input("filename") - open filename read-only, as file 0

output("filename") - open filename read/write, as file 1

resetamp(filenum) - reset peakampludes to 0 in header of file filenum

Miscellaneous commands

exit() - get out of cmix

fplot(function#) - draw dumb terminal plot of function#

get_array(array#,argnum) - return argument argnum from array#, there can be up to 32 arrays.

get_size(array#) - return size of array#

get_sum(array#) - return sum of arguments in array#

load_array(array#,arg1,arg2,arg3...argn) - load values in array#, return number loaded

makegen(function#,gen#,size,args...) - store function according to rules of gen#

peakoff(filenum) - turn off peak amplitude checking for filenum

play_off() - turn off realtime sound playing

play_on(outputfile,flag,floatflag) - turn on realtime sound player. Outputfile is number of outputfile; flag=0 means play output of instrument plus disk and mix to disk; flag=1 means play output of instrument plus disk but don't mix to disk; flag=2 means play output of instrument, without disk, don't mix to disk. floatflag is needed if the output soundfile is in floating point format to figure out how to rescale the floating point output: if floatflag < 0, consider the peak amplitude to be the current output (note the mode as well); if floatflag = 0, consider the peak amplitude to be the amplitude stored in the files header, assuming that it has been written there already. (don't use floatflag = 0 for a new file, obviously); if floatflag > 0, consider the peak amplitude to be that value.

print_off() - turn off printing of Minc output

print_on() - turn on printing of Minc output

put_array(array#,loc,val) - load val as loc argument in array#

sfclean(filenum) - erase filenum

srand(number) - seed random number generators

str_num("string",num,"string",num,"string",num...) - print result of concatenation of alternate strings and numbers.

system("command") - execute specified system command

f_arg(argnum) - return floating point argument number argnum from command line.

i_arg(argnum) - return integer argument number argnum from command line.

n_arg(argnum) - return number of arguments on command line.

s_arg(argnum) - return string argument number argnum from command line.