@maruaudio/dsp/filters/dc-block is a leaky differentiator, y[n] = x[n] − x[n-1] + p·y[n-1], with DaisySP DcBlock's f32 semantics. Every operation rounds through Math.fround, in the order DaisySP computes it. The CHOMPI firmware uses it on its line, mic and pre-filter FX signals.
const state = initDcBlockNode() // pole 0.99
const y = dcBlockNodeTick(state, x)Parameters
There are no setters. The pole is passed to initDcBlockNode(pole = 0.99) and stored as an f32; there is no clamp.
| Init argument | Range as coded | Default | Unit |
|---|---|---|---|
pole | Any number, rounded to f32 | 0.99 | per-sample feedback |
Lifecycle
initDcBlockNode → dcBlockNodeTick per sample → resetDcBlockNode, which clears the one-sample input and output history and keeps the pole. There is no prepare step, because the pole does not depend on the sample rate.
When to use it
Remove a constant offset after an asymmetric distortion, a rectifier or a microphone input, before a stage that would otherwise drift or clip on DC.
Limits
- Mono sample tick with one sample of history.
- The pole is per sample, so the corner moves with the rate: the source notes about 76 Hz at the firmware's 48 kHz. Pass another pole for another corner.
- No guard: a pole at or above 1 is not refused.