Build with this node

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

Ask Studio

@maruaudio/dsp/distortion/wavefolder ports the DaisySP Wavefolder: the offset is added before a signed gain, then each two-unit interval of the result is reflected through a triangle fold, in f32 order.

v = (x + offset) × gain
n = floor((v + 1)/2)
y = (n even ? 1 : −1) × (v − 2n) // always within ±1

Parameters

SetterRange (clampFiniteWithFallback)FallbackDefault
setWavefolderGain−32 to 32; negative gain folds through zero11
setWavefolderOffset−1 to 100

Lifecycle

initWavefolderNode() (no sample rate) → setters → wavefolderNodeTick. There is no signal history: resetWavefolderNode does nothing and keeps gain and offset, so a reset render equals a newly configured state. Ticks allocate nothing and do no I/O.

When to use it

Folding a synth oscillator or a bass to add harmonics, with gain as the fold depth and offset for asymmetric folds. For a filtered, trimmed output with the DC removed, use @maru/distortion-voiced-wavefolder.

Limits

  • Mono sample tick, wet only, no oversampling: the fold deliberately aliases.
  • A non-zero offset produces DC, including on silence.
  • The transformed value is clamped to ±524,288 (non-finite → 0) before the parity step, which keeps the behaviour finite without changing source parity in the normal domain.

Algorithm properties and proofs

No Lean 4 proof is mapped to this node.

Explore proofs alongside performance

Parameters

ParameterTypeSetter
Gain gain

Set the source's signed pre-fold gain. Negative gain is retained because DaisySP explicitly supports through-zero operation.

floatsetWavefolderGain
Offset offset

Set the source's pre-gain offset for asymmetric folding.

floatsetWavefolderOffset

Ports

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

One sample per wavefolderNodeTick call.

Dependencies

Dependents

Used by