@maruaudio/dsp/distortion/jitter-reducer is a sample-and-hold reducer whose sampling clock jitters deterministically, a Maru original. Each time the countdown runs out it holds the input and draws the next interval from @maru/noise-xorshift32:
interval = max(1, period × (1 + bipolar × jitter × 0.9)), period = rate / rateHzso intervals vary by up to ±90 % at full jitter, quantized to the host's sample grid. A one-pole tone filter (@maru/filters-tone) shapes the held value and an output trim follows.
Parameters
configureJitterReducer(state, rateHz, jitter, toneHz, outputDb) uses clampFiniteWithFallback (@maru/math-range):
| Argument | Range | Fallback |
|---|---|---|
rateHz | 100 Hz to min(48 kHz, host rate) | 8 kHz |
jitter | 0 to 1 | 0 |
toneHz | 500 Hz to min(16 kHz, 0.45 × rate) | 16 kHz |
outputDb | −24 to 0 dB (@maru/math-decibels) | 0 dB |
Before the first configure, the period is 1 sample, the tone filter sits at its 1 kHz default and the gain is 1.
Lifecycle
initJitterReducer(rate, seed) (rate 8 to 192 kHz, fallback 48 kHz; seed 0 →
- →
configureJitterReducer→jitterReducerTick→
resetJitterReducer, which restores the seed, clears the hold and resets the tone filter. Ticks allocate nothing and do no I/O.
When to use it
Lo-fi sample-rate reduction with an unsteady clock, on drums, keys or a full mix, from a seed that renders the same every time.
Limits
- Mono sample tick; no fractional-time interpolation between holds.
- The held input is clamped to ±16 (non-finite → 0).
- At jitter 0 the timing is a fixed sample-and-hold.