Build with this node

Start with a prompt in Studio, or copy it into your own coding agent.

Ask Studio

@maruaudio/dsp/modulation/lfo is a low-frequency oscillator run at audio rate as a modulation signal: y = offset + depth × wave, rounded to f32. The waveforms are the voice oscillator stages of @maru/voices-stages, the same functions the audio oscillator calls: sine, PolyBLEP saw, PolyBLEP square and a leaky-integrated triangle.

const state = initLfoNode(48000)
setLfoNodeRate(state, 5)
setLfoNodeDepth(state, 0.5)
const m = lfoNodeTick(state)

Parameters

SetterRange the setter enforcesDefault
setLfoNodeWaveformRounded, then 0 to 3: sine, saw, square, triangleSine
setLfoNodeRate0 to 40 Hz1 Hz
setLfoNodeDepth0 to 11
setLfoNodeOffset−1 to 10

Lifecycle

initLfoNode → setters → lfoNodeTick → resetLfoNode. Reset zeroes the phase and the triangle integrator and keeps the settings. Setters do not touch the phase, so a rate change continues from where the wave is. Ticks allocate nothing and do no I/O.

When to use it

A repeating control for vibrato, tremolo, filter sweeps or panning, routed into another DSP node's parameter. The offset and depth place the swing, so offset 0.5, depth 0.5 gives a 0 to 1 control from a bipolar wave.

Limits

  • Mono sample tick, no input; the rate is read on every tick with no smoothing.
  • The phase accumulator is f32 and wraps into [0, 1).
  • The triangle is a leaky integrator (× 0.999 per sample) of the square that starts from zero after init or reset.
  • The clamps are the kernel node's conditional clamp; a NaN passes through.

Algorithm properties and proofs

No Lean 4 proof is mapped to this node.

Explore proofs alongside performance

Parameters

ParameterTypeSetter
Waveform waveformfloatsetLfoNodeWaveform
Rate ratefloatsetLfoNodeRate
Depth depthfloatsetLfoNodeDepth
Offset offsetfloatsetLfoNodeOffset

Ports

  • Out outoutput · audio · mono

One sample per lfoNodeTick call.

Dependencies

Dependents

Used by