Physical Piano
A grand piano built from physics, played live in the browser
What I was exploring
Most software pianos are libraries of recorded notes. They sound good, but you can't change what the instrument is made of. You can't make the strings stiffer, swap the hammer felt, or move the piano into a different hall without someone recording it all again.
This project asks a different question: can the sound come from the physics itself, fast enough to play live in a web page, with every setting tied to a real property that a computer could later tune to match a real piano?
What I built
- Each key is a set of vibrating string modes with real inharmonicity, frequency-dependent loss and one to three slightly detuned strings, run inside an AudioWorklet so it plays with no plugin or install.
- The hammer is modelled as compressible felt that pushes back nonlinearly, so playing harder changes the tone, not just the volume. Dampers, the sustain pedal and restrikes on ringing strings are handled too.
- A soundboard model and three radiating zones (bass, mid, treble) carry the sound out of the instrument.
- A room solver combines image sources and ray tracing over materials per frequency band to build the room's response. Its reverb and clarity figures are shown next to a plan and elevation you can edit.
- Every parameter is physical and set per register, so the whole piano and room fit in a vector that a fitting tool can adjust later.
- The same engine runs headless in Node, so a phrase can be rendered offline to an exact, repeatable audio file for testing and comparison.
What it does
- Play from the computer keyboard, a MIDI keyboard or the on-screen keys; on phones the keyboard folds to one octave.
- Live spectrum with the predicted partials drawn over it, so you can see the string physics as you hear it.
- Room editor with plan and elevation views, listener and piano placement, wall materials and room presets such as a concert hall shoebox.
- Room metrics per octave band (T30, EDT, C80, D50) and decay curves, recomputed when the room changes.
- Dozens of sliders across tuning, strings, losses, hammer, dampers, action and soundboard, with savable presets.
- Offline rendering to WAV, including first-order ambisonic output.
Built with JavaScript (no framework), Web Audio AudioWorklet, Web Workers, Node.js, socket.io, 2026.