Tuning
Pitch, inharmonicity and stretch — why a piano is never tuned to the equal-tempered table, and how the model follows a real one.
A piano string is a steel wire, and steel is stiff. A perfectly flexible string would vibrate at exact multiples of its fundamental; a stiff one resists bending a little more for each shorter wave, so every partial comes out sharp, and more so the higher it is. That is the piano’s inharmonicity — part of its slightly metallic colour, and the reason it cannot be tuned by the textbook.
Inharmonicity
Each key gets a coefficient B, and partial k lands at
fk = k · f0 · √(1 + B · k²)
Inharmonicity · partials of a stiff string
B is large for the short, thick strings of the treble, and rises again in the bass where the strings are foreshortened to fit the case. The model uses the two-exponential law of Rigaud, David and Daudet (2013), fitted on the recordings of a Yamaha C5 (the Salamander Grand):
Inharmonicity B
Stretch
Because the partials are sharp, an octave tuned exactly 2:1 between fundamentals sounds flat: the upper note’s fundamental beats against the lower note’s sharp second partial. Tuners stretch the octaves instead — treble tuned sharp, bass flat — until they sound pure. The model follows a fitted stretch law, in cents from equal temperament:
cents(n) = a_t · ek_t (n − 69) − a_b · e−k_b (n − 69) + c
Stretch
a4 moves everything: 440 Hz is the modern standard, orchestras often tune to 442, baroque
ensembles to 415 — the Baroque 415 character preset does that, and also turns the stretch
off and makes the felt less nonlinear. Changing it rebuilds
the instrument, because each string’s mass is computed from its pitch, length and tension.
In the application

Parameters
General
A4 pitch
rebuilda4Pitch of the A above middle C, which the whole tuning follows. 440 Hz is the modern standard; some orchestras tune to 442, baroque ensembles to 415.
Each key's fundamental is a4·2^((n − 69)/12), shifted by the stretch law. The string masses follow from it (μ = T/(2·L·f0)²), so the instrument is rebuilt.
Inharmonicity
A bass
rebuildinharmonicity.a_bassSteel strings are stiff, so their overtones are a little sharp of exact multiples of the fundamental: this gives the piano its slightly metallic colour. This sets how fast that inharmonicity falls from the lowest key towards the middle.
B(n) = e^(a_bass·n + b_bass) + e^(a_treble·n + b_treble) (Rigaud, David & Daudet 2013), partial k at k·f0·√(1 + B·k²). Fitted on Salamander's Yamaha C5 (rms 0.07 in log B).
A treble
rebuildinharmonicity.a_trebleHow fast inharmonicity grows towards the top. Short, thick treble strings are very stiff.
Slope of the treble exponential of B(n).
B bass
rebuildinharmonicity.b_bassInharmonicity of the bass strings: higher, more 'metallic' and more out-of-tune overtones in the bass.
Offset of the bass exponential of B(n) (natural log).
B treble
rebuildinharmonicity.b_trebleInharmonicity of the treble strings.
Offset of the treble exponential of B(n) (natural log).
Stretch tuning
A b
rebuildstretch.a_bAmount of stretch (flattening) in the bass.
Amplitude a_b of the bass exponential (cents).
A t
rebuildstretch.a_tTuners stretch the octaves: the treble is tuned sharp and the bass flat of equal temperament, so the octaves sound pure despite the sharp overtones. Amount of stretch in the treble.
Stretch in cents: a_t·e^(k_t·(n − 69)) − a_b·e^(−k_b·(n − 69)) + c. Fitted on Salamander, C8 excluded (rms 2 cents): −16 cents at A0, +25 at C8.
C
rebuildstretch.cOffset of the whole tuning around A4 (cents).
Constant term c of the stretch law.
K b
rebuildstretch.k_bHow quickly the bass stretch builds up towards the bottom.
Rate k_b of the bass exponential (per key).
K t
rebuildstretch.k_tHow quickly the treble stretch builds up towards the top.
Rate k_t of the treble exponential (per key).