@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
| Setter | Range the setter enforces | Default |
|---|---|---|
setModalResonatorNodeFrequency | 0 Hz to half the sample rate | 440 Hz |
setModalResonatorNodeT60 | 0.001 to 60 s | 1 s |
setModalResonatorNodeGain | 0 to 4, linear | 1 |
setModalResonatorNodeRolloff | Any non-zero value turns on the min(1, 1000 / f) roll-off | off |
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.