Karplus-Strong String Synthesis in Audacity Pluck
The Karplus-Strong algorithm is a digital sound synthesis technique designed to simulate the acoustics of plucked strings and struck percussion. In audio editing software like Audacity, this method powers the "Pluck" generator, transforming brief bursts of random noise into rich, resonant tones that mimic instruments such as guitars, harps, and banjos. This article explains how the Karplus-Strong algorithm operates, how it achieves its signature natural decay, and how Audacity implements it to produce synthetic plucked sounds.
The Mechanics of Karplus-Strong Synthesis
Developed in 1983 by Kevin Karplus and Alexander Strong, the Karplus-Strong algorithm is one of the earliest and most efficient examples of physical modeling synthesis. Instead of generating complex waveforms from scratch using multiple oscillators, it creates a sound by modeling the physical behavior of a vibrating string.
The process consists of three core components:
- The Excitation Signal: The algorithm begins with an initial, very short burst of audio—typically white noise—stored in a delay buffer. This noise represents the physical energy of a plectrum or finger plucking a resting string.
- The Delay Line: The noise burst loops through a feedback delay line. The length of this delay line determines the fundamental frequency (pitch) of the sound. Shorter delay lines yield higher pitches, while longer delay lines produce lower pitches.
- The Low-Pass Filter: As the signal circulates through the feedback loop, it passes through a simple low-pass filter (often a simple two-point moving average). This filter attenuates high-frequency harmonics faster than low-frequency harmonics on every cycle.
Why It Sounds Natural
In a real acoustic string instrument, higher-frequency vibrations lose energy to air resistance and internal friction much faster than lower-frequency fundamental vibrations. Because the Karplus-Strong algorithm passes the audio through a low-pass filter on each cycle of the feedback loop, the sound begins with a sharp, bright attack containing full-spectrum noise and gradually settles into a warm, sinusoidal decay. This mimics the natural dampening of physical strings without requiring intensive mathematical computation.
Implementation in Audacity's Pluck Generator
Audacity incorporates the Karplus-Strong algorithm into its built-in "Pluck" tone generator, accessible under the Generate menu. When a user creates a plucked sound in Audacity, the algorithm executes the following sequence:
- Pitch Calculation: The user specifies a MIDI note number or frequency. Audacity calculates the buffer length required to cycle the waveform at that exact rate based on the project's sample rate.
- Noise Injection: The buffer is populated with randomized values (white noise).
- Averaging Feedback: The audio samples are read from the buffer, processed through the averaging filter, and fed back into the buffer while simultaneously being written to the audio track.
- Decay and Duration: Audacity allows users to set an overall duration and a fade/decay parameter, adjusting how rapidly the feedback loop loses energy, which dictates whether the instrument sounds like a muted banjo or a sustained acoustic guitar.
Because of its reliance on simple addition, division, and memory buffering, the Karplus-Strong algorithm produces realistic string timbres using virtually negligible CPU resources.