Blog / Sound Design

"The Accidental Algorithm: How Karplus-Strong Turns Noise Into Plucked Strings"

Photo by Elizabeth Love on Unsplash

In 1983, Alex Strong was experimenting with 8-bit wavetable synthesis at Stanford and made an odd observation: if you average adjacent samples as you read through a wavetable, the output starts to sound like a plucked string, regardless of what the original waveform contained. He mentioned this to his colleague Kevin Karplus, who worked out the math. The result, published in Computer Music Journal that summer, became one of the most elegant algorithms in audio DSP history.

The core insight: feed random noise into a feedback delay line, apply a simple low-pass filter on each loop pass, and the system naturally organizes itself into harmonic, pitched output. No oscillator, no waveform, no FM. Just noise, a delay, and one averaging operation.

What the Algorithm Actually Does

The Karplus-Strong algorithm runs like this:

  1. Fill a delay line of length N with random white noise
  2. Output the oldest sample
  3. Average the output with the previous output: y[n] = (y[n-N] + y[n-(N+1)]) / 2
  4. Write the result back into the delay line
  5. Repeat

In transfer function terms, the loop filter is H(z) = (1 + z⁻¹) / 2. The complete system transfer function is H(z) = 1 / (1 - (1/2)(1 + z⁻¹)z⁻ᴺ). Each pass through the loop attenuates high frequencies more than low frequencies, because the averaging operation is itself a first-order low-pass filter. After a few hundred iterations, the noise has shaped itself into a decaying harmonic spectrum that sounds like a guitar string.

Pitch is determined entirely by delay line length: f = sample_rate / N. At 44,100 Hz sample rate, a delay of 100 samples gives 441 Hz. A delay of 44 samples gives 1,002 Hz. This creates a hard constraint: pitch is quantized to integer sample counts, which means tuning accuracy degrades as frequency rises and delay line length shrinks.

Why This Works

The algorithm was not designed from acoustic theory. But when Julius O. Smith III at Stanford's CCRMA analyzed it in the mid-1980s, he found it was mathematically equivalent to a traveling wave model of a vibrating string.

In a real string, energy propagates in both directions from the pluck point and reflects at the bridge and nut. The round-trip time of that traveling wave determines the fundamental frequency. A delay line models this propagation time directly. The loop filter approximates the energy losses that occur with each reflection: high frequencies radiate more energy and attenuate faster, which is exactly what the averaging operation produces.

This is the surprising part: Karplus and Strong did not model string physics. They stumbled onto an algorithm that turned out to be an exact special case of digital waveguide synthesis. The theory caught up to the accident.

The Extended Algorithm

The original version has two significant problems. First, tuning is imprecise because delay length must be an integer. Second, the averaging filter's frequency response is fixed, giving no control over brightness or decay rate.

In their 1983 Computer Music Journal paper "Extensions of the Karplus-Strong Plucked-String Algorithm," David Jaffe and Julius O. Smith introduced two improvements.

For tuning, they added a first-order allpass filter in the feedback loop. Allpass filters shift phase without affecting amplitude, which changes the effective delay by a fractional sample amount. This allows continuous pitch control across the full frequency range.

For the loop filter, they replaced the averaging operation with a more flexible first-order low-pass filter: y[n] = (1 - R)x[n] + R * y[n-1]. The coefficient R (typically between 0.3 and 0.99) controls the loop filter's cutoff frequency. At R close to zero, the filter passes audio through with minimal smoothing: bright tone, fast decay. At R close to 1.0, the filter heavily averages past and present values, producing a darker, slower-decaying tone. The loop also includes a separate gain coefficient g, which must remain strictly below 1.0. When g reaches or exceeds 1.0, the feedback loop no longer dissipates energy and the signal diverges. The practical range for musical sustain without instability is g between 0.95 and 0.99.

From Algorithm to Waveguide Synthesis

Smith's recognition that K-S was a degenerate waveguide model opened the door to a broader framework. Digital waveguide synthesis uses bidirectional delay lines, one for each direction of wave propagation, with scattering junctions where waves interact. This allows modeling not just plucked strings but bowed strings, wind instruments, and resonant tubes.

Stanford licensed waveguide synthesis to Yamaha, which used it in the VL1 synthesizer in 1993, the first commercial instrument based on the technique. The VL1 modeled woodwind and brass instruments by simulating the complete acoustic system: breath pressure, reed or mouthpiece dynamics, bore resonance, and bell radiation.

That level of complexity is far beyond Karplus-Strong, but both algorithms share the same underlying insight: a delay line with feedback can model acoustic propagation, and a loop filter can model energy loss.

Modern Implementations

Most physical modeling plugins in use today build on these foundations without advertising it.

Ableton's Tension (developed with Applied Acoustics Systems) implements a full string physical model. It separates the excitation section (plectrum, bow, or hammer) from the string resonator and adds a body model for instrument character. Tension can simulate guitar, harpsichord, violin, and piano-like timbres using the same underlying waveguide approach.

Mutable Instruments' Rings, in its "Plucked String" algorithm, uses a combination of comb filters and non-linear processing to emulate string resonance in Eurorack format. Unlike a pure K-S implementation, Rings processes external input as excitation, which lets any sound source drive the resonator.

Applied Acoustics Systems' Chromaphone 3 models percussive resonators including strings, bars, marimbas, and plates. Each resonator type uses a different physical model, but all share the same conceptual structure: a time-domain model of wave propagation with frequency-dependent energy loss.

What This Means Practically

If you use any of these plugins, understanding the underlying algorithm changes how you interact with them.

The "decay" parameter in physical modeling plugins is usually the loop gain coefficient R. Decay and brightness are not independent: raising R extends sustain while also keeping high frequencies alive longer, which is how real strings behave. Trying to get a long-sustaining, dark tone requires external filtering because the physics don't support it.

The excitation signal matters more than most users realize. Karplus-Strong is initialized with noise, but the spectral content of that noise affects the initial timbre. In Tension and similar plugins, velocity and position parameters change the excitation's spectral profile, not just its amplitude. A pluck near the bridge produces a brighter excitation with stronger upper harmonics; a pluck at the midpoint produces more fundamental content. The physical model then decays from that starting point.

The algorithm discovered by accident in 1983 remains the conceptual core of physical modeling synthesis. Its elegance is in what it omits: no oscillator, no envelope, no wavetable lookup. Just a feedback loop with memory, and the mathematics of wave propagation doing the rest.


Sources: Karplus & Strong, "Digital Synthesis of Plucked-String and Drum Timbres," Computer Music Journal 7(2), 1983. Jaffe & Smith, "Extensions of the Karplus-Strong Plucked-String Algorithm," Computer Music Journal 7(2), 1983. Julius O. Smith III, Physical Audio Signal Processing, CCRMA Stanford. Ableton Tension documentation. Mutable Instruments Rings manual.