an open-source digital signal processing and sound synthesis language
about · links · contact
makeLFO - set up a low-frequency oscillator (LFO) for control purposes, using a pfield-handle connect to an Instrument parameter


pfield = makeLFO("waveform", [interp_type,] frequency, amp/min[, max])

Parameters inside the [brackets] are optional.


makeLFO returns a pfield-handle that will deliver data from an internal low-frequency oscillator (LFO) inside RTcmix for controlling various Instrument parameters perdiodically. The waveform used is deteremined by the "waveform" argument, with the frequency (in Hz) set by the frequency argument. There is no real upper bound on the 'low frequency' used, but practically the upper limit is constrained by the control reset rate (see the reset scorefile command for a discussion of this rate). Typically LFOs operate beyond the lower bound of human pitch-perception, below 20-25 Hz. Much higher rates can be used for various modulation effects (AM, FM, etc.) but using a PField with a high control rate to do this is rather inefficient. RTcmix provides a number of Instruments for performing these kinds of audio-modulation operations (see the FMINST, AMINST, AM and WIGGLE Instruments, for example). The LFO will produce periodic values ranging from +amp to -amp, or min to max. The optional interp_type specifier can change how values are delivered from the internal waveform table, in the same way that the "interp" optional specifier in the maketable command does. The active control rate (set via control_rate) must be the same for makeLFO and the instrument that uses the LFO.

Many of the arguments for makeLFO may themselves also be pfield-handles.


This string value (i.e. enclosed in "double quotes" in the scorefile) determines the kind of waveform used by the LFO to generate periodic values. The waveform argument can also be a table-handle referring to a waveform created by the maketable command.

The following waveforms may be specified by a string argument for waveform:

  • "sine" -- sine wave

  • "saw" -- sawtooth waveform, ramping down

  • "sawX" -- sawtooth waveform, like saw only using the first X harmonics

  • "sawup" -- sawtooth waveform, ramping up

  • "sawdown" -- sawtooth waveform, ramping down (identical to saw)

  • "square" -- square wave

  • "squareX" -- square waveform, like square only using the first X harmonics

  • "tri" -- triangle wave

  • "triX" -- triangle waveform, like tri only using the first X harmonics

  • "buzz" -- pulse waveform

  • "buzzX" -- pulse waveform, like buzz only using the first X harmonics

This optional string argument can be either "interp" or "nointerp". "nointerp" means that when data is read from the LFO waveform, any requests for fractional indices into the wavetable will be 'rounded down' (truncated) to the next-lowest table value. "interp" will apply a linear interpolation scheme for fractional values between two table elements. "interp" is the default setting.

The frequency (in Hz) used for the LFO. This should be less than the reset rate.

amp/min[, max]
This sets the range of values that will be generated by the LFO through the pfield-handle. If a single value is present (amp), then the values will travel from +amp to -amp. If two arguments are present, the first (min) will set the minimum value coming from the LFO, and the second (max) will set the upper bound.


   vib = makeLFO("sine", 3.5, 10.0)
   pan = makeLFO("tri", 0.5, 0.0, 1.0)
   wave = maketable("wave", 1000, 1.0, 0.2, 0.1)
   WAVETABLE(0, 3.5, 15000, 478 + vib, pan, wave)
This scorefile uses two low-frequency oscillators, one causing a 3.5 Hz sinusoidal deviation from the 478 Hz base frequency of the WAVETABLE Instrument by +/- 10 Hz through the vib pfield-handle, and the other controlling the stereo placement via a 0.5 Hz triangle-wave going from a minimum value of 0.0 to a maximum value of 1.0 (the pan pfield-handle).

See Also

makeconnection, maketable, makerandom, makefilter, makeconverter, makemonitor