@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
| Setter | Range (clampFiniteWithFallback, NaN → 0) | Default |
|---|---|---|
setDecimatorDownsampleFactor | 0 to 1 hold factor | 0 (every sample) |
setDecimatorBitcrushFactor | 0 to 1, mapped to floor(16 × factor) cleared bits | 0 bits |
setDecimatorSmoothCrushing | > 0 selects the fractional bit-scale mode | Off (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
Initstarts at factor 1 with an uninitialized bit count.