Presets
Playback
Shape and harmonics
N is the number of harmonics summed. p and w place and size the pluck or hammer.
Highlight one harmonic
Shows the single standing wave n with its nodes on the front of the string.
String and sound
Damping, tone pitch and the display amplitude.
Clock
Playback speed and the probe position used in the fourth graph.
Camera
Layers
Quality
Model checks
The science
What this bench shows
A sonometer (monochord) is a string stretched over two bridges on a resonator box. Pluck it, strike it, or ask for a square or sawtooth shape, and the bench builds that shape out of standing sine waves. The yellow string is the sum of the first N harmonics; the white ghost is the exact target shape; the bars on the back shelf are the harmonic amplitudes. The 3D scene and the 2D companion share one maths module, so every number is identical.
1. Modes of a fixed string
For a string of length L with fixed ends the standing waves are sin(nπx/L) with frequencies fn = n f1, f1 = (1/2L) √(T/μ). Any start shape f(x) with f(0) = f(L) = 0 in the odd extension is f(x) = Σ bn sin(nπx/L) with bn = (2/L) ∫0L f(x) sin(nπx/L) dx. After release y(x,t) = Σ bn sin(nπx/L) cos(nω1t) e-γnt; the damping factor is illustrative and makes the high harmonics fade first, as in a real string.
2. Coefficients used
Square 4/(nπ) for odd n; sawtooth 2/(nπ); centre-plucked triangle 8 sin(nπ/2)/(nπ)2; pluck at p: 2 sin(nπp)/(n2π2 p(1-p)), so a pluck at the middle has no even harmonics and a pluck at one third has no third harmonic; hammer pulse of width w at p: (2/nπ)[cos(nπ(p-w/2)) - cos(nπ(p+w/2))].
3. Parseval energy
The mean square of the shape equals Σ bn2/2. The share captured by N harmonics is the partial sum; the leftover RMS error is √(mean square - Σn≤N bn2/2). Smooth shapes converge like 1/n2; shapes with jumps only like 1/n.
4. Gibbs overshoot
Near a jump of height J the partial sums overshoot by J (Si(π)/π - 1/2) = 0.0895 J however many terms are added; only the width of the overshoot shrinks (like 1/N). The constant is computed from the power series of Si, independently of the harmonic sums it is compared with (Model check 3).
What to try
Choose Square wave and raise N: the ripples squeeze toward the corners but the first overshoot stays at 9 %. Choose Pluck at one third and watch bar 3 vanish. Raise Damping and see the high bars and wiggles die first. Use Play tone to hear the same coefficients as a Web Audio periodic wave.
Honest simplifications
Ideal, perfectly flexible string with rigid ends; no stiffness (real strings have slightly stretched overtones), no air or body coupling; vertical displacement is drawn exaggerated (the display-amplitude slider) and the motion is slowed so the fundamental completes about one swing per two seconds; the pluck and hammer shapes are idealised displacement shapes, not a model of finger or felt contact.