Build with this node

Start with a prompt in Studio, or copy it into your own coding agent.

Ask Studio

@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

SetterRange the code appliesDefaultUnit
setToneFilterFrequencyCoefficient toneHz / sampleRate, clamped to 0.001 to 1; the authored value is stored as given1000Hz

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-kernels keeps the PCM16 render entry and forwards this state.

Implementations

Rust Output verified: The build passed and its output matches the reference implementation.

Verified on Apple Silicon macOS native and Node WASM at 8, 44.1, 48, 96 and 192 kHz. Output and state match the TypeScript reference, with no observed allocations, reallocations or deallocations during the tested processing, control and reset calls. Browser hosts, plugins, other operating systems and realtime deadlines have not been verified. Performance has not been measured.

View target checks and scope

Algorithm properties and proofs

Lean 4 checks specific properties of this algorithm’s mathematical model. Each model result applies within its stated domain and assumptions.

6 Lean 4 results: 5 proofs in exact arithmetic; 1 counterexample.

Proved in exact arithmetic.The clamped tone coefficient lies between one thousandth and unity in the rational design model.Exact rational tone state and controls; finite positive sample rates for coefficient design; explicit coefficient and zero-containing interval hypotheses
Limits and assumptions
  • Hand-written source-reviewed exact-rational model, not formal TypeScript or compiled-code refinement. Named source files and symbols are digest-bound, and executable dyadic cases are compared with canonical JavaScript. The model includes the strict flush interval but omits binary64 rounding, NaN, infinity and signed-zero distinctions. The design recurrence requires positive sample rates and assumes rational division/clamping, not arbitrary IEEE sample-rate admission. The stream theorem requires a zero-containing interval and finite valid state; no transcendental coefficient design, processing deadline or Rust artifact theorem is claimed.
Theorem
MaruLean.FilterContracts.tone_coefficient_bounded
Recorded axioms
propext, Classical.choice, Quot.sound
Manifest reviewed
Proved in exact arithmetic.The tone update with flush-to-zero preserves any bounded interval containing zero when its coefficient lies in [0,1].Exact rational tone state and controls; finite positive sample rates for coefficient design; explicit coefficient and zero-containing interval hypotheses
Limits and assumptions
  • Hand-written source-reviewed exact-rational model, not formal TypeScript or compiled-code refinement. Named source files and symbols are digest-bound, and executable dyadic cases are compared with canonical JavaScript. The model includes the strict flush interval but omits binary64 rounding, NaN, infinity and signed-zero distinctions. The design recurrence requires positive sample rates and assumes rational division/clamping, not arbitrary IEEE sample-rate admission. The stream theorem requires a zero-containing interval and finite valid state; no transcendental coefficient design, processing deadline or Rust artifact theorem is claimed.
Theorem
MaruLean.FilterContracts.tone_step_interval
Recorded axioms
propext, Classical.choice, Quot.sound
Manifest reviewed
Proved in exact arithmetic.For every sample index, an arbitrarily modulated tone stream remains in its zero-containing input/state interval with admitted coefficients.Exact rational tone state and controls; finite positive sample rates for coefficient design; explicit coefficient and zero-containing interval hypotheses
Limits and assumptions
  • Hand-written source-reviewed exact-rational model, not formal TypeScript or compiled-code refinement. Named source files and symbols are digest-bound, and executable dyadic cases are compared with canonical JavaScript. The model includes the strict flush interval but omits binary64 rounding, NaN, infinity and signed-zero distinctions. The design recurrence requires positive sample rates and assumes rational division/clamping, not arbitrary IEEE sample-rate admission. The stream theorem requires a zero-containing interval and finite valid state; no transcendental coefficient design, processing deadline or Rust artifact theorem is claimed.
Theorem
MaruLean.FilterContracts.tone_run_interval
Recorded axioms
propext, Classical.choice, Quot.sound
Manifest reviewed
Show 3 more Lean 4 results
Proved in exact arithmetic.The clamped coefficient model establishes interval preservation for arbitrary tone-frequency streams and positive sample rates in exact rational arithmetic.Exact rational tone state and controls; finite positive sample rates for coefficient design; explicit coefficient and zero-containing interval hypotheses
Limits and assumptions
  • Hand-written source-reviewed exact-rational model, not formal TypeScript or compiled-code refinement. Named source files and symbols are digest-bound, and executable dyadic cases are compared with canonical JavaScript. The model includes the strict flush interval but omits binary64 rounding, NaN, infinity and signed-zero distinctions. The design recurrence requires positive sample rates and assumes rational division/clamping, not arbitrary IEEE sample-rate admission. The stream theorem requires a zero-containing interval and finite valid state; no transcendental coefficient design, processing deadline or Rust artifact theorem is claimed.
Theorem
MaruLean.FilterContracts.tone_designed_stream_interval
Recorded axioms
propext, Classical.choice, Quot.sound
Manifest reviewed
Proved in exact arithmetic.A constant tone state outside the flush interval is a fixed point in exact arithmetic.Exact rational tone state and controls; finite positive sample rates for coefficient design; explicit coefficient and zero-containing interval hypotheses
Limits and assumptions
  • Hand-written source-reviewed exact-rational model, not formal TypeScript or compiled-code refinement. Named source files and symbols are digest-bound, and executable dyadic cases are compared with canonical JavaScript. The model includes the strict flush interval but omits binary64 rounding, NaN, infinity and signed-zero distinctions. The design recurrence requires positive sample rates and assumes rational division/clamping, not arbitrary IEEE sample-rate admission. The stream theorem requires a zero-containing interval and finite valid state; no transcendental coefficient design, processing deadline or Rust artifact theorem is claimed.
Theorem
MaruLean.FilterContracts.tone_normal_constant_fixed
Recorded axioms
propext, Classical.choice, Quot.sound
Manifest reviewed
Counterexample.A constant signal inside the flush interval is zeroed rather than remaining a fixed point.Exact rational tone state and controls; finite positive sample rates for coefficient design; explicit coefficient and zero-containing interval hypotheses
Limits and assumptions
  • Hand-written source-reviewed exact-rational model, not formal TypeScript or compiled-code refinement. Named source files and symbols are digest-bound, and executable dyadic cases are compared with canonical JavaScript. The model includes the strict flush interval but omits binary64 rounding, NaN, infinity and signed-zero distinctions. The design recurrence requires positive sample rates and assumes rational division/clamping, not arbitrary IEEE sample-rate admission. The stream theorem requires a zero-containing interval and finite valid state; no transcendental coefficient design, processing deadline or Rust artifact theorem is claimed.
Theorem
MaruLean.FilterContracts.tone_small_constant_refuses_fixed
Recorded axioms
propext, Classical.choice, Quot.sound
Manifest reviewed
Explore proofs alongside performance

Parameters

ParameterTypeSetter
Tone hz toneHzfloatsetToneFilterFrequency

Ports

  • In ininput · audio · mono
  • Out outoutput · audio · mono

One sample per toneFilterNodeTick call.

Dependencies

Dependents

Used by