Build with this node

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

Ask Studio

@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

  • modalTableBoundedModeCount returns 0 for a non-positive or NaN request or capacity, caps at the capacity and floors the result.
  • modalTableRadiationGain applies roll-off when rolloff is 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.

Algorithm properties and proofs

No Lean 4 proof is mapped to this node.

Explore proofs alongside performance

Dependencies

Dependents

Used by