How it works
The physical chain from key to ear, the modal engine that runs it in real time, how it is measured against real pianos — and what is not right yet.
Unsampled Piano contains no recordings. Every sound it makes is computed while you play, from a model of the parts of a piano and the way they push on each other. Recordings of real pianos are used for one thing only: measuring, to set the model’s parameters and check them.
The chain
- Hammer. A key’s velocity becomes a hammer speed, through a law fitted on recordings of pianists playing (a touch preset can lay another one over the instrument). The hammer’s felt is a nonlinear, hysteretic spring (Stulov) that hardens gradually towards its core, the harder it is squeezed — no layer to cross, so the timbre changes smoothly with the dynamics. The shank bends: a short treble blow meets the head almost alone. A passive contact solver integrates the strike against the strings, sample by sample. → Hammer
- Strings. One to three stiff strings per key, each a bank of modes with its own inharmonicity, losses and two directions of vibration, coupled to the other strings of its key through the bridge (Weinreich): the double decay and the beating come out of that coupling, not from envelopes. The strings of a unison never lie exactly level, so a soft blow strikes them unevenly and a little out of step, which keeps the aftersound alive. Loud bass notes add their phantom partials. → Strings, Tuning
- Dampers and pedals. The damper felt rests on top of the strings: it stops their up-and-down motion but only rubs against the sideways one, so a released note dies in two stages, fast and then a quiet tail, as on a real piano, instead of being cut. The top 22 strings, from D♯6, have no dampers and ring on. The sustain pedal is continuous, its half pedal fitted on a Disklavier; with the dampers up, every free string listens to the bridge (sympathetic resonance). → Dampers, Player
- Soundboard. A clamped orthotropic plate, modal, driven by the bridges, loading the strings in return. It loses energy at its edge, into the rim and the case, and through its lowest mode, the whole case moving on its legs: that is what makes the bass fundamentals die away as on real grands. The cast-iron frame and the rim radiate too. → Soundboard, Frame & rim
- Radiation. Two microphones in space hear the board through the Rayleigh integral, with its back face, the lid’s reflection and shadow. → Microphones
- Room. Image sources for the early reflections, a feedback delay network for the tail. The two microphones share the tail at low frequencies and hear it independently at high ones, as a spaced pair does in a hall. → Room
Mechanical noises — the keybed, the pedal, the dampers landing — are impulses into the same strings and board. The knock of the action itself — key, shank, keyframe — is heard directly through the air, from the side of the key’s strings, at the same level for every key. → Noises
A modal engine
Strings, board, frame and rim are all written the same way: as modes, damped oscillators each computed as a complex one-pole recursion, z ← p·z + b·x. The complex form keeps the frequencies exact in single precision down to A0, and it vectorises: modes are packed in chunks that the CPU advances together with AVX2 or AVX-512. Partials that have died away are dropped, and resting parts sleep. On one core of a recent desktop CPU, a Chopin performance takes about a sixth of the time available (AVX-512; a quarter with AVX2); spread over four threads, with the soundboard split between them, about 7 %. Results are bit-identical whatever the instruction set and the number of threads, which makes offline renders reproducible.
What is costly is not playing but building: computing the string modes, the board’s modes, their coupling and the radiation weights for two microphones. Changing a “rebuild” parameter does that in the background — about a tenth of a second — and swaps the new instrument in without cutting held notes.
Smaller machines can trade parts of the model for CPU: four
quality levels go from Light (about a third of the default
cost) to Overkill, which takes no shortcut at all, even inaudible ones, as the reference the
others are measured against. Behind an output above 48 kHz, the standalone player computes the
piano at 44.1 or 48 kHz and upsamples it, with half-band filters flat to 20 kHz: half the load
or less for the same sound (--full-rate to compute at the output’s rate).
Calibration
The default instrument is fitted, one change at a time, on measurements of real pianos:
- Eight real grands, recorded note by note at several dynamics — Steinways, Yamahas (C3, C5, CF-3 and two Disklaviers) and a Hamburg concert grand measured by Plath in an anechoic chamber. A test bench renders every third key at pp, mf and ff and scores the model against them, register by register: attack, brightness, dynamics, sustain, decay, tuning, each in units of the spread between the real pianos. Every change is measured on the whole bench before it is kept.
- Recorded performances — pianists on Disklavier and Bösendorfer SE pianos, which record the keys and pedals they play. The model plays the same MIDI, the notes are compared one by one, and the two are heard side by side. The default velocity law was fitted on them.
- The analysis of every note: partial frequencies (inharmonicity, stretch), decay rates of every partial (ESPRIT), prompt sound and aftersound — first on Salamander Grand, a recorded Yamaha C5.
- A commercial modelled piano, recorded through its acoustic models, served in the early steps as a reference for timbre at every dynamic, for pedal behaviour and for the range of instruments. Being a model itself, it is still measured, as information, but never enters the bench’s targets.
Each step is a document in the repository — the hypothesis, the measurement, what changed and by how much: the list is in the README.
Honestly: what is not right yet
The model sits within the spread of the real pianos on most measures, not everywhere. Known limitations of version 0.2.1:
- the sound is still being tuned against real pianos;
- the loudness of the lowest partials still varies more from key to key than on real pianos;
- the C5 octave is a little too bright, and the C6 octave a little too dull;
- the Balanced and Light quality levels have not been compared by ear yet;
- macOS: the application is not notarised — the first time, open it with a right click →
Open, or run
xattr -dr com.apple.quarantine "Unsampled Piano.app"; - Linux: the archive needs PipeWire and glibc 2.39 or later (Ubuntu 24.04, Fedora 40, Arch, or later).
Structural work still ahead: a more realistic soundboard (ribs, an irregular outline, varying thickness, finite-element modes), and the duplex scale. If you know pianos — or physics — and hear something wrong, an issue is very welcome.