@maruaudio/dsp/physical/modal-resonator-bank drives up to 16 modes from one common excitation and sums them: each mode is @maru/physical-modal's coupled-form recurrence with its own frequency, T60 and gain, and each tick also records every mode's displacement and finite-difference velocity for a body or radiation readout. A pool packs many banks into one set of typed arrays. The caller supplies excitation and mode recipe. Algorithm version 1.
const bank = initModalResonatorBank(48000)
configureModalResonatorBankMode(bank, 0, 660, 0.72, 0.36, 0) // index, Hz, T60 s, gain, roll-off
setModalResonatorBankModeCount(bank, 1)
const y = modalResonatorBankTick(bank, x)Parameters
| Setter | Range the setter enforces | Default |
|---|---|---|
configureModalResonatorBankMode index | 0 to 15; others are ignored | none |
| frequency, T60 | 0 Hz to 0.495 × the rate; 0.001 to 60 s | unset modes are silent |
| gain, roll-off | Gain 0 to 4; non-zero roll-off applies min(1, 1000 / f) | none |
setModalResonatorBankModeCount | Floored, 0 to 16 | 0 |
setModalResonatorBankOutputGain | 0 to 4, linear | 1 |
Lifecycle
initModalResonatorBank(rate) or initModalResonatorBankPool(banks, rate) allocates (a non-positive rate becomes 48 kHz) → configure modes on the control thread, which clears that mode's state → modalResonatorBankTick, processModalResonatorBankBlock(source, target, from, to), modalResonatorBankPoolTick or modalResonatorBankPoolTickEleven → resetModalResonatorBank or resetModalResonatorBankPool, which clear state and keep the modes. Ticks allocate nothing and run at most 16 modes a bank.
When to use it
A struck bar, plate or bell built from a mode table, or a sympathetic field such as a piano's: the eleven-bank traversal advances the 88-key, two-partial field in one pass.
Limits
- Mono sample tick; the block function writes only
[from, to). f32 state, coefficients and sum; readouts outside the active mode count return 0. - The clamps are the kernel node's conditional clamps: a NaN passes through.