Skip to content

LfoState

Struct

Source: AudioTypes.h

Description

Holds LFO (Low-Frequency Oscillator) state for pitch or volume modulation.

Supports both floating-point and Q15 fixed-point variants for no-FPU platforms. The LFO produces a sine-like waveform that can modulate pitch (vibrato) or volume (tremolo) of a voice.

Properties

NameTypeDescription
enabledboolWhether the LFO is active.
targetLfoTargetWhat the LFO modulates: PITCH or VOLUME.
depthfloatModulation depth (pitch: ratio e.g. 0.05; volume: 0.0-1.0).
periodSamplesuint32_tLFO period in samples (derived from lfoFrequency).
sampleCounteruint32_tCurrent sample position within the period.
currentValuefloatCurrent LFO output value [-1.0 to +1.0].
depthQ15int32_tQ15 depth: 0-32768 maps to 0.0-1.0.
currentValueQ15int32_tQ15 output: -32768 to +32768 maps to -1.0 to +1.0.
delaySamplesuint16_tSamples to wait before LFO starts (in seconds * sampleRate).
delayCounteruint16_tCountdown for delay phase.

Methods

void reset()

Description:

Resets all LFO state to disabled.

Released under the MIT License.