an open-source digital signal processing and sound synthesis language
about · links · contact

Instrument Design

RTcmix provides a set of C/C++ functions and objects for constructing new signal-processing and synthesis instruments. The source code for most of these low-level routines are in the "RTcmix/lib" and "RTcmix/sys" subdirectories of the RTcmix distribution.

In addition to the reference material below, a tutorial is available for creating and compiling RTcmix instruments.

Arrange by: Topic  ·  Alphabetical

Processing Control/Sound Input & Output

  • Instrument -- base class for all RTcmix instruments; contains many essential functions and variables
    • configure -- designer-overridden virtual function to configure an RTcmix instrument
    • 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
    • getSkip -- returns the number of samples in one control (reset) period
    • getstart -- returns starting time (seconds) of the note
    • increment -- update the computed-sample count
    • init -- designer-overridden virtual function to initialize an RTcmix instrument
    • 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
    • run -- designer-overridden virtual function for computing samples
    • setchunk -- sets the number of sample frames computed for each Instrument::run() invocation
    • setendsamp -- sets the (absolute) ending sample # (frame) for a note
  • Obucket -- internally buffer samples or floating-point numbers
  • 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
  • update -- retrieve PField-handle or table-handle data


  • Ooscil -- non-interpolating wavetable oscillator object; also can be used for control envelopes
  • 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


  • 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
  • sbrrand -- 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


  • Ocomb -- comb filter object
  • Ocombi -- interpolating comb filter object
  • Odcblock -- DC blocking filter object
  • Oequalizer -- multi-purpose biquad filter object
  • Oonepole -- simple recursive one-pole filter object
  • OonepoleTrack -- simple 'tracking' recursive one-pole filter object
  • Oreson -- simple recursive bandpass filter object
  • 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
  • resonz -- simple IIR filter


  • Odelay -- delay line object
  • Odelayi -- interpolating delay line object
  • 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
  • reverb -- poor-quality reverb


  • Offt -- FFT analysis object

Disk-based (non-realtime) Functions

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.

  • 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!]