RTcmix Instrument Design Functions and Objects
RTcmix provides a set of C/C++ functions and objects for constructing
new signal-processing and synthesis instruments. Click
here
for a tutorial on creating and compiling RTcmix instruments.
The source code for most of these low-level routines are in the "RTcmix/lib"
and "RTcmix/sys" subdirectories of the RTcmix distribution.
RTcmix C/C++ functions and objects include (categorized below, alphabetical
listing at left):
Processing Control/Sound Input&Output
- Instrument -- base class for all RTcmix instruments; contains many essential functions and variables
currentFrame -- return current sample frame #
framesToRun -- return number of frames to run for each Instrument::run() invocation
getdur -- returns duration (seconds) of the note
getendsamp -- returns the (absolute) ending sample # (frame) for a note
getstart -- returns starting time (seconds) of the note
increment -- update the computed-sample count
inputChannels -- return the number of input channels
nSamps -- return total number of frames (samples) to run for a note
outputChannels -- return the number of output channels
setendsamp -- sets the (absolute) ending sample # (frame) for a note
- Ortgetin -- read input samples from file or input device
- rtaddout -- send samples to the output device or soundfile
- rtbaddout -- send an array of samples to the output device or soundfile
- rtgetin -- get samples from the input device or soundfile
- rtinrepos -- reposition the input read pointer
- rtsetinput -- open and initialize a soundfile or input device for reading
- rtsetoutput -- open and initialize the output device and/or soundfile for writing
Synthesis
- Ooscili -- interpolating wavetable oscillator object; also can be used for control envelopes
- oscil -- wavetable oscillator
- oscili -- interpolating wavetable oscillator
- osciln -- wavetable oscillator (FM-compatible)
- oscilni -- interpolating wavetable oscillator (FM-compatible)
- boscili -- block-computing interpolating wavetable oscillator
- buzz -- buzz (pulse) oscillator
- bbuzz -- block-computing buzz (pulse) oscillator
- pluckset -- simple Karplus-Strong ("plucked string") initialization
- pluck -- simple Karplus-Strong ("plucked string") filter/generator
- bpluck -- some sort of Karplus-Strong thing
- hplset -- Karplus-Strong ("plucked string") initialization
- hpluck -- Karplus-Strong ("plucked string") filter/generator
- wshape -- waveshaping function
Math/Data
- ampdb -- convert decibels to amplitude
- dbamp -- convert amplitude to decibels
- boost -- convert amplitude in decibels to amplitude multiplier
Pitch-specification Conversion Routines
- cpsoct -- convert linear octaves to Hz
- cpspch -- convert octave.pitch-class to Hz
- midipch -- convert Hz to midi note #
- octcps -- convert Hz to linear octaves
- octpch -- convert octave.pitch-class to linear octaves
- pchcps -- convert Hz to octave.pitch-class
- pchmidi -- convert midi note # (byte) to frequency (Hz)
- pchoct -- convert linear octaves to octave.pitch-class
Random-Number Routines
- Orand -- pseudo-random number generating object
- crandom -- another psuedo-random number generator
- randf -- 1/f pseudo-random number generator(?)
- srrand -- pseudo-random number generator seed/initialization
- rrand -- pseudo-random number generator
- brrand -- block-computed pseudo-random number generator seed/initialization
- brrand -- block-computed pseudo-random number generator
Function-table Slot Operations
- floc -- return a pointer to a function table slot
- fsize -- return the size of a function table slot array
- evset -- envelope/control function initialization
- evp -- envelope/control function generator
- install_gen -- install a function table slot from within an instrument
- combine_gens -- combine function tabbles
- resample_gen -- resample a function table
- setline -- create line-segment curve in an array
- tableset -- initialize a function table slot for envelopes/control functions
- table -- read from a function table slot for envelopes/control functions
- tablei -- interpolated read from a function table slot for envelopes/control functions
Filters
- allpass -- allpass filter
- allpole -- allpole filter
- ballpole -- block-computing allpole filter
- rsnset -- two-pole FIR filter initialization
- reson -- simple two-pole FIR filter
- breson -- block-computed two-pole FIR filter
- bresonz -- block-computed two-pole FIR filter
- rszset -- simple IIR filter initialization
- resozn -- simple IIR filter
Delays
- combset -- comb filter setup function
- comb -- comb filter
- hcomb -- interpolating comb filter
- delset -- initialize a delay line
- delput -- put a sample into a delay line
- delget -- get a sample from a delay line
- dliget -- get an interpolated sample from a delay line
- rvbset -- initialize poor-quality reverb
- resozn -- poor-quality reverb
There are a number of older 'disk-only' sound synthesis and signal-processing
functions that may be encountered in instrument design. These
were originally developed for the non-realtime cmix
music programming language from which RTcmix was derived. RTcmix actually
encapsulates all of the earlier cmix code, so that these
funcions that have not been ported to RTcmix still work. We include
documentation for these older disk-based functions mainly
for those compelling "historical" reasons, because none of them
will access the real-time audio stream of sound.
See the
CMIX documentation
for more information on these older functions.
Disk-based (non-realtime) functions:
- ADDOUT -- add samples to disk
- GETIN -- get samples from disk
- LAYOUT -- write samples selectively to disk
- WIPEOUT -- write samples destructively to disk
- baddout -- add a block of samples to disk
- bgetin -- get a block of samples from disk
- blayout -- write a block of samples selectively to disk
- bwipeout -- write a block of samples destructively to disk
- endnote -- update file header statistics at end of note
- getsample -- fetch arbitrary block of samples from soundfile
- getsetnote -- set up for getsample()
- inrepos -- reposition the input file pointer
- outrepos -- reposition the output file pointer
- setnote -- set up soundfile for reading/writing
[note: There are quite a few lower-level cmix and RTcmix functions
that can be used within an instrument or an application. The source code
for most of these is located in the "RTcmix/sys" or the "RTcmix/lib"
directories. Take and use what you need!]