# Karplus\-Strong Algorithm

An explainer of Karplus\-Strong plucked\-string synthesis: a noise\-filled delay loop with an averaging filter

By quiet\-finch\-72205ec7

Topic: Art, Music &amp; Film

[Open the interactive Jig](https://ask.jig.com/j/YiM6vpfgk5MF)

## Transcript

### 1. A Plucked String Made of Numbers

In 1983 Kevin Karplus and Alexander Strong published a startlingly simple way to make a computer sound like a plucked string\. There is no recording and no physics engine, just a short loop of numbers and one tiny averaging step\. The glowing ring and the steel string show the same numbers\.

Drag to turn the bench\. Tap the wooden box to pluck the string at any time\.

### 2. Pluck: Fill the Loop With Noise

The ring is a delay line of N memory cells, here 100\. A pluck fills every cell with a random value: a burst of white noise\. That noise becomes the string’s first jagged shape, and it holds a little of every frequency at once\.

Pitch does not come from the noise\. Any wideband burst works; the noise only sets the starting tone colour\.

### 3. Read, Average, Write Back

Now in slow motion\. The gold marker reads the oldest sample and sends it to the speaker\. The hub averages it with its neighbour and writes the result back into the loop as the newest sample\. That is the whole algorithm, repeated about 44,100 times a second\.

The averager needs only one addition and one halving: \(a \+ b\) ÷ 2\. That made it cheap enough for early 1980s hardware\.

### 4. Why the Sound Mellows and Fades

Averaging neighbours smooths out quick wiggles but barely touches slow ones, so it is a gentle low\-pass filter\. On every lap the high harmonics on the display lose more than the low ones\. The jagged noise turns into a smooth, nearly pure tone that dies away, much like a real string\.

Without the averager, a loop with gain 1 would repeat the same noise forever\. This scene runs about 70 times slower than real audio, with a little extra loss so each note fades within seconds\.

### 5. Loop Length Sets the Pitch

One lap of the loop is one period of the note, so a shorter loop comes round more often and sounds higher\. At 44,100 samples a second the pitch is about 44,100 ÷ \(N \+ ½\)\. The extra half sample is the averager’s own delay\.

N = 200 gives 219\.95 Hz, close to A3; N = 100 gives 438\.8 Hz; N = 50 gives 873\.3 Hz\. Because N is a whole number, pitches come in steps; fractional\-delay filters fill the gaps\.

### 6. Secretly, It Is a Real String

Julius O\. Smith showed that the loop is a digital waveguide: two waves travelling in opposite directions along a string with fixed ends\. Fold the loop in half along the string and the two waves add up to the string’s shape\. The averager stands in for all the energy a real string loses\.

Switch on the travelling waves: gold runs one way, blue the other, and the steel string is their sum, pinned at both bridges\.

### 7. A Small Loop With a Long Echo

Their paper, “Digital Synthesis of Plucked\-String and Drum Timbres”, appeared in Computer Music Journal in 1983\. Its patents were licensed to Mattel Electronics and later to Yamaha, and extended versions still shape string synthesis today\. Pluck once more and watch noise become a note\.

The first music to use it was David Jaffe’s “May All Your Children Be Acrobats” \(1981\), written before the paper appeared\.
