@maruaudio/dsp/filters/multimode-cascade is the CHOMPI firmware's two-pole resonant multimode filter (BasicMMF): two cascaded one-pole integrators with band-pass feedback.
buf0 += f·(in − buf0 + fb·(buf0 − buf1))
buf1 += f·(buf0 − buf1)
fb = res + res / (1 − f)Low-pass reads buf1, high-pass in − buf0, band-pass buf0 − buf1. Every operation is rounded to f32 in source order.
Parameters
| Setter | Range as coded | Default | Unit |
|---|---|---|---|
setMultimodeCascadeMode | MULTIMODE_CASCADE_LOWPASS (0), HIGHPASS (1), BANDPASS (2); any other value outputs 0 | Low-pass | mode |
setMultimodeCascadeFrequency | Not clamped; the source's domain is 0 to below 1 | 0.5 | per-sample integrator coefficient, not Hz |
setMultimodeCascadeResonance | Not clamped | 0.5 | resonance |
setMultimodeCascadeControls sets frequency and resonance with one feedback update, identical to calling both setters. Each setter recomputes fb at once.
Lifecycle
initMultimodeCascadeNode (low-pass, f 0.5, res 0.5, fb 1.5) → setters → multimodeCascadeNodeTick per sample → resetMultimodeCascadeNode, which clears both integrators and keeps mode and controls. There is no sample-rate input or prepare step.
When to use it
A compact resonant filter where the firmware's behaviour must be reproduced exactly, or a building block for a sweepable filter such as @maru/filters-dj-filter, which keeps its coefficient at or below 0.99.
Limits
- Mono sample tick. The coefficient is per sample, so the response is calibrated to 48 kHz and scales with any other rate.
- Unguarded like the source:
frequency = 1divides by zero, and high resonance near the top of the range self-oscillates and can grow without bound. Callers bound their controls.