← Back

The Vibrating String

A plucked string is a wave bouncing back and forth between two fixed endpoints. This simple physical model reproduces pitch, timbre, and decay from just three parameters.

Pluck the string

Choose a string type and pluck. The left canvas shows the ring buffer — the circular snapshot of the string's current shape at each moment. The right canvas shows the resulting sound wave.

Delay line (string shape)
Output waveform

Parameters

Every aspect of the string's sound is determined by these three quantities. Adjust them and pluck again to hear the difference.

196 Hz
0.996
50 %
30 %
Pitch comes from length. The number of samples in the ring buffer determines the fundamental frequency — longer buffer = lower pitch. At 44,100 samples/sec, a 196 Hz note needs a buffer of 44,100 ÷ 196 ≈ 225 samples. This is exactly how a longer string on a guitar or bass produces a lower note.

How the model works

The Karplus-Strong algorithm is the canonical model of a plucked string. It captures the physics in three operations that run in a loop:

1. Excitation. The ring buffer is filled with noise. This models the initial disturbance of plucking — a chaotic mix of all frequencies. Where you pluck on the string (near the bridge vs middle) shapes the noise spectrum: a bridge pluck is brighter, a middle pluck is rounder.
2. Wave propagation. Each tick, the wave travels one step around the ring. When it reaches an end it reflects — just as a wave on a real string bounces off the fixed endpoints. The periodic round trips create the repeating pattern that gives pitch.
3. Energy loss. At each step, the two neighboring samples are averaged together (a simple low-pass filter). This removes a small amount of high-frequency energy, modelling the friction and air resistance a real string experiences. High damping → short decay. The filter also naturally removes the brightest harmonics first, producing the characteristic darkening of a plucked string as it sustains.