loading...
running...
The science
The ideal string. A string of length L, tension T and mass per length mu obeys the wave equation u_tt = c^2 u_xx, c = sqrt(T / mu) with fixed ends. Its normal modes are standing waves sin(n pi x / L) with frequencies f_n = n c / (2 L) = n f1: exactly harmonic. The page takes f1, L and mu as inputs and derives the tension, T = mu (2 L f1)^2.
A plucked triangle. Pulling the string to height h at position x0 = beta L and releasing it gives the initial shape of two straight segments. Projecting it onto the modes gives
a_n = 2 h sin(n pi beta) / ( n^2 pi^2 beta (1 - beta) )
so the harmonics fall like 1/n^2 and every harmonic with n beta an integer is missing (pluck at a fifth of the length and the 5th harmonic vanishes). A soft finger rounds the corner; that multiplies a_n by exp(-(n pi s)^2 / 2), a Gaussian smoothing of width s L.
The motion. u(x,t) = sum_n a_n sin(n pi x / L) e^(-sigma_n t) [ cos(w_n' t) + (sigma_n / w_n') sin(w_n' t) ] The energy of the pluck is T h^2 L / (2 x0 (L - x0)), shared among the modes in proportion to w_n^2 a_n^2.
Stiffness and damping. A real string resists bending, which stretches the partials: w_n = n w1 sqrt(1 + B n^2) with the inharmonicity B = pi^2 E I / (T L^2) (about 1e-5 for a guitar string, 1e-4 to 1e-3 for piano strings). Damping is modelled as sigma_n = sigma0 + sigma2 w_n^2: air drag affects all partials alike, internal friction hits the high ones harder, which is why a plucked note loses its brightness first. The T60 of partial n is 6.91 / sigma_n.
The pickup. A magnetic pickup responds to the string velocity at its position x_p, a piezo to the displacement. Partial n is weighted by sin(n pi x_p) (and by w_n for velocity): a pickup near the bridge hears the high partials, one at the middle misses the even ones.
Honest simplifications. (1) One polarisation only; real strings also move sideways and exchange energy through the bridge, giving the double decay of a guitar. (2) The bridge and body are rigid and the string is not coupled to a soundboard, so there is no body resonance. (3) Damping is linear and the amplitude small, so there is no tension modulation (the pitch glide of a hard pluck). (4) The audio is the pickup signal of this model, not a recording. (5) The picture is slowed down by the factor you choose; the sound is real time.
Checks run in the page. An independent finite-difference wave solver against the modal sum; the Parseval energy of 3000 modes against the elastic energy of the triangle; the frequency measured from zero crossings; the vanishing fifth harmonic; the spectral peak of partial 10 of a stiff string, measured in the rendered waveform, against the stiff-string formula; and the e^-1 decay of a single mode.