How Gamelan models bronze

How the Gamelan preview models struck bronze, flexible tuning, paired beating, and the missing bars in slendro and pelog scales.

5 min read
How Gamelan models bronze

The Gamelan module builds its sound from modeled resonances rather than recorded samples. That approach keeps the partials, decay, size, and tuning open to change while you play.

This post is about the two halves of that: how the metal is made, and how it is tuned.

How a struck bar rings

Hit a bronze bar and it produces several pitches at once, each fading at its own speed. Those are its modes: the specific ways that particular casting is free to vibrate. The lowest one is what you call the note; the others sit above it and give it character.

On a string or a flute, those higher components land at neat whole-number multiples: two times, three times, four times the fundamental. That is what "harmonic" means, and it is why those instruments sound like a pitch. Bronze bars do not do this. A gamelan metallophone's second mode sits at about 2.3 times its fundamental, then 3.6, then 5.25, 7.1, 9.35. A hanging gong is stranger still and much tighter at the bottom: 1, 1.52, 2.33, 2.9, 3.98. Those are the numbers this module is built from, measured per instrument family, and that stretch is most of the reason bronze sounds like bronze rather than like a piano with the tone knob down.

An impulse response, and why ours is synthetic

An impulse response is a recording of how something rings. Clap once in a stone church and record it; the slap, reflections, and long tail form the church's impulse response. Feed another sound through it using convolution and that sound takes on the same response. Guitar cabinet IRs work similarly, using a sweep through a speaker cabinet.

A gamelan bar has an impulse response too. Struck once, it rings out its modes and fades. Modal synthesis lets us describe that response directly as a sum of decaying sine waves, one per mode, each placed at its measured ratio with its own level and decay rate. Gender gets six modes; a hanging gong gets five, with the lowest ones set to fade slowly. Rendering those modes to a stereo buffer produces an IR for a modeled bar.

A note is a mallet strike convolved with that IR. The strike lasts between two and twelve milliseconds and combines filtered noise with a short impact. The Hardness knob shortens it and opens its filter, reflecting the wider spectrum of hard contact. Hardness therefore changes which partials receive energy, not just the overall brightness.

Because the IR is modeled, it can be rebuilt for every note. A different key scales the mode set to a new fundamental and shortens the ring for smaller virtual bars. The Size knob extends the same relationship: larger castings decay more slowly, beat more slowly, and relax their overtone stretch. One recipe can then cover a family of related instruments such as panerus, demung, and suwukan.

The tuning, which is the actual instrument

A gamelan is not tuned to the twelve equal semitones your keyboard assumes. It uses slendro, five roughly-even steps to the octave, or pelog, seven distinctly uneven ones. There is no universal reference: each ensemble is tuned by its own smith, and two gamelans a village apart genuinely disagree about what note anything is. So the module treats tuning as part of the instrument and puts it on the faceplate rather than in a settings menu.

Select slendro and most of the keyboard goes quiet. Five pitch classes carry the five scale degrees: C, D, E, G, and A. Pelog maps seven onto C, C#, D, E, F, G, and A. An unmapped key stays silent because there is no corresponding bar to strike. The tuning strip marks those keys and responds when they are played, so the silence reads as part of the instrument. Base Pitch remains adjustable because gamelan ensembles use their own references rather than a universal 440 Hz standard.

Ombak: two bars that disagree

The shimmer of a gamelan comes from instruments built and tuned in pairs, deliberately a few hertz apart so the struck pair beats against itself. The Javanese word is ombak, meaning wave.

We model ombak inside the resonance. Every mode in the IR is placed slightly flat in the left channel and slightly sharp in the right, split around the rate you set. The resulting interference gives every note its own drift instead of pulsing the entire output with one tremolo. Presets use slower beating for lower instruments and faster beating for higher ones. Turn Depth to zero and the beating disappears.

What this does not capture

A modal model is a good approximation and an incomplete one, and it is worth being clear about the gap.

Real bronze couples its modes nonlinearly. Strike it hard and the partials shift and interact in ways a sum of independent decaying sines cannot reproduce. Our modes are independent by construction, so the nonlinear bloom of a hard-driven gong remains out of reach. Strike position is modeled: the Position knob maps the bar and weights each mode by its shape at the contact point. A center strike suppresses modes whose nodes sit there, while a quarter-point strike changes the balance again. Gongs use a circular version of the same map from boss to rim. Velocity also changes the strike itself. A soft hit has longer contact and excites fewer high modes, while harder hits bring in more of the stretched ladder. Missing pieces include radiation patterns, resonating tubes under the keys, sympathetic ringing across the frame, and amplitude-dependent pitch behavior in the gongs.

This is a preview engine built with hand-written Web Audio in the browser. It is outside the compiled-kernel parity system, and its current goal is to explore the musical model rather than reproduce a complete acoustic ensemble.

Go strike something

Gamelan is playable on this site now, in a tab, free. Load Gong Ageng, hit one note, and let the whole seven seconds happen before you play the next one. Then switch to slendro and spend a minute finding out which keys are alive. That second minute is the one that teaches you something no sample library can.