/ music / marimba
Sign in
music / marimba
marimba / README.md
5.8 KBPreviewCodeBlameHistoryRaw

Marimba#

Interactive marimba, C2–C7. Every key has its own rosewood bar, tuned by its undercut, with its own resonator tube underneath. Sound comes from modal synthesis of the bar coupled to the tube.

npm run dev   # http://127.0.0.1:8021

The FE model, the tuner and the sound run in any modern browser. The optional 3D FDTD check needs WebGPU (Chrome, Safari 26+). three.js loads from jsDelivr (pinned 0.169.0).

Model#

FDTD check#

Analyze bar (FDTD) voxelizes the selected bar in air. It reuses woodblock2's WebGPU velocity–stress solver and runs two force-impulse simulations. Modes are fitted from the top-face velocities, matched to the FE modes by shape, and compared in a table. Sound from → FDTD modes plays them through the same tube and mic model.

The grid makes thin wood too soft, so FDTD frequencies come out low and approach the FE values as the grid is refined. Example, C4 bar:

grid bar f1 FE f1 FDTD
3 mm uniform (no undercut) 698 Hz 646 Hz (−135 ¢)
3 mm tuned (undercut 3 cells thick) 262 Hz 151 Hz (−951 ¢)
2 mm tuned 262 Hz 219 Hz (−312 ¢)

Higher torsion modes come out above the FE values even at 3 mm, which points to the FE torsion model (no warping) being too soft there.

Controls#

SoundFont export#

Export .sf2 samples keys every 1–6 semitones. Each sampled key renders its own bar and tube (your edited design if there is one, otherwise the auto-tuned bar), so register changes are physical, not pitch-shifted. There are 4 velocity layers; softer layers use a slower strike and slightly softer yarn. SF2 has no round-robin, so each layer is split into 3 velocity bands struck at nearby points. One global gain keeps the physical loudness of keys and layers. The preset is GM program 13 (Marimba), bank 0. With the defaults (C2–C7, every 3 semitones) the file is about 23 MB and renders in about 11 s.

↑↓ move↵openescclose