Filters, Delay and Reverb
How do delay and addition make every filter, echo and reverberation in a studio?
In 1947 Bill Putnam sold his studio bathroom's echo as art; in 1962 Schroeder built a room out of four combs and two all-passes, and an ear question sets it beside a simulated tiled room. The part builds convolution sample by sample and hears an echo; feedback places poles (a one-pole low-pass, the z-plane, a band-pass at Q 50 ringing a quarter of a second); the cookbook biquads draw five equalizers, matched by ear in an ear question, and a Butterworth built by the bilinear transform matches SciPy to rounding. Sixty all-passes leave every level unchanged and turn a snare into a chirp (an ear question). Combs make notches, peaks and a 220 Hz pitch from noise; a flanger, a chorus and a phaser move them. A tiled room by Allen and Berkley's image sources rings 1.22 s by Schroeder's backward integration, within 2 per cent of Eyring's 1.24; Farina's sweep recovers its response (error 19 dB down) and parts a distorting loudspeaker's harmonics. Schroeder's reverberator stays sparse (echo density 0.2) where an eight-line feedback delay network fills in; octave bands separate stone from steel; a steel plate by finite differences (246 by 123 points) starts bright and rings 2.6 s in the bass, 1.0 s at 4 kHz; a spring is a loop of 80 all-passes.
What you need. Part 3 for spectra; Part 7 for Karplus-Strong; Part 30 for sound as numbers; Part 45 for the auditory scene; Part 48 for sampling. Convolution, the z-transform, linear algebra (orthogonal matrices), finite differences.
- Ideas, mathematics and history
- impulse responses, poles and zeros, equalizers, combs, flangers and phasers, Schroeder's reverberator, feedback delay networks, plates and springs
- What we build, compute and hear
- a pole-zero instrument; the Tune in a bathroom, a plate and a cathedral
What you will be able to do
Foundations
- Match a groove to a low-pass, a high-pass and a peak by ear, and hear a ringing pole.
- Hear an all-pass smear a snare, combs make a pitch, and a flanger, chorus and phaser move.
- Tell Schroeder's reverberator from a simulated room, and hear a plate, a spring and a cathedral.
Full course
- Convolve by hand and by FFT; design biquads from the cookbook and read them from poles and zeros.
- Simulate a room by image sources and measure RT60 by Schroeder integration against Sabine and Eyring.
- Measure an impulse response with an exponential sweep; build a feedback delay network and a plate.
Research
- Find the smallest feedback delay network that passes, blind, for a measured room.
Practice
- Equalize, delay and reverberate in a mix; measure a room by sweep and predict it by Sabine.
Contents
Each chapter has a home level. Choose a track to see what to read and watch: Foundations 18 min · Full course 34 min · Research 36 min · Practice 34 min.
- 0A room made of arithmeticFoundations2 min
- 1Impulse responses and convolutionFoundations3 min
- 2Poles and zerosFoundations3 min
- 3EqualizersFoundations3 min
- 4PhaseFoundations2 min
- 5Combs, flangers, choruses and phasersFoundations3 min
- 6The room's responsePractice4 min
- 7Measuring a roomPractice2 min
- 8Schroeder's reverberatorPractice3 min
- 9Feedback delay networksPractice3 min
- 10Plates and springsPractice3 min
- 11Frontier: virtual analog and differentiable effectsResearch2 min
- Variation 49, recap and problemsAll tracks2 min
Also on this page: Lecture · Key results · Try it · Lab · Problems · Notes and sources · Build the film.
Lecture
The text of each chapter is the film's narration, as it is spoken, so you can read along or revise without the film. The pictures are in the film. A dashed box stands for a number the film computes when it is rendered (hover over it to see what is computed); the README's figures for each chapter, where it lists them, follow the chapter's text.
A room made of arithmeticFoundations2 min
In 1947 Bill Putnam put a loudspeaker and a microphone in his studio's tiled bathroom. Your ears first. The Tune's first phrase, twice, with reverberation. One is a simulated tiled room: sound bouncing between six walls. The other is pure arithmetic: four delays fed back into themselves, and two more. Both ring for the same time. Which is the arithmetic?
The first was the arithmetic: Manfred Schroeder's reverberator of 1962. It rings for seconds, like the room, but listen to its tail: a faint metallic flutter, a pattern repeating. The simulated room's tail is a smooth wash. Both are nothing but delay and addition, and this part builds them, and the filters and effects of every studio, from those two operations.
The story starts in a bathroom. In 1947 Bill Putnam put a loudspeaker and a microphone in the tiled bathroom of his Chicago studio. The Harmonicats' Peg o' My Heart, recorded with it, became a hit, and the echo was the sound. Studios built echo chambers, then steel plates, from EMT in 1957, and springs in boxes. In 1962 Manfred Schroeder at Bell Labs built a room out of arithmetic. The linear and modulated effects here can be built from delays, weighted sums and feedback; a full effects rack also contains nonlinear processing.
Here is the plan. Impulse responses and convolution. Poles, zeros, and the equalizer. Phase, combs, flangers, choruses and phasers. A room simulated, and measured by a sweep. Schroeder's reverberator and feedback delay networks. And plates and springs.
1Impulse responses and convolutionFoundations3 min
How can one click describe a whole effect?
One idea runs through this part. Take a system that is linear and time-invariant: twice the input gives twice the output, and a later input gives the same output later. Feed it a single click, an impulse. What comes out is its impulse response. Any input is just a row of clicks of different sizes, one per sample, so the output is a row of impulse responses, each scaled and delayed, added up. That is convolution. Filters, echoes, rooms and plates are all linear and time-invariant, near enough.
Watch it with four samples. The input: one, a half, minus point three, point eight. The impulse response: one, nothing, point six, point three, a sound and two faint echoes. The first input sample launches a copy of the response at full size; the second, a half-size copy one step later; the third, a small upside-down copy; the fourth, a copy at point eight. Add the columns: that is the output. Seven numbers, and every one is a sum of products.
The simplest effect of all is a two-tap response: the sound itself, and a copy a hundred and eighty milliseconds later at six-tenths of the level. Convolve the Tune with it: first dry, then with its echo, the slapback of a 1950s record.
Convolution is simple but costly. A room's response at forty-eight kilohertz lasts a couple of seconds: ninety-six thousand taps, so ninety-six thousand multiplications for every output sample. The Fourier transform of Part 3 turns convolution into multiplication, frequency by frequency, and with the fast Fourier transform the cost per sample grows only with the logarithm of the length. Convolution reverbs split the response into blocks, so the first sound comes out without waiting for the whole. Every reverb in this part's Variation is applied this way: the room, the plate and the spring are simply their impulse responses.
Filters come in two families. An FIR filter, finite impulse response, is a finite list of taps: its impulse response ends. An IIR filter feeds its own output back, so its response, in principle, never ends. FIR filters are always stable and can have exactly linear phase, but need many taps for a sharp edge. IIR filters make sharp edges and long decays from a handful of numbers, but they can ring, and they can go unstable. Chapter two builds the IIR kind from a single number.
2Poles and zerosFoundations3 min
How does feeding the output back make a filter?
Now feed the output back. The simplest filter: each output is a tenth of the input plus nine-tenths of the previous output. Its impulse response never quite ends: each sample is nine-tenths of the last, a decaying exponential. Its frequency response falls with frequency, down three decibels near hertz: a low-pass filter. Slow changes pass; fast ones are averaged away.
There is a map that explains every such filter: the z-plane. Each frequency is a point on the unit circle, zero hertz on the right and the Nyquist frequency on the left. The filter's gain at that frequency is a gain factor times the product of distances to the zeros divided by the product of distances to the poles. So a pole close to the circle makes a peak where the circle passes it, and a zero close to the circle makes a dip. These are the poles and zeros of a peaking equalizer at one kilohertz. Designing a filter is choosing where to put a few poles and zeros.
Hear what a pole near the circle does. Four clicks through a band-pass filter at four hundred and forty hertz: first a wide one, its poles at radius ; then a narrow one, its poles at , almost on the circle.
The wide filter turns each click into a short tick. The narrow one rings at four hundred and forty hertz for a quarter of a second: each step, the ringing keeps of itself. A resonance is a pole close to the circle.
The workhorse is the biquad: two poles and two zeros. Each output is a weighted sum of the last three inputs and the last two outputs: five numbers. Those five numbers make a low-pass, a high-pass, a band-pass, a notch, a peak or a shelf. Robert Bristow-Johnson's cookbook gives the five numbers for each, from a frequency, a width and a gain. Higher-order filters are biquads in series. Chapter three puts them to work.
One rule governs feedback. For a causal rational filter with uncancelled poles, BIBO stability requires every pole strictly inside the unit circle. A pole at radius r makes the impulse response decay like r to the n: inside the circle, it dies away. On the circle it rings forever; outside, it grows until the numbers overflow. A feedback loop is a filter whose poles you place, and if you place one outside, it screams. The same rule will make reverberation decay at exactly the rate we choose.
3EqualizersFoundations3 min
How do engineers shape a sound's colour?
Here are five biquads from the cookbook, drawn as gain against frequency. A low-pass at one kilohertz lets the lows through and rolls off the highs at twelve decibels an octave. A high-pass does the opposite. A peak lifts a band around one kilohertz by nine decibels. A low shelf raises everything below two hundred hertz, and a high shelf everything above five kilohertz. A studio equalizer is a few of these in series, with knobs for the frequency, the width and the gain.
Train your ears on them. A groove, dry. Then three times, each through one filter: a low-pass at eight hundred hertz, a high-pass at two kilohertz, and a twelve-decibel boost at one kilohertz, in some order. Which was which?
The first was the high-pass: no kick, no bass, only cymbals and the top of the piano, small and thin. The second was the boost: everything is there, but honky, as if through a cardboard tube. The third was the low-pass: warm and muffled, the cymbals gone dull.
Most of these designs began as analogue circuits. Capacitors, inductors and resistors, described by a transfer function in s. Stephen Butterworth found in 1930 the filter with the flattest possible pass band. The bilinear transform maps an analogue filter to a digital one by substituting for s. It squeezes the whole infinite analogue frequency axis onto the circle, so the cutoff has to be prewarped to land in the right place. Our own second-order Butterworth at one kilohertz, built this way, matches SciPy's to within rounding.
The studio equalizer has a short history. Early ones had a few fixed frequencies and boosts, chosen by switches. In 1972 George Massenburg described the parametric equalizer, in which every band's frequency, width and gain can be set continuously. The width is set by Q, the centre frequency divided by the bandwidth. A graphic equalizer instead fixes many narrow bands and gives each a slider. Digital equalizers can use biquads, while parallel, FIR and analog architectures also exist.
Engineers have rules of thumb. Cut before you boost: removing a muddy band often helps more than lifting the rest. High-pass unwanted low-frequency content where useful; select the cutoff by source and arrangement rather than applying one hundred hertz to everything. A narrow cut can remove a resonance; a broad, gentle shelf changes a whole mix's colour. And equalizing two instruments in complementary ways separates them, the masking of Part 41. Part 56 does this to a real mix.
4PhaseFoundations2 min
Does it matter when each frequency arrives?
A filter does two things to each frequency. It changes its level, and also its timing: the phase response. The group delay says how late each frequency's energy arrives; it is minus the derivative of unwrapped phase with respect to angular frequency. An all-pass filter changes no level at all, only the timing. For a steady tone a phase shift is almost inaudible, as Part 4 found. For a sharp attack, where every frequency must arrive together, it can be heard.
Hear it. A snare struck twice dry, and twice through a filter that changes no frequency's level, in some order. Which was filtered?
The second. Sixty first-order all-passes in a row delay the low frequencies more than the high ones: the snare's crack is smeared into a downward chirp, a zap. The waveforms show it: the dry hit is compact; the filtered one starts with its highest frequencies and ends with its lowest. And yet its spectrum's levels are the same as the dry hit's everywhere, to within a millionth of a decibel.
Here is the delay the sixty all-passes give each frequency. The lowest frequencies are held back about milliseconds; the highest pass in . Spread a click's frequencies over twenty milliseconds like that, and the ear hears the order they arrive in: high first, then low, a falling chirp.
Can a filter avoid smearing? A symmetric FIR filter delays every frequency equally: linear phase, so group delay is constant in its passband, though filtering can still ring. But its delay is half its order, or length minus one divided by two, in samples, and its ringing comes before the attack as well as after: pre-echo. A minimum-phase filter puts all its energy as early as it can: no pre-echo, but some phase distortion. Many familiar equalizer sections have minimum-phase behavior, but analog and digital all-pass filters provide counterexamples to any universal claim. Mastering engineers choose between the two by ear, case by case.
5Combs, flangers, choruses and phasersFoundations3 min
What does a single delay do to a sound?
Add a sound to a copy of itself delayed by forty-eight samples, one millisecond. Where a frequency's copy arrives half a cycle late, the two cancel: a notch, at five hundred hertz, fifteen hundred, twenty-five hundred, a row of them like the teeth of a comb. Feed the output back instead, and the frequencies whose cycles fit the delay a whole number of times build up: peaks every kilohertz, as tall as the feedback is strong.
A feedback comb is a pitch. Put twenty milliseconds of noise into one with a delay of samples and a gain of 0.985: every peak is a harmonic of forty-eight thousand over , about hertz. Listen: first the burst alone, then through the comb.
That is a plucked string, nearly: Part 7's Karplus-Strong algorithm is this comb with a gentle low-pass in the loop. A delay fed back is a string.
Now let the delay move. A sustained chord, a pad, through three classic effects. A flanger: a very short delay, swept, with feedback, so the comb's teeth slide up and down. A chorus: three copies, each delayed a little longer and wandering, like several players not quite together. A phaser: all-passes whose frequency is swept, so that, summed with the dry sound, they cut a few notches that move.
These effects have a mechanical past. Flanging began with two tape machines playing the same recording, one slowed by a thumb pressed on the flange of its reel. Les Paul experimented with it in the 1940s and 50s, and it was everywhere in late-1960s rock. The chorus arrived in pedals and string machines in the 1970s, and the phaser too, built from the all-pass stages of analogue circuits. All three are one or a few delays, changing slowly. Chapter six asks what thousands of delays do, in a room.
Comb filtering also happens by accident. Wherever a sound meets its own reflection, the two add like a feedforward comb. A microphone half a metre from a wall hears the wall's echo about three milliseconds late, with notches every three hundred and forty hertz. Two microphones on one source at different distances do the same when they are mixed. That is why engineers check a mix in mono, and why a singer moving near a desk can sound phasey. Placement and absorption can reduce reflections; delaying a separate microphone signal can align direct arrivals but cannot remove every reflection-induced comb.
6The room's responsePractice4 min
What happens to a sound in a room?
How does a room respond to a click? Jont Allen and David Berkley gave a beautiful answer in 1979 for a rectangular room. A wall is a mirror: sound reflected from it seems to come from an image of the source behind the wall. Reflect the room in every wall, and those rooms in theirs, and you get a lattice of images. Each image's sound arrives at the microphone straight, after its distance divided by the speed of sound, weakened by distance and by every wall it passed through. The impulse response is the sum of all of them: thousands, then millions.
Here is the first quarter second of our tiled room's impulse response: a room two point six by two point one by two point five metres, every wall absorbing five per cent of the sound that strikes it. The direct sound arrives after milliseconds. Then the early reflections, from the nearest walls, each one separate. Soon they arrive so thick that they blur into a tail, dense as noise, dying away.
How do we hear all this? We receive the direct sound and dozens of reflections, yet we hear one source in one place. The precedence effect, described by Hans Wallach and colleagues in 1949 and by Helmut Haas in 1951: the first arrival fixes where a sound is. Reflections arriving within a few tens of milliseconds fuse with it, adding loudness and colour, not a second place. Later ones are heard as the room: its size from the early gaps, its material from the tail. It is Part 45's auditory scene, applied to walls.
Convolve the dry Tune with that response, and you are in the room. Dry, then in the tiled room.
How long does the room ring? Schroeder showed in 1965 how to read it cleanly from the impulse response: add up the energy still to come, from each moment to the end. In decibels, it falls along a nearly straight line. The time it takes to fall sixty decibels is the reverberation time, RT sixty: here seconds, measured on the stretch from minus five to minus twenty-five decibels and extended.
There is a classical prediction to check it against. Wallace Sabine, timing organ pipes in Harvard's lecture halls in 1900, found that the reverberation time is point one six one times the volume, over the total absorbing area. For our room that predicts seconds. Carl Eyring's 1930 correction, better when walls absorb more, predicts . The simulated room measured : within a few per cent. Both formulas assume sound arrives from every direction equally, and real rooms with awkward shapes or uneven absorption stray from them.
One more feature of small rooms. At low frequencies a room is a set of resonances, its modes, spaced far apart. Schroeder's frequency marks where the modes overlap into a smooth response: two thousand times the square root of the reverberation time over the volume. For our tiled room that is about hertz. Below it, some bass notes boom and others vanish, depending where you stand. A cathedral's Schroeder frequency is a few tens of hertz; a bathroom's is in the middle of a singer's range, which is why people like singing there.
7Measuring a roomPractice2 min
How do you record a room's impulse response?
To use a real room you must measure its impulse response. The obvious way is to fire a starting pistol or pop a balloon and record. But a click carries little energy, so the room's own noise swamps the quiet tail. In 2000 Angelo Farina proposed playing a slow sine sweep instead, rising exponentially from twenty hertz to twenty kilohertz. Record the room's answer, convolve it with the sweep run backwards and tilted, and out comes the impulse response. The sweep spreads its energy over seconds, so there is far more signal above the noise.
Here is the sweep. Its frequency doubles at a steady rate, so every octave gets the same time.
Play the sweep into our simulated room, record the result with a little noise added, and deconvolve. On top, the room's true response, which only a simulation can know. Below, the one recovered from the sweep. Within the sweep's band they agree, the difference decibels below the response itself.
The sweep has a second gift. Make the loudspeaker distort a little, as real ones do. The distortion's harmonics are copies of the sweep at two, three, four times its frequency, so the backwards sweep catches them early: the second harmonic's response arrives the time an octave takes before the main one, the third the time of an octave and a fifth, and so on. They separate cleanly from the linear response, which can be cut out alone. A balloon could never do that.
Why an exponential sweep, rather than noise or a linear sweep? It gives each octave the same time, so the low frequencies get enough energy. Its spectrum falls three decibels an octave, like pink noise, and the inverse filter tilts it back. And only an exponential sweep puts every harmonic's response at a fixed time before the main one. A linear sweep, or noise, smears the distortion through the whole response. The sweep is now the standard way to measure rooms, loudspeakers and headphones.
8Schroeder's reverberatorPractice3 min
Can a room be made of arithmetic?
In 1962 Manfred Schroeder at Bell Labs could not simulate a room: image sources were far beyond the computers of the day. Instead he imitated what a listener hears: dense echoes, decaying smoothly, with no colour of their own. A feedback comb gives a train of echoes that decays at a rate we can set, by chapter two's rule about poles. Four combs with unrelated delays, between thirty and forty-five milliseconds, run in parallel, so their echoes interleave. Then two all-passes in series multiply the echoes, without colouring the sound.
Here it is, the whole reverberator. The input feeds four combs, of 29.7, 37.1, 41.1 and 43.7 milliseconds. Their outputs are summed, and pass through two all-passes of five and 1.7 milliseconds. Each comb's feedback gain is set so that its echoes fall sixty decibels in the chosen time, here seconds: we measure .
How good is the imitation? Jonathan Abel and Patty Huang measure echo density: the share of the response that looks like noise, scaled so that true noise scores one. The simulated room reaches one within a few tens of milliseconds. Schroeder's reverberator never gets there: it stays near , a sparse train of echoes whose pattern the ear can catch. That is the flutter you heard in the hook. The feedback delay network of chapter nine builds up more slowly, but keeps climbing.
Sharp sounds expose a reverb. Four snare hits, through Schroeder's design, then through a feedback delay network.
Schroeder's tail rings with a metallic flutter; the network's is smoother. Schroeder knew his design's limits, and James Moorer improved it in 1979 with low-pass filters in the combs and early reflections in front. Chapter nine is the design that replaced it.
Schroeder's design was improved by James Moorer in 1979, in a paper called About this reverberation business. He put a low-pass filter inside each comb's loop, so that the highs die sooner, as air and walls make them. He used six combs instead of four, for a denser tail. And he put early reflections, taken from a real room's geometry, in front of the tail. The same three ideas run through every reverb since.
9Feedback delay networksPractice3 min
How do modern reverbs make a smooth, dense tail?
The design that replaced Schroeder's is the feedback delay network. Jean-Marc Jot and Antoine Chaigne in 1991 took several delay lines and fed each one's output back into all of them, mixed. Every echo from every line returns into every line, so the echoes multiply at each pass. An orthogonal mixing matrix preserves energy and is convenient here; other stable networks can use different mixing structures. Then a gain on each line sets the decay exactly, and a low-pass in each loop makes the highs die sooner, as in a hall. Schroeder's combs are the special case in which nothing is mixed.
Ours has eight delay lines, from about twenty-nine to seventy-three milliseconds, chosen to reduce shared short periods; finite integer delay lengths still have common multiples, so coincidences are not impossible. The mixing matrix is a Hadamard matrix: every entry plus or minus one, scaled by one over root eight. Each line's output is spread into every line, with signs that keep the total energy exactly the same.
Compare the first hundred and fifty milliseconds of each. Schroeder's: distinct echoes, in a regular train. The network's: the echoes start later, from the first line's delay, and then multiply into a thicker, more even texture. Its broadband reverberation time measures seconds, a little under the two set, because the low-pass in each loop shortens the highs.
A single reverberation time hides a lot. Split each response into octave bands and measure each. The tiled room rings longest in the bass, seconds at a hundred and twenty-five hertz against at four kilohertz. The plate is long and bright in the lows, seconds, falling to at four kilohertz. The network is nearly flat, from to : its one-pole damping is gentle. The shape of these bars is much of what makes a reverb sound like stone, steel or wood.
Make every delay three times longer, from about ninety to two hundred and twenty milliseconds, and set the decay to five seconds: a cathedral, out of eight delay lines. It measures seconds across all frequencies. Three snare hits, then a chord.
Most algorithmic reverbs today are feedback delay networks, or relatives of them. They add modulation: the delays wander a little, so that no resonance settles. They put early reflections in front, from a few image sources or a short multi-tap delay. A pre-delay sets the room's apparent size; the decay time and its brightness set its material. And convolution with a measured response does the same for one real room.
10Plates and springsPractice3 min
How did steel sheets and coils become reverbs?
Before computers, studios used metal. EMT's model 140, from 1957, was a steel sheet about two metres by one, hung by its corners in a frame. A driver shook it at one point and contact microphones picked it up at others. A felt damping pad, moved closer or further, set the decay from about one second to five. Bending waves in a plate are dispersive: high frequencies travel faster than low ones. The result is dense and bright, with no early reflections: the sound of countless pop vocals.
We can build one. A thin plate obeys Kirchhoff's equation: its acceleration is minus kappa squared times the fourth spatial derivative of its displacement, with two loss terms, one for all frequencies and one that damps the highs faster, following Stefan Bilbao's scheme. For steel half a millimetre thick, kappa is . Cover the plate with a grid of by points, millimetres apart, and step it forty-eight thousand times a second. The scheme is stable only if kappa times the time step over the grid spacing squared is at most a quarter; ours is . Strike it once at one point and record the motion at another: the plate's impulse response.
Here is the start of the plate's response. It begins with a bright zing. The spectrogram shows why: the highest frequencies arrive first and the lower ones after them, because in a plate fast vibrations travel faster. After a few reflections from the edges the waves overlap into a dense, bright wash, decaying with a reverberation time of seconds.
Hear the Tune's first phrase on the simulated plate. Springs were cheaper still. Invented for Hammond organs, they went into guitar amplifiers from the 1960s. A coil is extremely dispersive: each echo comes back smeared into a chirp, the drip of surf guitar. Our spring is a stand-in for the coil's physics: a loop of eighty all-passes and a thirty-five millisecond delay. Hear a snare hit and a bass note on it.
In practice, plates were heavy, sensitive to footsteps, and cost as much as a car. They lived in basements and stairwells, wired to the control room. Their sound, dense from the first instant and bright, suited vocals and snares. Springs were cheap enough for every guitar amplifier, and their drip became a style of its own. Both are now mostly software, simulated from the physics of this chapter's kind.
11Frontier: virtual analog and differentiable effectsResearch2 min
Can software become the circuit, and learn its own settings?
The first frontier is to make software become the circuit. Virtual analogue simulates a circuit component by component, nonlinearities included. Alfred Fettweis's wave digital filters and state-space models turn circuits into stable recursions. Vesa Välimäki and colleagues reviewed fifty years of artificial reverberation in 2012, from chambers to networks, and plates and springs are now simulated from their physics, as chapter ten did. The hard part is the nonlinear parts of circuits, which Part 50 begins.
The second frontier is effects that learn. Write a filter or a reverb so that the gradient of its output can be computed, and its settings can be learned by gradient descent, like a neural network's weights. Jesse Engel and colleagues' DDSP, in 2020, made oscillators, filters and reverbs differentiable. Given a dry recording and a processed one, find the equalizer and reverb that turn one into the other, or fit a feedback delay network's gains and filters to a measured room.
A third frontier is simulating rooms from the wave equation itself. Image sources ignore diffraction and scattering; ray tracing adds scattering, but not wave effects. Wave-based methods solve the wave equation on a grid, as chapter ten did for the plate. Full-band wave simulation of a concert hall can require billions of grid points and remains expensive; GPU acceleration helps, with practical limits set by bandwidth, geometry and accuracy. Stefan Bilbao and colleagues simulate rooms, instruments and loudspeakers this way. Part 55 measures and simulates real halls.
A research problem to end on. Measure many rooms by sweep, as in chapter seven. Fit to each the smallest feedback delay network that matches its decay in every band and its echo density. Then test, blind, whether listeners can tell the network from the room. The question: how small can a network be and still pass for a given room? An answer would say how much of a room the ear actually needs.
Variation 49, recap and problemsAll tracks2 min
Every part ends by doing something to the Tune with what it built. Here, its first phrase in five spaces: dry; in the simulated tiled room; on the finite-difference plate; on the spring; and in a cathedral made of a feedback delay network with long delays.
Row forty-nine of the ledger: the reverberation times. seconds in the room, on the plate, on the spring, and in the cathedral.
What did we find? A linear effect is its impulse response, and applying it is convolution. Feedback places poles, and poles and zeros shape the frequency response. An all-pass changes only timing, and timing can be heard in attacks. One delay makes a comb, a pitch, a flanger; several make a chorus. A room is a sum of images, and Sabine and Eyring predict its decay. And Schroeder's combs, delay networks, plates and springs imitate rooms.
Five problems. One to compute, one to prove, one for your ears, one to build, and a research problem, marked with a star. Solutions are in this part's notes. Pause here.
Where does this come back? In dynamics and distortion, effects that are not linear. In synthesis, with filters that sweep and resonate. In physical models, where delay lines become strings and tubes. In rooms and space, with real halls. And in recording and mixing, where equalizers and reverbs go to work.
And in practice. Mix engineers send many tracks to one reverb, so they share a space. Producers pre-delay a vocal's reverb, so the words stay clear. Acousticians measure halls by sweep, and predict them with Sabine first. And plug-in makers model plates, springs and circuits from their physics.
The books and papers this part follows. The full list, with notes, is in the README.
Where it goes next. Nonlinear effects in Part 50; resonant filters in Part 51; delay-line physical models in Part 52; real halls in Part 55; equalizers and reverbs in a mix in Part 56.
Key results
The part's results in one place, for revision.
Try it
Lab 49 · Filters, delay and reverb, computed
Design a biquad and hear it, make a pitch from a delay, simulate a room and measure its reverberation time against Sabine's, and build Schroeder's reverberator.
python -m videos.music.labs 49
needs numpy, scipy, matplotlib · download lab49.py ·
source on GitHubpeak at 1000 Hz, Q 1.5, 9.0 dB: gain at 100 Hz, F0, 10 kHz 0.0 dB, 9.0 dB, 0.0 dB
its poles (radius) 0.9744, 0.9744
a feedback comb 218 samples long rings at 220.2 Hz
a (4.0, 3.0, 2.6) m room, alpha 0.2: RT60 measured / Sabine / Eyring 0.41 / 0.42 / 0.37 s
Schroeder's reverberator set to 1.5 s measures 1.50 s
ear problem: the last three are the groove through a random filter (listen first) peak at 1000 Hz; highpass at 400 Hz; lowpass at 400 Hz
Every effect here is delay and addition: feedback places poles, a room is a sum of delayed images, and a reverberator is a few delays fed back.
The code (71 lines; it asserts its own result)
"""Lab 49: filters, delay and reverb, computed: a biquad of your choice, a comb, a simulated room and its decay, and
Schroeder's reverberator."""
import numpy as np
from scipy.signal import lfilter
from videos.coursekit import labs
from explainer.music.monochord import SR, Clip, concat
from explainer.music.monochord import effects as F
from videos.music.music49 import compute as C
TITLE = "Filters, delay and reverb, computed"
GOAL = ("Design a biquad and hear it, make a pitch from a delay, simulate a room and measure its reverberation time "
"against Sabine's, and build Schroeder's reverberator.")
TASKS = [
"Change KIND, F0, Q and GAIN. Predict the response's shape from the poles and zeros the lab prints.",
"Change DIMS and ALPHA. How close does the measured RT60 come to Sabine's and Eyring's, and when does it stray?",
"Change T60 for Schroeder's reverberator and listen for its flutter. Does a longer decay hide it or expose it?",
]
KIND, F0, Q, GAIN = "peak", 1000.0, 1.5, 9.0
DIMS, ALPHA = (4.0, 3.0, 2.6), 0.2
T60 = 1.5
def run(seed=0):
rng = np.random.default_rng(seed)
lab = labs.Lab()
b, a = F.biquad(KIND, F0, SR, Q, GAIN)
r = F.response(b, a, SR, [100.0, F0, 10000.0])
lab.row(f"{KIND} at {F0:.0f} Hz, Q {Q}, {GAIN} dB: gain at 100 Hz, F0, 10 kHz", ", ".join(f"{v:.1f} dB" for v in r["db"]))
lab.row("its poles (radius)", ", ".join(f"{np.hypot(*p):.4f}" for p in r["poles"]))
D = 218
lab.row(f"a feedback comb {D} samples long rings at", f"{SR / D:.1f} Hz")
ir = F.room_ir(DIMS, (0.7, 0.8, 1.5), (DIMS[0] - 0.9, DIMS[1] - 0.7, 1.4), ALPHA, SR, 1.0)
rt = F.rt60(ir, SR)
lab.row(f"a {DIMS} m room, alpha {ALPHA}: RT60 measured / Sabine / Eyring", f"{rt:.2f} / {F.sabine(DIMS, ALPHA):.2f} / {F.eyring(DIMS, ALPHA):.2f} s")
imp = np.zeros(int(2.5 * SR))
imp[0] = 1
sch = F.schroeder(imp, SR, T60)
lab.row(f"Schroeder's reverberator set to {T60} s measures", f"{F.rt60(sch, SR):.2f} s")
assert rt > 0
# sound: a groove through your filter; the Tune in the room and through Schroeder; ear problem: random filters
g = C.groove(1)
x = C.tune_signal()
clips = [Clip(lfilter(b, a, g), SR), Clip(C.wet(x, ir, 0.6, 1.0), SR), Clip(C.wet(x, sch, 0.6, 1.0), SR)]
kinds = ["lowpass", "highpass", "peak"]
answers = []
for i in range(3):
k = kinds[int(rng.integers(3))]
fc = float(rng.choice([400.0, 1000.0, 3000.0]))
bb, aa = F.biquad(k, fc, SR, 1.0, 12.0 if k == "peak" else 0.0)
clips.append(Clip(lfilter(bb, aa, g), SR))
answers.append(f"{k} at {fc:.0f} Hz")
lab.audio = concat(clips, gap=0.8)
lab.row("ear problem: the last three are the groove through a random filter (listen first)", "; ".join(answers))
fig, (ax1, ax2) = labs.figure(2)
f = np.geomspace(20, 20000, 300)
ax1.semilogx(f, F.response(b, a, SR, f)["db"], color=labs.GOLD)
ax1.set_xlabel("Hz")
ax1.set_ylabel("dB")
e = F.edc(ir)
ax2.plot(np.arange(len(e)) / SR, e, color="C0")
ax2.set_ylim(-80, 0)
ax2.set_xlabel("s")
ax2.set_ylabel("energy still to come, dB")
lab.fig = fig
lab.note = ("Every effect here is delay and addition: feedback places poles, a room is a sum of delayed images, and "
"a reverberator is a few delays fed back.")
return lab
Now change it
- Change KIND, F0, Q and GAIN. Predict the response's shape from the poles and zeros the lab prints.
- Change DIMS and ALPHA. How close does the measured RT60 come to Sabine's and Eyring's, and when does it stray?
- Change T60 for Schroeder's reverberator and listen for its flutter. Does a longer decay hide it or expose it?
Problems, with solutions
Try each problem before opening its solution.
-
Compute. A room is 10 by 8 by 4 m, its surfaces absorbing 20 %. What reverberation time does Sabine predict?
Solution
V = 320 m³; S = 2(80 + 32 + 40) = 304 m². RT60 = 0.161 × 320 / (304 × 0.2) = 51.5 / 60.8 ≈ 0.85 s. (Eyring gives 0.161 × 320 / (−304 ln 0.8) ≈ 0.76 s.)
-
Prove. Prove that a first-order all-pass H(z) = (c + z⁻¹)/(1 + c z⁻¹) has |H| = 1 on the unit circle.
Solution
On the circle z = e^{iω}, so z⁻¹ = e^{−iω}. Then H = (c + e^{−iω}) / (1 + c e^{−iω}) = e^{−iω}(c e^{iω} + 1) / (1 + c e^{−iω}). For real c, the numerator's bracket c e^{iω} + 1 is the complex conjugate of the denominator 1 + c e^{−iω}, so the two have the same modulus, and |e^{−iω}| = 1. Hence |H| = 1 at every frequency.
-
Ear. The lab plays a groove through a random filter; say which kind, and roughly where.
Solution
The lab prints them. A low-pass sounds muffled (the cymbals dull), a high-pass thin (no kick, no bass), a peak honky or nasal around its frequency; 400 Hz sounds boxy, 1 kHz nasal, 3 kHz harsh.
-
Build. Fit a feedback delay network's line gains to match the tiled room's RT60.
Where to look. Each line's gain is 10^(−3 D / (fs T60)): set
t60infdnto the room's 1.22 s and comparert60of the two impulse responses, then in octave bands (octave_rt60in this part's compute): the room's bass rings longer, so make the one-pole damping in each loop a shelf that shortens the highs, and fit it. -
★ How small can a feedback delay network be and still pass for a given room?
Where the frontier is. Measure rooms by sweep; fit networks of 4, 8, 16 lines to each room's decay in every band and its echo density, by hand or by gradient descent through a differentiable network; then run blind, level-matched listening tests on speech and music.
Notes and sources
Sources
- J. O. Smith, Introduction to Digital Filters (2007) and Physical Audio Signal Processing (2010); U. Zölzer (ed.), DAFX: Digital Audio Effects (2nd ed., 2011); R. Bristow-Johnson, "Cookbook formulae for audio EQ biquad filter coefficients"; S. Butterworth, "On the theory of filter amplifiers" (1930); G. Massenburg, "Parametric equalization" (AES, 1972).
- M. R. Schroeder, "Natural sounding artificial reverberation", JAES (1962), and "New method of measuring reverberation time", JASA (1965); J. A. Moorer, "About this reverberation business", Computer Music Journal (1979).
- J. B. Allen and D. A. Berkley, "Image method for efficiently simulating small-room acoustics", JASA (1979); W. C. Sabine, Collected Papers on Acoustics (1922); C. F. Eyring, "Reverberation time in 'dead' rooms", JASA (1930); H. Wallach, E. B. Newman and M. R. Rosenzweig, "The precedence effect in sound localization" (1949); H. Haas (1951).
- A. Farina, "Simultaneous measurement of impulse response and distortion with a swept-sine technique", AES (2000).
- J.-M. Jot and A. Chaigne, "Digital delay networks for designing artificial reverberators", AES (1991); J. S. Abel and P. Huang, "A simple, robust measure of reverberation echo density", AES (2006); V. Välimäki, J. D. Parker, L. Savioja, J. O. Smith and J. S. Abel, "Fifty years of artificial reverberation", IEEE Trans. Audio, Speech, and Language Processing (2012).
- S. Bilbao, Numerical Sound Synthesis (2009); EMT 140 documentation; V. Välimäki, J. Parker and J. S. Abel, "Parametric spring reverberation effect", JAES (2010).
- A. Fettweis, "Wave digital filters: theory and practice", Proc. IEEE (1986); J. Engel, L. Hantrakul, C. Gu and A. Roberts, "DDSP: differentiable digital signal processing", ICLR (2020).
About this partfrom its README
Part 49 of a sixty-eight-part course in music (see the series plan and
the syllabus), the second part of Act IX, Electric Sound. In 1947 an engineer put a loudspeaker and a
microphone in his studio's tiled bathroom and sold the echo as art. In 1962 Manfred Schroeder at Bell Labs built a room out
of arithmetic: four comb filters and two all-passes. The linear and modulated effects here use delays, weighted sums and feedback, and this part
builds it: convolution, poles and zeros, equalizers, phase, combs and their moving relatives, a simulated room measured by
a sweep and checked against Sabine, Schroeder's reverberator, a feedback delay network, a steel plate by finite
differences and a spring. The tools are Monochord's (explainer/music/monochord/effects.py); every room, plate and spring
is simulated here, and no recorded impulse response is used.
- A room made of arithmetic. An ear question (the Tune in a simulated tiled room and in Schroeder's reverberator, both ringing 1.2 s: which is the arithmetic?); Putnam's bathroom, plates and springs; the plan.
- 1. Impulse responses and convolution. One click says everything; convolution sample by sample (four samples against four taps); the simplest effect, an echo, heard (two taps, 180 ms); convolution at scale (the FFT); finite and infinite impulse responses.
- 2. Poles and zeros. The one-pole low-pass (down 3 dB near 805 Hz); the z-plane; a pole near the circle rings, heard (a band-pass at 440 Hz with Q 2 and Q 50, poles at radius 0.986 and 0.9994); the biquad; stability.
- 3. Equalizers. Five cookbook biquads drawn; an ear question (a groove through a high-pass, a 12 dB peak and a low-pass, shuffled: which was which?); analogue prototypes and the bilinear transform (our Butterworth matches SciPy's to rounding); the parametric equalizer; equalizing in practice.
- 4. Phase. Timing, frequency by frequency; an ear question (a snare dry and through 60 all-passes: which was filtered?, every level unchanged to a millionth of a decibel); the all-passes' group delay (about 24 ms at the bottom, 0.07 at the top); linear and minimum phase.
- 5. Combs, flangers, choruses and phasers. One delay added back (notches every kilohertz, or peaks); noise in, a note out, heard (220 Hz from a 218-sample comb); a pad through a flanger, a chorus and a phaser, heard; a thumb on a reel; combs by accident.
- 6. The room's response. The image-source method (Allen and Berkley); a tiled room's response (2.6 × 2.1 × 2.5 m, 5 % absorption; the direct sound at 4.3 ms, early reflections, the tail); how we hear a room (the precedence effect); the room heard; Schroeder's backward integration (RT60 1.22 s); its modes and Schroeder frequency (about 600 Hz); Sabine (1.28 s) and Eyring (1.24 s) checked.
- 7. Measuring a room. A click or a sweep?; Farina's exponential sweep, heard; the room recovered (error 19 dB below the response); distortion's harmonics arriving early; why this sweep.
- 8. Schroeder's reverberator. Imitate the ear, not the room; four combs (29.7, 37.1, 41.1, 43.7 ms) and two all-passes (5.0 and 1.7 ms), set to 2 s and measuring 2.00; echo density (the room reaches noise-like density within tens of milliseconds, Schroeder's stays near 0.2); four snares through it and through a delay network, heard; Moorer's improvements.
- 9. Feedback delay networks. Delays that talk to each other (Jot and Chaigne); eight lines and a Hadamard matrix; two impulse responses; reverberation time in octave bands (the room 1.8 s at 125 Hz to 1.3 at 4 kHz; the plate 2.6 to 1.0; the network nearly flat); a cathedral of eight delay lines, heard (4.2 s); reverbs in practice.
- 10. Plates and springs. EMT's 140; the plate by finite differences (Kirchhoff's equation with Bilbao's frequency-dependent loss; 246 × 123 points, 8.1 mm apart; stability number 0.239); its response and spectrogram (the highest frequencies first); the plate heard; a spring as a loop of 80 all-passes, heard (1.3 s); plates and springs in practice.
- 11. Frontier: virtual analog and differentiable effects. Circuits simulated; effects that learn (DDSP); rooms from the wave equation; ★ research problem: how small can a feedback delay network be and still pass for a given room?
- Variation 49, recap and problems. The Tune's first phrase dry, in the tiled room, on the plate, on the spring and in the cathedral; the ledger (1.2, 1.9, 1.3 and 4.2 s); what we found; five problems; where it comes back; in practice; references; Part 50.
What is computed and built
python -m videos.music.music49.compute (about five minutes; the plate takes longest) fills .cache/music49/.
| Item | What it computes | Checked against |
|---|---|---|
conv, echo |
convolution by hand; a two-tap echo | numpy.convolve |
onepole, biquads, ring, eq |
one-pole and cookbook filters; poles and zeros; a ringing band-pass; an EQ quiz | the specs; SciPy's Butterworth (tests) |
phase |
60 all-passes on a snare; their group delay | unit magnitude (tests) |
combs, mods |
feedforward and feedback combs; flanger, chorus, phaser | the comb's pitch (tests) |
room, bands |
image sources; energy decay; RT60, Sabine and Eyring; octave bands; Schroeder frequency | Eyring within 10 % (tests) |
sweep |
Farina's sweep, inverse filter, recovery and harmonic separation | the true response (tests) |
schroeder, cathedral |
Schroeder's reverberator; feedback delay networks; echo density | the set decay (tests) |
plate, spring |
a finite-difference plate; a dispersive spring loop | the stability bound (tests) |
Monochord's tools are held in tests/music/test_effects.py; this part's claims and clips in tests/music/test_music49.py.
Sounds. Part 7's piano, Part 40's drums and pad, a plucked bass, noise and clicks, through the filters, rooms and reverberators of this part. Every reverb is labelled synthesized.
What the models are, and are not. The room is a perfect rectangle with frequency-independent absorption and a gentle loss with distance, high-passed at 40 Hz as a measurement chain would be; real rooms scatter and absorb by frequency. The plate is a simply supported Kirchhoff plate with two loss terms; a real EMT is suspended at its corners, damped by a pad, and driven and picked up by transducers with their own responses. The spring is a stand-in for a coil's dispersion, not a model of its physics. The cathedral is a delay network, not a building.
Notes
LTI convolution applies to fixed linear systems; moving modulation is time-varying, and nonlinear processors need other models. Pole stability assumes a causal rational system with uncancelled poles. Group delay is minus the phase derivative; linear phase does not eliminate ringing, and minimum phase is not universal among analog filters. EQ cutoffs depend on the source. Image sources and Sabine/Eyring use geometric and diffuse-field approximations. Orthogonal FDN mixing is a useful design choice, and finite integer delays still have common multiples. Echo density is a chosen Gaussian-reference statistic, not a complete perceptual equivalence test.
Companion material in this repository
The syllabus's plan for this partfrom SYLLABUS.md, the plan of record
- Hook: an ear question (a simulated room or Schroeder's arithmetic?); Putnam's bathroom; the plan.
- Impulse responses and convolution: one click says everything; convolution by hand; an echo heard; the FFT; FIR and IIR.
- Poles and zeros: the one-pole low-pass; the z-plane; a ringing pole heard; the biquad; stability.
- Equalizers: five biquads; an ear question (which filter was which?); analogue prototypes; the parametric equalizer; practice.
- Phase: timing by frequency; an ear question (which snare was all-passed?); group delay; linear and minimum phase.
- Combs, flangers, choruses and phasers: notches and peaks; a pitch from noise heard; three moving delays heard; history; combs by accident.
- The room's response: image sources; a tiled room's response; precedence; heard; Schroeder integration; modes; Sabine and Eyring.
- Measuring a room: a click or a sweep; the sweep heard; the room recovered; distortion arrives early; why this sweep.
- Schroeder's reverberator: imitate the ear; the diagram; echo density; snares heard; Moorer.
- Feedback delay networks: the idea; the Hadamard matrix; two responses; octave bands; a cathedral heard; practice.
- Plates and springs: EMT's 140; finite differences; dispersion; the plate heard; a spring heard; practice.
- Frontier: virtual analog; differentiable effects; rooms from the wave equation; the research problem.
- Variation 49: the Tune in five spaces. Outro: problems, payoffs.
Covers: impulse responses and convolution; poles and zeros; equalizers; phase; analog prototypes; combs,
flangers, choruses and phasers; the room's response; Schroeder's reverberator; feedback delay networks; plates
and springs; convolution reverb and sweep measurement.
Built and computed: monochord/effects.py: cookbook biquads (a Butterworth by bilinear transform matching SciPy's);
all-pass chains and group delay; combs (a 220 Hz pitch from noise), flanger, chorus and phaser; a tiled room by image
sources, RT60 1.22 s by Schroeder integration against Eyring's 1.24 and Sabine's 1.28, octave bands, Schroeder frequency
about 600 Hz; Farina's sweep recovering the room (error 19 dB down) and separating harmonics; Schroeder's reverberator
(echo density about 0.2) and an eight-line feedback delay network; a steel plate by finite differences (246 by 123
points; 2.6 s at 125 Hz, 1.0 s at 4 kHz); a dispersive spring loop.
Variation 49: the Tune dry, then in a bathroom (1.2 s), a plate (1.9 s), a spring (1.3 s) and a cathedral (4.2 s).
Frontier: virtual analog; differentiable effects; wave-based rooms (open: how small a network can pass for a room).
Reading: Smith, Introduction to Digital Filters and Physical Audio Signal Processing; Zölzer, DAFX;
Välimäki et al. (2012).
Build the film
python -m videos.music.music49.compute # the part's numbers, into .cache/music49
python tools/build.py music49 # render and assemble the film
EXPLAINER_TTS=silent python tools/qa_scene.py music49 Hook # one chapter, silent, with a contact sheet
Scenes: videos/music/music49. Setup: see the course page. Source of these notes: the README and the scenes' narration.
Build it
python -m videos.music.music49.compute # numbers and sounds (about five minutes)
EXPLAINER_TTS=silent python tools/build.py music49 -q l --fps 15 # a silent-narration preview, with the sounds
python tools/qa_sound.py music49 --sync # the sound gates
python tools/dead_air.py renders/music49_480p.mp4 --sound music49 # no empty screen; no sound over a still one
python tools/lecture_length.py music49 # 30 to 60 minutes, listening included
python tools/build.py music49 # 1080p30, narrated
python -m pytest -q tests/music # Monochord against its references; this part's claims and clips
python -m videos.music.labs 49 # the lab (writes a figure and a short WAV)