Build with this node

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

Ask Studio

@maruaudio/dsp/voices/gamelan models struck idiophones as a modal resonator bank: a strike drives a short exciter burst (deterministic xorshift noise under a raised-cosine window, plus a contact impulse) into up to six coupled-form two-pole resonators per voice, each with a left and right copy detuned by the ombak amount. Strike position and a velocity tilt set per-mode gains. Eleven recipes: gender, slenthem, saron, peking, bonang, bonang panerus, kenong, kempul, gong, bell and vibraphone.

Parameters

setGamelanParam(state, index, value), clamped as coded:

IndexRangeDefaultUnit
0 IR_INSTRUMENTRounded, 0 to 10 (recipe order above)0—
1 IR_DECAY_SCALE / 2 IR_DAMPING / 3 IR_STEREO_WIDTH0.1 to 3 / 0.05 to 4 / 0 to 11 / 1 / 0.5—
4 OMBAK_AMOUNT / 5 OMBAK_RATE0 to 2 / 0 to 201 / 3— / Hz
6 EXCITER_HARDNESS / 7 EXCITER_NOISE0 to 10.5 / 0.1—
8 AMP_DECAY / 9 AMP_RELEASE0.05 to 4 / 0.02 to 44 / 0.25s
10 TUNING_MODE / 11 TUNING_BASE_FREQRounded, 0 equal, 1 just, 2 slendro, 3 pelog, 4 custom / 220 to 880 Hz2 / 440—
12 MASTER_LEVEL0 to 1; 0.01 s glide while voices ring0.8—
13 STRIKE_POSITION / 14 STRIKE_VEL_TONE / 15 IR_SIZE0 to 1 / 0 to 1 / 0.5 to 20.5 / 0.5 / 1—

At an amp decay of 2.5 or more (DECAY_OPEN) no damping envelope applies.

Lifecycle

initGamelanVoice(rate) allocates every per-voice array → set parameters → gamelanNoteOn(note, velocity) returns 0 and touches nothing on an unmapped slendro or pelog key; otherwise it releases a ringing voice on the same note, takes a free slot or steals the oldest (starting the shared note-transition bridge), and strikes → gamelanNoteOff starts the release ramp (at least 5 ms) → per frame, gamelanVoiceTick(state, voice, out) per voice adds into a caller-owned stereo pair, then gamelanAdvanceMasterLevel once. To reset, init a new state.

When to use it

Gamelan metallophones and gongs in slendro or pelog, or bell and vibraphone, where strike position and velocity should change which partials ring.

Limits

  • Stereo, sample tick, eight voices of six modes; a voice rings at most 7 s.
  • Modes at or above 0.45 × the sample rate are silenced (Nyquist guard).
  • The PCM16 render entry stays in audio-kernels; the voices barrel omits it.

Algorithm properties and proofs

No Lean 4 proof is mapped to this node.

Explore proofs alongside performance

Dependencies

Dependents

No other node imports this one.

Used by