Piano 02 — Digital waveguide: the string as two delay lines
Builds on
01 The ideal string. Next: 03 Losses.
Sampling d’Alembert’s solution
The ideal string is two waves, and , moving without change. Sample time with step and space with the distance a wave travels in one sample, . Then moving a wave by one step in space is just delaying it by one sample: each wave becomes a delay line, and the simulation is exact at the sample points — no approximation of derivatives at all. That is the digital waveguide (J. O. Smith, 1992).
right-going y_r ──▶ z^-M ──▶─┐
nut (−1) bridge (−1)
left-going y_l ◀── z^-M ◀───┘- Each line holds samples.
- At a fixed end the displacement is zero, so the reflected wave is the incoming one inverted: multiply by .
- The loop length is samples and the wave returns to where it started every samples, so the pitch is — the same as on page 01.
- The output is the force on the bridge, which in waveguide terms is proportional to the difference of the waves arriving and leaving there.
- The strike adds the hammer’s push into both lines at the position , i.e. samples from the end.
Cost: two memory reads and writes per sample, independent of how many partials the string has. That is why waveguides were the first real-time physical models.
Karplus–Strong, the 1983 shortcut
Because the system is linear, the two lines and the two inversions can be folded into one delay line of length with a filter in the loop. Karplus and Strong found (before the theory) that
sounds like a plucked string: is a short burst (the excitation), the averaging is a low-pass filter so high partials decay faster (losses), and sets the overall decay.
Tuning: the fractional delay
is rarely an integer. Rounding it detunes the note; the error grows with pitch. At 44.1 kHz, C7 (2093 Hz) needs ; using 21 gives 2100 Hz, about 6 cents sharp — clearly audible. The loop needs a fractional delay :
- First-order allpass with for (approximately samples at low frequencies). Gain exactly 1, so it adds no damping; good for strings.
- Lagrange interpolation (FIR): simple and fast, but it low-passes, which adds unintended damping in high notes.
What we have now
A tunable, exactly harmonic string with one decay knob. Next we make the losses frequency-dependent and physically meaningful. On page 04 the waveguide needs extra dispersion filters for the sharp partials of a stiff string, and on page 13 we weigh it against modal synthesis.