Subtractive synthesis starts with a waveform and removes parts of it. Physical modelling starts with a description of an object and calculates what sound that object would make. It’s the difference between drawing a bell and simulating one.
It has a reputation for being mathematically forbidding. The foundational algorithm is about twenty lines of code.
Karplus-Strong: the whole idea in one algorithm
The Karplus-Strong algorithm models a plucked string, and every other physical modelling technique is a generalisation of it.
Three components:
- A delay line of p samples. Its length determines the pitch — the wave takes p samples to travel and return, so the frequency is
sample_rate / p. - A lowpass filter in the loop, simulating energy lost each time the wave reflects off the ends of the string. High frequencies lose energy faster, which is exactly what real strings do.
- Feedback — the filtered output goes back into the delay line.
To play it, fill the delay line with noise. That’s the pluck.
import numpy as np
def karplus_strong(freq, duration, sr=44100, damping=0.996):
n = int(sr / freq) # delay length sets the pitch
buf = np.random.uniform(-1, 1, n) # the "pluck": a burst of noise
out = np.zeros(int(sr * duration))
for i in range(len(out)):
out[i] = buf[0]
# one-pole lowpass: average adjacent samples, lose a little energy
new = damping * 0.5 * (buf[0] + buf[1])
buf = np.append(buf[1:], new)
return out
That’s a recognisable plucked string. damping is how long it rings; below about 0.99 it becomes a muted pluck, at 0.999 it sustains like a piano.
The insight worth taking away: the noise burst decays into a sine wave at a rate proportional to the delay length. You didn’t design that behaviour — it falls out of the physics you modelled. That’s the appeal of the whole approach.
The excitation matters more than you expect
Beginners tune the resonator endlessly and ignore the excitation. It’s the wrong way round.
The resonator determines pitch and decay. The excitation determines what instrument it sounds like. Same delay line, different input:
- A short noise burst → plucked string
- A filtered noise burst → softer pluck, felt mallet
- Continuous filtered noise → bowed string or wind instrument
- A sharp impulse → struck, percussive
- Noise shaped by where you “pluck” → plucking near the bridge versus the middle, which changes the harmonic content
Real instruments are mostly characterised by how energy enters them. A guitar and a harpsichord are both plucked strings; the difference is the plectrum.
Where to actually practise this
Don’t start in raw code unless you want to. Better environments:
- VCV Rack — free. Modules like Rings and Elements (Mutable Instruments designs) are physical models with the parameters exposed as knobs. The fastest way to hear what each parameter does.
- Max/MSP or gen~ — Cycling ‘74 publish a physical modelling primer aimed exactly at this.
- SuperCollider — has waveguide UGens; good if you already write code.
- Csound — the deepest library of physical models anywhere, including many historical and obscure instruments.
- Faust — designed for DSP, with a physical modelling library, and compiles to plugins.
Start in VCV Rack with Rings, then move to code once you know what you’re reaching for.
Beyond the string: digital waveguides
Karplus-Strong generalises into digital waveguide synthesis, refined by Julius O. Smith III and others. Instead of one delay line you model bidirectional wave propagation — two delay lines, waves travelling in both directions, with scattering junctions where they meet.
That’s what lets you model:
- Tubes — flutes, clarinets, brass, with the reed or embouchure as a nonlinear excitation
- Membranes and plates — drums, cymbals, via 2D waveguide meshes
- Bowed strings — with a nonlinear friction model at the bow contact point
- Coupled systems — a string driving a soundboard driving a body
What physical modelling is genuinely good for
Be honest about the trade. For a violin, sampling wins — there are excellent sampled violins, and a real violinist beats both.
Modelling wins where sampling structurally can’t:
- Instruments that don’t exist. Change the tube length mid-note; make a string 40 metres long; couple a drum to a flute.
- Continuous, expressive control. A sampled instrument interpolates between recorded states. A model has no states — bow pressure, breath, embouchure are just parameters, and they respond across their whole range.
- Instruments you can’t get near. We wrote this week about Nikolator, a physical model of a musical Tesla coil — modelling the resonant circuit, the discharge, and the sound in the air. Nobody is sampling a multi-note library of a high-voltage plasma instrument.
- Tiny footprint. A model is a handful of coefficients. A sampled piano is gigabytes.
That last point is why physical modelling keeps reappearing in hardware — Expressive E, Mutable Instruments, Korg’s modelling engines. It’s the only synthesis method whose realism doesn’t cost storage.
Related Reading
- Physical Modeling Synthesis for Max Users: A Primer — Cycling ‘74
- Physical modelling synthesis — Wikipedia
- Chapter 7: Physical Modeling — Nord Modular book, McGill
- Waveguide Resonators — SFU Sonic Studio Handbook
- Sound Synthesis and Physical Modeling — Stefan Bilbao (PDF)
- VCV Rack — free modular synthesis environment