# The Karplus-Strong Algorithm

The Karplus-Strong algorithm is not exactly a physical model, but it can be considered a preliminary stage to waveguides. The algorithm is based on a ringbuffer, filled with (white) noise, which is then manipulated. With very simple means, Karplus-Strong can synthesize sounds with the characteristics of plucked strings. Although not entirely realistic, the result has a intriguing individual character.

## The Ringbuffer¶

Ringbuffers are the central element of the Karplus-Strong algorithm. As the name suggests, they are FIFO (first in - first out) buffers, with beginning and end connected. A ringbuffer with N samples can be visualized as follows:

## White Tone from White Noise¶

If a ringbuffer is filled with a sequence of white noise, it can be used for creating a white tone - a harmonic sound with a strong overtone structure. Without resampling, the ring buffer can be shifted by one sample each $1/f_s$ seconds. The resulting pitch of the sound is then determined by the buffer size:

$$f_0 = \frac{f_s}{N}$$

For a sampling rate of $48000$ Hz, a ringbuffer with a length of $N=200$ samples, results in the following pitch:

$$f_0 = \frac{ 48000 }{ 200 } = 240.0\ \mathrm{Hz}$$

The sound of this harmonic signal is similar to a buzzer:

### Spectrum¶

The spectrum of the white tone includes all harmonics up to the Nyquist frequency with a random amplitude. The overtone structure is individual for every white noise sequence, as is the timbre. These are three versions, started with an individual noise sequence of $N=400$ samples.