rtsetparams - set sampling rate, output channels, etc.
rtsetparams(sampling_rate, num_channels [, buffer_size ])
Set the sampling rate, number of output channels, and (optionally) the buffer size for an RTcmix session.
You must call rtsetparams before calls to rtinput, rtoutput, or instruments. You can only call rtsetparams once in a script.
The default buffer_size is 4096 sample frames. At a sampling rate of 44100 kHz, this gives a latency of nearly 0.1 seconds, which is unsuitable for real-time work.
To have an audio device that handles input and output at the same, you must turn on the record option before calling rtsetparams. Do this with set_option (by saying set_option("record = 1")).
If you want to write a sound file that has more channels than your audio device permits, turn off the audio device with set_option before calling rtsetparams (by saying set_option("audio = off")).
rtsetparams(44100, 2)sets up the session for 44100 sampling rate and two output channels.
rtsetparams(44100, 4, 128)sets up the session for 44100 sampling rate, four output channels, and a buffer size of 128 sample frames.
set_option("record=TRUE") rtsetparams(44100, 2, 64) rtinput("AUDIO")sets up the session for real-time processing of a signal reaching RTcmix from the audio device. You must turn on full duplex operation to tell the audio device to handle input and output simultaneously.