@maruaudio/dsp/physical/modal-table holds the helpers that turn a measured or reference mode table into the modes of one played note, at publication or configuration time. A table is recipe-major (modalTableSlot(recipe, mode, stride)). modalTableFrequencyAtPitch scales a reference mode to the played fundamental, played · (modeFreq / refFreq) ^ stretch, so an inharmonicity stretch other than 1 bends the partial series. modalTableDecayAtPitch multiplies the reference decay by a pitch scale and a damping scale, and modalTableRadiationGain applies @maru/physical-modal's 1 kHz roll-off when the table asks for it.
const n = modalTableBoundedModeCount(requested, 16) // before any mode loop
const f = modalTableFrequencyAtPitch(220, 440, 1320, 0.9)Lifecycle
None: stateless functions with no allocation. They stop at preparation time and own no resonator state, so a gamelan bar, a gong plate and the shared modal bank use the same table conventions without sharing a voice.
When to use it
Building a struck instrument from a published mode table, where each key plays the table's partials at its own pitch and damping.
Limits
modalTableBoundedModeCountreturns 0 for a non-positive or NaN request or capacity, caps at the capacity and floors the result.modalTableRadiationGainapplies roll-off whenrolloffis non-zero and otherwise returns the gain unchanged.- Frequencies and decays are computed in f64; the guard against modes near Nyquist (
modalModeAboveNyquistGuard) is the caller's call.