Build with this node

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

Ask Studio

@maruaudio/dsp/modulation/tremolo modulates the level of one signal with a non-amplifying LFO gain, y = fround(x × (1 − depth/2 + depth/2 × wave)). Depth 0 is transparent and depth 1 swings from silence to unity. The wave is a sine (the default), the canonical PolyBLEP triangle integrator of @maru/voices-stages clamped to ±1, or a square smoothed by a 2 ms one-pole so a shape choice never makes an instant gain step.

Parameters

SetterRange the setter enforcesDefault
setTremoloRate0.1 to 20 Hz5 Hz
setTremoloDepth0 to 10.5
setTremoloShapeClamped to 0 to 2, rounded; NaN → sine: TREMOLO_SHAPE_SINE, TRIANGLE, SQUARESine
setTremoloPhaseOffset−180 to 180 degrees, stored as 0 to 1 cycles0°

The phase offset is also the reset point and is applied at once. A shape change keeps the phase and clears the shaped-only state; repeating the current shape changes nothing.

Lifecycle

initTremoloNode → prepareTremoloNodeSampleRate when the rate changes → setters → tremoloNodeTick → resetTremoloNode, which returns the phase to the offset and clears the square smoother and triangle integrator. Prepare re-derives the square smoother's coefficient; the LFO follows the rate because it advances by rate / sampleRate. Ticks allocate nothing and do no I/O.

When to use it

Rhythmic level movement on a guitar, keys or pad. Two states with phase offsets 180° apart form a phase-locked stereo pair.

Limits

  • Mono sample tick; one state per channel.
  • The phase accumulator is f32 and wraps into [0, 1).
  • Rate and depth changes apply at once, with no smoothing.
  • The clamps are the kernel node's conditional clamp, not the math/range policy.

Algorithm properties and proofs

No Lean 4 proof is mapped to this node.

Explore proofs alongside performance

Parameters

ParameterTypeSetter
Rate ratefloatsetTremoloRate
Depth depthfloatsetTremoloDepth
Shape shape

Choose a waveform without restarting the shared LFO phase. This resets shaped-only state, so a stale square-edge smoother or triangle integrator never leaks into another shape. The legacy sine output does not consult that state and therefore keeps its former byte-level sample path.

floatsetTremoloShape
Degrees degrees

Set the LFO's static phase in authored degrees. The phase is also the reset point, so two tremolo instances can form a phase-locked stereo pair without product-specific runtime state.

floatsetTremoloPhaseOffset

Ports

  • In ininput · audio · mono
  • Out outoutput · audio · mono

One sample per tremoloNodeTick call.

Dependencies

Dependents

Used by