AvailableInstrument

Gamelan

Modelled bronze instruments with flexible tuning.

@maru shared this instrument so you can play it in your DAW, remix it or put it on your site.

What it does

Modelled bronze: nine gamelan metallophones and gongs, plus a bell and a vibraphone, played from a keyboard in slendro, pelog or Western tunings. Nothing is sampled. Each note is a mallet strike ringing a set of modelled partials, so how and where you strike changes the sound.

The idea

A gamelan is not a piano with a different sample set. Its bars and gongs are inharmonic: a metallophone's second partial sits at about 2.3 times the fundamental, not 2, and that stretch is most of why bronze sounds like bronze. Its scales have five or seven notes to the octave. An instrument that ignores either fact ends up sounding like a bell patch; this one starts from both.

Each instrument has its own measured set of partials, decay profile and beating, so a Gong Ageng and a Peking are different instruments, not the same sound transposed.

Tuning

Tuning chooses slendro, pelog, just intonation or equal temperament, with a Root Note and a Base Freq. Slendro has five notes to the octave and pelog seven, so on a chromatic keyboard some keys have no bar behind them. With Note Map on In scale, the key strip shows those keys dashed and they play the nearest bar; 12-TET instead gives every key an ordinary equal-tempered note.

Guide and controls

How it works.

Each note is an exciter driving a resonator: a two-to-twelve millisecond filtered noise burst with a leading click, convolved with an impulse response synthesised for that exact note. The IR is a bank of exponentially-decaying sinusoids placed at the instrument's measured partial ratios, 1, 2.3, 3.6, 5.25, 7.1, 9.35 for a bar metallophone, 1, 1.52, 2.33, 2.9, 3.98 for a hanging gong, pitch-scaled from the fundamental the ratios were measured at. Convolving the strike with those modes is what excites them, which is why Hardness changes the balance of partials and not just the brightness: a wider excitation spectrum reaches further up the inharmonic series.

Ombak is modelled where it actually happens. Paired gamelan instruments are tuned a few Hz apart so their combination beats, so the renderer places each mode at f minus half the ombak rate in the left channel and f plus half in the right. The beating you hear is genuine interference between two detuned partials, not an amplitude modulation applied afterwards, which is also why it survives being played polyphonically instead of all the voices pulsing in lockstep.

Strike position is in the impulse response, not on top of it. Every mode of a bar or a plate has a standing-wave shape, and how strongly a strike excites that mode is how far the surface moves at the point you hit, so each mode's amplitude is multiplied by its shape at the strike position before the IR is rendered. A bar's modes alternate symmetric and antisymmetric about its centre, so a centre strike wakes modes 1, 3 and 5 and leaves 2 and 4 at the floor; a gong's alternate between nodal circles and nodal diameters, so the boss gives you the fundamental and the rim gives you the shimmer. Nothing is weighted to exactly zero, because a real mallet has width and never lands on a mathematical point. Size scales the same bank three ways at once: it lengthens the decay, slows the ombak, and bends the partial ratios toward or away from harmonic about the fundamental, which stays put, so a bigger instrument is a different instrument rather than a transposition.

Velocity is the one place the preview and the compiled kernel do different arithmetic, and it is worth saying which. The kernel tilts each mode individually per strike. A convolver cannot: the impulse response is shared across velocities by construction, and rebuilding a three-second stereo IR per keystroke is not something a main thread can do. So the same physics is applied one stage earlier, in the exciter, a soft hit has a longer contact time and therefore a narrower excitation spectrum, which is exactly what the Hardness control already moves, so velocity is coupled into it through Vel Tone. Level follows velocity squared on both paths. The result is audibly the same gesture and is not the same computation, which is the honest summary of this whole module.

Rendering an IR is a few hundred thousand sine evaluations, so they are cached by instrument, note frequency and every timbre parameter that feeds the renderer. Play a scale and the cache fills note by note; move Damping or Ombak and the whole cache is dropped, because those parameters change the samples themselves rather than how they are played back. Voices are capped at eight with oldest-first stealing, and every voice's nodes are freed on a hard seven-second tail cap with a short fade, Gong Ageng's impulse response is six seconds long and convolution adds that to the note, so without the cap a few gongs would pile up convolvers indefinitely.

Tuning runs before any of that. A MIDI note goes through the shared tuning library, which returns either a frequency or null; null means the key is unmapped in the current scale and the voice is never created. Slendro maps five degrees onto C, D, E, G and A, pelog seven onto C, C#, D, E, F, G and A, and everything else is silent. Custom mode is equal temperament with a cents offset per pitch class, which is the practical way to dial in a specific gamelan's tuning by ear.

What would you make with Gamelan?

Describe what you want to make. Build it with the Studio agent.

Goes well with.

Prototype

A physical string model, rendered per note.

Prototype

A compact subtractive synth for learning the signal path.

Prototype

Convolution reverb: eight synthesized spaces, twenty-five real cabinets.