Introduction

In 1983 Kevin Karplus and Alex Strong published one of the most surprising recipes in all of computer music: take a short buffer filled with random noise, then repeatedly replace each sample with the average of its two neighbors, feeding the output back into the buffer. The sound that emerges is a convincing plucked guitar string — bright attack, exponentially decaying tone, harmonic richness.

The algorithm is tiny. On hardware of the era it ran in real time with fewer operations than any other physically plausible string model. Today it still appears in synthesizers, game audio engines, and digital pianos, often wrapped inside digital signal processing libraries.

What makes it remarkable is that no equation for a vibrating string was ever solved. The physics emerges from a single averaging step repeated tens of thousands of times per second. That gap between a mechanical model and a computational shortcut is one of the deepest ideas in DSP.

Try It

Adjust the string length (which sets the pitch) and the blend factor (which controls how quickly energy decays), then press Pluck. The waveform display shows the delay-line buffer evolving in real time — watch the initial noise smooth into a periodic wave.

<!-- {{c_html_intro}} -->
<div class="controls">
  <label>
    <span class="lbl">{{lbl_length}}</span>
    <input type="range" id="length" min="20" max="200" value="80" />
    <span id="length-val" class="val">80</span>
  </label>
  <label>
    <span class="lbl">{{lbl_blend}}</span>
    <input type="range" id="blend" min="90" max="99" value="96" />
    <span id="blend-val" class="val">0.96</span>
  </label>
</div>
<canvas id="wave" width="480" height="140" title="{{canvas_title}}"></canvas>
<div class="status" id="status">{{status_ready}}</div>
<div class="btns">
  <button id="pluck" type="button">{{btn_pluck}}</button>
  <button id="stop" type="button" class="ghost">{{btn_stop}}</button>
</div>
<p class="hint">{{hint_para}}</p>
/* {{c_css_layout}} */
* { box-sizing: border-box; }
body { font-family: system-ui, sans-serif; color: #222; margin: 0; background: #fff; }
.controls { display: flex; flex-direction: column; gap: .6rem; margin-bottom: .8rem; }
label { display: flex; align-items: center; gap: .5rem; font-size: .9rem; }
.lbl { min-width: 7rem; font-weight: 600; color: #1d3557; }
.val { min-width: 2.8rem; font-variant-numeric: tabular-nums; color: #444; }
input[type=range] { flex: 1; accent-color: #1d3557; cursor: pointer; }
canvas { display: block; width: 100%; border-radius: 10px; background: #eef2f6; margin-bottom: .6rem; }
.status { font-size: 1rem; font-weight: 600; min-height: 1.4em; margin-bottom: .4rem; color: #555; }
.status.playing { color: #0a7d33; }
.status.stopped { color: #1d3557; }
.btns { display: flex; gap: .5rem; margin-bottom: .8rem; }
button { font: 600 14px system-ui, sans-serif; padding: .45rem .9rem; border: 1px solid #1d3557;
         background: #1d3557; color: #fff; border-radius: 8px; cursor: pointer; }
button.ghost { background: #fff; color: #1d3557; }
.hint { font-size: .85rem; color: #555; margin: 0; line-height: 1.5; }
// Code not found

Notice how a longer buffer gives a lower pitch (more samples per cycle = lower frequency), and a blend factor closer to 1 makes the string ring longer. The math behind both observations is captured in a single averaging formula: y[n]=bx[n]+x[n1]2y[n] = b \cdot \frac{x[n] + x[n-1]}{2}, where bb is the blend factor and the buffer length NN sets the fundamental frequency f=fs/Nf = f_s / N.

How It Really Works

The algorithm looks like a trick, but it rests on two well-understood signal-processing structures.

The delay line is a comb filter. A buffer of length NN samples fed back to its own input creates resonances at multiples of fs/Nf_s / N — exactly the harmonic series of a vibrating string of that length.

The averaging step is a low-pass filter. Replacing each sample with x[n]+x[n1]2\frac{x[n] + x[n-1]}{2} is a two-tap FIR filter with frequency response H(ejω)=cos(ω/2)|H(e^{j\omega})| = |\cos(\omega/2)|. It attenuates high frequencies more than low ones, so each pass around the loop damps the upper harmonics — mimicking the way a real string loses energy faster at its higher modes.

The combination — comb filter + gentle low-pass inside the loop — is a first-order approximation to the wave equation of a plucked string. The blend factor bb controls how much energy survives each loop: a value below 1 makes the string decay; the decay time τ\tau in seconds satisfies τN/(fslnb)\tau \approx -N / (f_s \ln b).

Extended Karplus–Strong (Jaffe & Smith, 1983) adds a fractional-delay filter so the pitch can be tuned continuously rather than in steps of one sample, and a tuning allpass filter to hit exact frequencies. Modern physical modeling synthesizers build on these ideas but add far more: body resonance, bridge impedance, pick position, and sympathetic string vibrations.

Where It Matters

Karplus–Strong seeded an entire branch of music technology:

  • Physical modeling synthesis: the insight that a feedback loop can approximate a resonating body led directly to waveguide synthesis (Julius O. Smith III, Stanford CCRMA), the engine inside the Yamaha VL1 and many modern softsynths.
  • Digital pianos and guitars: instruments like the Korg Prophecy and Roland V-Guitar use waveguide models descended from Karplus–Strong to model string stiffness, hammer impact, and body resonance.
  • Game and film audio: real-time string plucks, pizzicato layers, and harp glissandi in game engines are often implemented with delay-line synthesis because it costs a handful of multiply-add operations per sample.
  • DSP education: the algorithm is so compact — a ring buffer and one multiply — that it is a standard first example in courses on digital audio, alongside the fast Fourier transform.

The deeper legacy is conceptual: Karplus–Strong showed that computational shortcuts can replace physical equations when the structure of the shortcut matches the structure of the physics. That principle drives model-based compression, neural vocoders, and learned physics simulators today.

Conclusion

Karplus–Strong synthesis earns its place among the most elegant algorithms ever discovered: fill a buffer with noise, average neighbors in a loop, and physics does the rest. No differential equation is solved; no string is simulated explicitly. The wave equation falls out as an emergent property of a two-line recurrence.

The algorithm was published in 1983, runs efficiently on any modern device, and still sounds convincingly like a plucked string. Its conceptual lesson — that the right computational structure can embody physical behavior without modeling it — remains as fertile as ever, echoed in neural networks that learn to generate speech and images by learning the structure of data rather than the equations that created it.

Share this article

Pick a channel — or use your device's native share sheet.

Comments

Loading comments...

https://www.kipuhub.com/en/article/karplus-strong/Content licensed under CC BY-NC 4.0.