Build with this node

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

Ask Studio

@maruaudio/dsp/physical/modal-resonator is one addressable two-pole modal resonator: a single mode of a struck or bowed body, driven by an input signal. Each input sample is added into @maru/physical-modal's coupled-form recurrence and the sine-phase state is the output, so an impulse rings one exponentially decaying sinusoid. Decay is set as a T60 in seconds and converted to the modal decay coefficient ln(1000) / t60. State and coefficients are rounded to 32-bit floats.

const state = initModalResonatorNode(48000)
setModalResonatorNodeFrequency(state, 660)
setModalResonatorNodeT60(state, 0.8)
updateModalResonatorNodeCoefficients(state) // before the next tick
const y = modalResonatorNodeOutput(state, x)

Parameters

SetterRange the setter enforcesDefault
setModalResonatorNodeFrequency0 Hz to half the sample rate440 Hz
setModalResonatorNodeT600.001 to 60 s1 s
setModalResonatorNodeGain0 to 4, linear1
setModalResonatorNodeRolloffAny non-zero value turns on the min(1, 1000 / f) roll-offoff

Lifecycle

initModalResonatorNode(rate) → setters → updateModalResonatorNodeCoefficients → modalResonatorNodeTick (raw) or modalResonatorNodeOutput (with gain and roll-off) → resetModalResonatorNode. Setters only store values; a new state is silent until the update. prepareModalResonatorNodeSampleRate sets a new rate and re-clamps the frequency; update again. Reset clears the two state words and keeps the settings. Ticks allocate nothing.

When to use it

One resonant partial on an input, such as a tuned ring or one mode of a hand-built modal instrument; @maru/physical-modal-resonator-bank runs many.

Limits

  • Mono sample tick, not a block Processor. Changes apply at the coefficient update, unsmoothed.
  • The clamp is the kernel node's conditional clamp, not math/range: a NaN passes through. The pole radius stays below 1, so the mode always decays.

Algorithm properties and proofs

No Lean 4 proof is mapped to this node.

Explore proofs alongside performance

Parameters

ParameterTypeSetter
Frequency frequencyfloatsetModalResonatorNodeFrequency
T60 t60floatsetModalResonatorNodeT60
Gain gainfloatsetModalResonatorNodeGain
Rolloff rollofffloatsetModalResonatorNodeRolloff

Ports

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

One sample per modalResonatorNodeTick call.

Dependencies

Dependents

Used by