@maruaudio/dsp/filters/tone is the chain's one-pole low-pass tone control as a stateful DSP node. It stores the authored cutoff, the coefficient derived from it with toneFilterCoefficient and a double accumulator that is deliberately never rounded to f32. The arithmetic is that of @maru/filters-one-pole.
const state = initToneFilterNode(48000)
setToneFilterFrequency(state, 2000)
const y = toneFilterNodeTick(state, x)Parameters
| Setter | Range the code applies | Default | Unit |
|---|---|---|---|
setToneFilterFrequency | Coefficient toneHz / sampleRate, clamped to 0.001 to 1; the authored value is stored as given | 1000 | Hz |
Lifecycle
initToneFilterNode(sampleRate) → setToneFilterFrequency → toneFilterNodeTick → resetToneFilterNode. The setter re-derives the coefficient at once. prepareToneFilterNodeSampleRate sets a new rate and re-derives the coefficient from the stored cutoff without allocating. resetToneFilterNode clears the accumulator and keeps the coefficient.
When to use it
A simple treble cut after a drive, delay or synth voice, where one control darkens the signal. For a cutoff that is an exact −3 dB point, use onePoleLowpassCoefficient from @maru/filters-one-pole instead.
Limits
- Mono sample tick, first order, with no smoothing of cutoff changes.
- The cutoff-to-coefficient map is linear (
Hz / rate), not the −3 dB law: 1000 Hz at 48 kHz gives 0.0208. - Results below the smallest normal f32 magnitude are flushed to zero.
audio-kernelskeeps the PCM16 render entry and forwards this state.