Skip to content

LFO API

ianhattwick edited this page Jun 3, 2021 · 1 revision

LFO API

constructor

LFO (waveform, float freq (Hz),int amplitude)

  • all arguments optional
  • possible waveforms: TRI, RAMP, SAW, SQUARE, SIN

Mandatory methods

lfo.loop()

  • generate a new sample once the previous sample is read

lfo.get()

  • read a sample, and indicate a new sample should be generated

useful methods

lfo.peek()

  • read a sample value without triggering a new sample

lfo.reset(optional float phase)

  • reset waveform to beginning, or to an arbitrary phase phase

lfo.endOfCycle()

  • returns 1 after a cycle completes, 0 otherwise

parameter setters

lfo.freq( float freq (Hz) )

  • sets the frequency of the lfo

lfo.amplitude( int amplitude )

  • sets the amplitude of the lfo. Max value is determined by your bit resolution

lfo.bitDepth( byte depth )

  • set the bit resolution of the output signal

lfo.shape(float shape) :default 0. range -1 to 1, skews the waveform. 0. is no skew

  • higher values (close to 1/-1) may affect the frequency of the lfo. . .

Properties:

lfo.waveform : TRI, SINE, SQUARE, RAMP, SAW

lfo.samplingRate : int, default 1000, HZ, number of samples/second

  • an incorrect samping rate will cause the lfo frequency to be inaccurate

Clone this wiki locally