Build with this node

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

Ask Studio

@maruaudio/dsp/distortion/decimator is a wet-only port of the DaisySP Decimator: a sample-and-hold followed by fixed-point bit clearing, with no interpolation, no anti-alias filter and no added latency. The hold captures a new input after floor(96 × factor²) held samples. The held value is scaled to 65536 × overflow, truncated towards zero, has its lowest bits cleared (floored to a multiple of 2^bits) and is scaled back, all in f32.

Parameters

SetterRange (clampFiniteWithFallback, NaN → 0)Default
setDecimatorDownsampleFactor0 to 1 hold factor0 (every sample)
setDecimatorBitcrushFactor0 to 1, mapped to floor(16 × factor) cleared bits0 bits
setDecimatorSmoothCrushing> 0 selects the fractional bit-scale modeOff (hard)

In smooth mode one more bit is cleared and the scale uses overflow = 2 − 16 × factor + bits; "smooth" names the bit scale, not a time filter. Factor and mode changes keep the hold counter and held sample.

Lifecycle

initDecimatorNode(rate) → setters → decimatorNodeTick → resetDecimatorNode, which clears the counter, hold and output and keeps the settings. The cadence counts samples; the stored rate is not read. Ticks allocate nothing and do no I/O.

When to use it

Raw lo-fi aliasing and coarse amplitude steps on drums or synths, matching a DaisySP-based device.

Limits

  • Mono sample tick, wet only. Inputs are clamped to ±16,383 so the smooth-mode fixed-point value stays inside 32-bit range; NaN and infinities become silence. Normal headroom such as ±2 and ±8 keeps parity.
  • The floored grid is asymmetric for negative values, as upstream's. The port starts at hold factor 0 and zero cleared bits, where upstream Init starts at factor 1 with an uninitialized bit count.

Algorithm properties and proofs

No Lean 4 proof is mapped to this node.

Explore proofs alongside performance

Parameters

ParameterTypeSetter
Decimator downsample factor decimatorDownsampleFactor

Set DaisySP's 0..1 sample-hold factor. This updates cadence only: a live compatible edit retains the counter and currently held sample.

floatsetDecimatorDownsampleFactor
Decimator bitcrush factor decimatorBitcrushFactor

Set DaisySP's continuous 0..1 bit-crush factor. It maps to 0..16 cleared fixed-point bits and retains the sample-hold history and cadence.

floatsetDecimatorBitcrushFactor
Enabled enabled

Select DaisySP's fractional bit-scale mode. “Smooth” describes its bit scale, not a time-smoothing filter; the change retains signal history.

floatsetDecimatorSmoothCrushing

Ports

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

One sample per decimatorNodeTick call.

Dependencies

Dependents

Used by