A showroom is not a chamber. Measure how a room answers one click and you can predict, tune and correct how a robot sounds and hears inside it.
Learn to measure a room with a sweep, read its reverberation, place a robot at the right distance, and tune its speaker with EQ, so a voice stays clear in a crowd.
Pick the room, then add people to the showroom. Watch the same three syllables smear or stay sharp. Then we build, piece by piece, how to measure the room, predict its ringing, and fix what you hear.
You need a feel for decibels (a unit for how much louder one sound is than another) and a little Python for the code. We build the rest from zero.
Built from primary sources, not from slides: Farina on sweeps, Schroeder on decay, the Sabine and Eyring equations, the RBJ audio EQ cookbook, Analog Devices on microphone sensitivity, and EBU R128 on loudness. Every link is in the Field Guide. Every idea is re-taught here in our own words and devices.
Illustrative toy: a 12 m by 10 m by 4 m shell (480 m³, 416 m² of surface) with an average absorption of 0.12, plus 0.45 m² of absorption per person. Reverberation time comes from Sabine’s equation (Chapter 4). Each syllable is a 120 ms burst; the blue envelope is that burst smoothed by a decay that falls 60 dB in one RT60.
Chapter 0
See why a speaker and a microphone that work well on a bench can fail in a showroom, and meet the measurements that fix it
A small robot stands on a table in a busy showroom. It speaks, it listens, and it moves its head toward whoever talks to it. On the bench in your lab it was lovely. Its voice was clear, and it heard every word.
In the showroom, three things go wrong. Its voice sounds boomy and hard to follow. A visitor says “hello” from two steps away and the robot hears nothing. And sometimes the robot answers itself, because its own voice came back from a glass wall and its microphone took the echo for a new speaker.
None of these is a software bug. Each one is the room talking. A room, to a sound, is a very long and strange filter: it delays the sound, repeats it, and colours it. If you do not measure that filter, you tune the robot for a place that does not exist.
Start with the smallest case. The robot plays one short click. The microphone, 1.5 m away, hears the click once through the air, straight from the speaker. This is the direct sound.
Then it hears the click again, a little later and a little quieter, because part of the sound bounced off a wall. This bounce is a reflection. It travels a longer path, and sound moves at about 343 m/s in air at 20 °C, so a longer path means a later arrival. Move the wall in the device below and watch the second copy slide.
Top: the room from above. The robot (warm) and the microphone (teal) sit 1.5 m apart, in a line parallel to a wall. Bottom: when each copy of the click reaches the microphone. Drag the distance to the wall.
Geometry is exact for one flat, fully reflecting wall (the mirror-image method): the reflected path is the straight line to the mirror image of the robot. Speed of sound 343 m/s. Real walls absorb some energy, so a real echo is quieter than shown. The level change is the inverse distance law, 20 log10(direct path / reflected path).
With the wall 1.2 m away, the reflected path is 2.83 m long, 1.33 m more than the direct path. The echo arrives 3.9 ms late and 5.5 dB quieter. A real room has hundreds of walls, floors, ceilings, shelves and people, so the microphone hears hundreds of such copies, piling up into a tail. That tail is reverberation.
Check the pattern with the wall twice as far, 2.4 m away. The reflected path is √(1.5² + 4.8²) = 5.03 m, which is 3.53 m longer than the direct path. The echo now arrives 10.3 ms late and 10.5 dB quieter. A farther wall gives a later and weaker copy. A nearer wall gives an earlier and stronger one. Everything in this lesson grows from that one rule, applied to every surface at once.
This lesson teaches the tools engineers use to measure and tame that pile of copies. Each chapter answers one question you can ask about a room.
Chapter 1
Learn how one click captures everything a room does to sound, and how any sound becomes a pile of delayed, scaled copies of that click
Stand in an empty stairwell and clap once. You hear the clap, then a fast flutter of repeats, then a soft hiss that fades over a second or two. That whole shape is the stairwell’s answer to your clap. A different stairwell answers differently, and so does a showroom.
Engineers keep that answer on purpose. The recorded reply to a perfect click is the impulse response, written h. An impulse is a click so short it is a single spike: one sample at full height, all the rest zero. The impulse response is the room’s fingerprint.
One click is not much. Why would it tell you what happens to a whole sentence? Because a room behaves, to a good approximation, in two simple ways.
First, the room is linear. Play a sound twice as loud and the reply is twice as loud. Play two sounds together and the reply is the two separate replies added. Second, the room is time-invariant. A click at noon and a click at 12:01 get the same reply, as long as nothing in the room has moved. A system with both promises is called LTI.
Now see why that is powerful. Any recording is a row of samples. Each sample is a tiny click, scaled by that sample’s value and placed at that sample’s time. The room answers every tiny click with a copy of h, scaled and shifted the same way. Add all the copies together and you have the room’s reply to the whole recording.
That sum has a name, convolution. Here is the rule, then each symbol.
Work a tiny case by hand. Take a room that answers a click with h = [1, 0, 0.5, 0, 0.25]. That means: the direct sound at step 0, a reflection half as strong two steps later, and another one a quarter as strong four steps later. Feed it x = [1, 2], a click followed by a click twice as large.
y[0] = 1×1 = 1 y[1] = 2×1 = 2 y[2] = 1×0.5 = 0.5 y[3] = 2×0.5 = 1 y[4] = 1×0.25 = 0.25 y[5] = 2×0.25 = 0.5
The output is y = [1, 2, 0.5, 1, 0.25, 0.5]. It is longer than the input: 2 + 5 − 1 = 6 samples. The tail is the room still ringing after the input has stopped. The device below runs this same sum on real-sized arrays, thousands of terms each.
Three lanes: the input, the room’s impulse response, and the output at the microphone. Choose a click or three syllables, then drag the decay. With the click, the output is the impulse response itself.
Toy at 1,000 samples per second so the sum runs live in your browser: the response is a 1,500-sample burst of seeded random noise with amplitude falling 60 dB in one RT60, plus a full-size direct spike. The syllables are 120 ms noise bursts. Real rooms run at 48,000 samples per second and about 1 to 2 seconds long (tens of thousands of taps).
Watch the output with syllables at a long decay. The syllables smear into each other, because each one drags a tail across the next. This is the smear of the hero at the top of the page.
In a real tool the numbers are plain arrays. The input x is a vector of N float samples, say 5 seconds at 48,000 samples per second: N = 240,000. The impulse response h for a room with a 1.5 s tail is M = 72,000 samples. The output y has N + M − 1 = 311,999 samples.
Doing the sum directly costs N × M, about 17 billion multiply-adds. So software does it with the FFT (a fast way to move a signal into frequency terms): multiply the two spectra, then go back. That costs a few million operations and gives the identical answer. Chapter 2 uses this trick to find h.
Read an impulse response left to right. First comes the direct sound. Then come the early reflections, the first few bounces in the first 50 to 80 ms. They are sparse and strong, and they colour the tone. Last comes the late tail, thousands of tiny bounces that blur into a smooth decaying hiss. Chapter 3 measures how fast the tail dies.
The symptom: you measure the same room twice and the tails do not match. The measurement: subtract one impulse response from the other and compare the energy of the difference with the energy of the response. A large ratio means the room is not time-invariant. Warm air rising, a door swinging, or a person walking through the path all break the second promise.
The fix: measure when the room is still, repeat the measurement, and average. If the room will never be still, as in a busy showroom, treat the measurement as one sample of a moving target and say so.
Chapter 2
Spread the test sound over many seconds, then collapse it back into a spike, and see the speaker’s distortion land in a place where it cannot hurt the answer
You want the impulse response of the showroom. The obvious test is a bang: pop a balloon or fire a starter pistol. It has a problem. A speaker cannot play a huge spike without clipping, and a microphone hears the room’s noise at the same time. The spike is tall but very short, so it carries almost no energy. The noise is small but lasts forever, so it carries a lot.
The fix is an old trick. Energy is loudness squared times duration. If you cannot make the sound louder, make it longer. Play a long sound that is easy for the speaker, record it, then use maths to squeeze the long sound back into a spike. The squeezing step is deconvolution: undoing a convolution.
The long sound is a sine sweep: a pure tone whose pitch glides upward, say from 20 Hz to 20 kHz. In an exponential sweep the pitch rises by the same number of octaves each second, so it spends as long on the low octave from 20 to 40 Hz as on the high octave from 10 to 20 kHz. A straight-line sweep would rush through the low octaves. The exponential sweep lingers there, and that is what you want, because background noise is strongest at low frequency.
Farina (2000) showed how to build the squeezing filter in two steps. First, play the sweep backwards in time. Then lower its volume by 6 dB per octave as frequency rises, which you do by multiplying with a falling exponential. Convolve the sweep with this inverse filter and you get a spike. Convolve the recording of the sweep with it and you get the room’s impulse response.
Why 6 dB per octave? The sweep spends the same time on every octave, so each low pitch gets more energy per hertz than each high pitch: the energy per hertz falls in proportion to 1 / f. The falling weight evens that out, so the result is flat across frequency, as a true spike would be.
Every speaker distorts a little. When it plays a tone at frequency f, it also leaks small copies at 2f, 3f and so on. These are harmonics. With a click, the harmonics are smeared into the response and you cannot tell them apart.
With an exponential sweep, something lovely happens. The second harmonic of a sweep is the same sweep running twice as high. The sweep reaches a given pitch at an earlier time than the first harmonic reaches it twice that pitch, so it is the same sweep shifted in time. The shift is fixed by one number: how long the sweep takes to climb one octave. Set the shift so that the growth factor eΔt·L/T equals the harmonic number k, and solve:
Work it for a 10 s sweep from 20 Hz to 20 kHz. The ratio is 1,000, so L = ln 1000 = 6.908. The 2nd harmonic appears 10 × 0.693 / 6.908 = 1.00 s before the main peak. The 3rd appears 10 × 1.099 / 6.908 = 1.59 s before. The linear response sits in the clean second after the main peak, and all the distortion sits before it, where you can cut it away with a window.
Top: the sweep climbs by equal octaves per second, a straight line on a log axis. Bottom: the deconvolved result in decibels. The tall spike at 0 s is the room. Raise the drive and watch the spikes of the 2nd, 3rd and 4th harmonics grow before it, exactly where the formula puts the dashed lines. Then switch to the click.
Toy computed live: 4,000 samples per second, a 2 s sweep from 20 Hz to 1,800 Hz (so Δt2 = 0.31 s, Δt3 = 0.49 s), a speaker modelled as a soft clipper with a small offset (it makes both even and odd harmonics), a toy room with a direct spike, three reflections and a 0.35 s tail, and white mic noise at the level shown below the full-scale signal. Deconvolution is Farina’s inverse filter, done with a 32,768-point FFT.
With the sweep and the default settings, the 2nd harmonic sits at −0.31 s and the 3rd at −0.49 s, right on the dashed lines. The room’s response, after 0 s, is clean. Press the click and the same noise sits much closer to the response: the click has the same peak but far less energy. A 10 s sweep would gain another 7 dB over this 2 s one.
Take the 10 s sweep at 48,000 samples per second. The sweep x has M = 480,000 samples. The recording is M plus the room tail, about 552,000 samples. The inverse filter has 480,000 samples. Convolving them takes an FFT of 220 = 1,048,576 points. The main peak lands at index M − 1. Harmonic 2 lands 1.00 s × 48,000 = 48,000 samples earlier. You then keep a window from a few milliseconds before the main peak to as far as you trust the tail.
The symptom: your impulse response shows a faint echo before the direct sound, which no room can do. The measurement: compare its position with the Δtk formula. If it matches, it is a harmonic of the speaker, not the room. The fix: lower the speaker level until those bumps sink into the noise floor, and keep the microphone from clipping. Then average several sweeps. Each doubling of the number of averages lowers random noise by about 3 dB.
Chapter 3
Turn a jagged impulse response into one smooth decay curve, and read the reverberation time from its slope
Clap in a bathroom with tiled walls and the sound hangs in the air. Clap in a bedroom with a bed and curtains and the sound dies at once. Both rooms have the same direct clap. They differ in how long the tail lasts. That time is the most quoted number in room acoustics.
The tail is a fall in loudness, so we need a yardstick for “gone”. Engineers use RT60, the reverberation time: the time the sound level takes to fall by 60 dB after the source stops. A fall of 60 dB means the energy is one millionth of what it was. For a loud clap that is close to silence.
Take the impulse response from Chapter 2 and square every sample, to get energy. You hope to see a clean downward line in decibels. Instead you see a jagged, spiky trace. The reason: the tail is a random pile of tiny reflections, so its energy jumps up and down from sample to sample around a trend.
There is a second problem. The fall must reach 60 dB, but the microphone noise floor usually stops you at 40 or 50 dB. The jagged trace also hits the floor and flattens. You cannot find a slope on that.
Manfred Schroeder published the cure in 1965. Instead of plotting the energy at each moment, plot the energy still to come after that moment. Start at the end of the response and add backwards.
Why does that help? A sum smooths out random jumps. Each point on the curve contains all the energy after it, so one lucky spike cannot move it much. Schroeder showed that the curve equals the average of a huge number of separate decay measurements, so one clean response replaces many repeated runs. In decibels, it is a smooth line that bends only where the real room does.
Now fit a straight line to part of the curve and extend it to −60 dB. The standard fits from −5 dB to −25 dB (called T20) or from −5 dB to −35 dB (T30), and scales the time up to a 60 dB fall (ISO 3382-2). Starting at −5 dB skips the strong early reflections. Stopping early keeps the fit clear of the noise.
Worked example. A Schroeder curve crosses −5 dB at 0.10 s and −25 dB at 0.30 s. The drop is 20 dB in 0.20 s, so the slope is −100 dB per second. A 60 dB fall takes 60 / 100 = 0.60 s. The T20 reverberation time is 0.60 s. It was never measured to −60 dB. It was read from 20 dB of the curve and scaled by three.
A synthetic impulse response with a chosen true RT60 and a noise floor. Switch between the jagged raw energy and the Schroeder curve. The teal line is the T20 fit from −5 to −25 dB, extended to −60 dB. Raise the noise floor and watch the curve bend.
Synthetic: 1,000 samples per second, 3 s long, a random tail whose amplitude falls 60 dB in the true RT60, plus white noise at the floor (in decibels below the starting level). The fit is a least-squares line over the part of the Schroeder curve between −5 and −25 dB; the raw trace is smoothed by a 10 ms moving average. All integration and fitting run live in your browser.
With a true RT60 of 0.80 s and a floor at −70 dB, the line reads about 0.8 s. Push the floor up to −35 dB and the Schroeder curve bends upward, because the noise energy is being added in too. The fitted number drifts away from the truth.
What do you do with the number? You compare it with a target for the room’s use, and you feed it into the next chapter’s equations. A reading of 1.55 s says the room has about 50 sabins of absorption, since A = 0.161 V / RT60 = 0.161 × 480 / 1.55. That is the bridge from a measurement to a plan.
The symptom: T20 and T30 disagree, or the answer changes when you shorten the recording. The measurement: look at the gap between the peak and the noise floor. You need the fitted range plus about 10 dB of margin to sit above the floor. For T30 that is 45 dB of clean range. The fix: lengthen the sweep or average more runs, to raise the clean range, or report T20 and say so. Report the value for each octave band, because a room that rings 0.5 s at 2 kHz often rings 1 s at 125 Hz.
Chapter 4
Derive the reverberation time from the room’s volume and surfaces, then see how many people it takes to tame a showroom
You have a floor plan of a new showroom and no time to measure it. Can you say how long it will ring before the first visitor walks in? Yes, within useful error, with one short chain of reasoning. It is worth following, because it tells you which knob to turn when a room rings too long.
Picture the sound as many small packets of energy flying around. Each time a packet hits a wall, the wall soaks up a fraction and reflects the rest. That fraction is the absorption coefficient, α, a number from 0 (a perfect mirror) to 1 (an open window). Painted concrete is near 0.02. A thick curtain is much higher. The value changes with frequency.
How often does a packet hit a wall? In a room of volume V and total surface S, a packet travels on average 4V/S metres between hits. Sound moves at c = 343 m/s, so it hits a wall cS/(4V) times per second. A big, thin room is hit rarely. A small, boxy room is hit often.
After one hit, the energy is (1 − α) of what it was. After n hits it is (1 − α)n. In time t there are n = cSt/(4V) hits. So:
E(t) = E0 · (1 − α)cSt/4V
RT60 is the time when E has fallen to one millionth of E0 (60 dB). Set the left side to 10−6, take logs, and solve for t:
This is Eyring’s equation. For a room with little absorption, α is small and −ln(1 − α) is almost exactly α. Then the formula becomes Sabine’s equation, the older and simpler one: RT60 = 0.161 V / (Sα). The product Sα is the total absorption, counted in sabins, where one sabin is one square metre of perfect absorber.
Worked example, with the showroom of the hero: V = 480 m³, S = 416 m², α = 0.12. Total absorption A = 416 × 0.12 = 49.9 sabins. Sabine gives 0.161 × 480 / 49.9 = 1.55 s. Eyring: −ln(0.88) = 0.1278, so S × 0.1278 = 53.2, and RT60 = 0.161 × 480 / 53.2 = 1.45 s. A 7 percent difference. When α is high, the two split apart. Sabine over-predicts in small, heavily absorbing rooms, as the sources agree.
The warm curve is Sabine and the blue curve is Eyring for the showroom, against average absorption of the bare room. The dot rides the curve for your settings, including the people you let in. Drag the absorption, then the crowd, then set a target.
Showroom of the hero: 480 m³ and 416 m². Each person adds 0.45 m² of absorption, an illustrative mid-frequency figure (real values depend on clothing, seating and frequency). The “panel” line assumes treatment with α = 0.8 that replaces bare wall at α = 0.12, so each square metre adds 0.68 sabins. Formulas: Sabine 0.161 V/A; Eyring 0.161 V / (−S ln(1 − A/S)).
At α = 0.12 and no people, the dot sits at 1.55 s. Add 80 people and it falls to 0.90 s. To reach 0.60 s you need 0.161 × 480 / 0.60 = 129 sabins in all. The bare room has 50, so you must find 79 more. That is 116 square metres of panel at the rate above, or about 176 more people than a showroom may hold.
A porous absorber, such as foam, a curtain or a person’s clothing, works by rubbing the moving air. Air moves fastest about a quarter of a wavelength away from a hard wall, so the absorber must be about that thick to work well. At 2 kHz the wavelength is 343 / 2000 = 17 cm, and a quarter is 4 cm: a thin panel is enough. At 100 Hz the wavelength is 3.4 m, and a quarter is 86 cm. That is why a room with plenty of treble absorption can still boom in the bass, and why the band-by-band view matters.
The symptom: you predicted 0.9 s and the sweep says 1.3 s at 125 Hz. The measurement: compare the number in each octave band. The prediction used one α for all frequencies, but foam, carpet and people absorb treble far better than bass. The fix: work in bands. And when you have a measured RT60, invert the formula for what it implies: A = 0.161 V / RT60. That total absorption is the honest number, whatever the walls are made of.
Chapter 5
Find the distance at which the room starts to shout louder than the robot, and learn why measuring close and measuring far answer different questions
A visitor talks to the robot from one step away and is understood. She steps back to three metres and the robot keeps missing words, although she speaks just as loud. Nothing is wrong with the microphone. Something in the room changed with distance, and you can compute it.
A voice reaches a microphone in two parts. The direct sound goes straight from mouth to microphone. Its energy spreads over a growing sphere, so it falls with the square of distance. Every doubling of distance cuts the level by 6 dB. This is the inverse distance law.
The reverberant sound is the part that has bounced around the room many times. By the time it reaches the microphone it has come from everywhere. It is almost the same level at every spot in the room. Move closer or farther and it hardly changes.
So one part falls steeply with distance and the other stays flat. Near the source the direct sound wins. Far away the flat floor wins. They meet at one distance, the critical distance.
Take the energy density at a point at distance r from a source that spreads sound evenly. It is the sum of the two parts.
Set the two terms equal: Q/r2 = 16π/R. Solve and you get the critical distance, dc = √(QR / 16π). A common rule of thumb for an even source puts it at dc ≈ 0.057 √(V / RT60), in metres.
Worked example, the empty showroom. V = 480 m³ and RT60 = 1.55 s, so V / RT60 = 309.7 and its square root is 17.6. Then dc = 0.057 × 17.6 = 1.0 m. The room constant route agrees: A = 49.9, α = 0.12, R = 56.7, and √(56.7 / 50.27) = 1.06 m.
Now step back to 4 m. The direct sound is 1/16 of its 1 m level, which is −12.0 dB. The floor is 16π / R = 0.887, which is −0.5 dB. The direct-to-reverberant ratio, DRR, is −12.0 − (−0.5) = −11.5 dB. At 4 m, the room is 11.5 dB louder than the voice itself.
Warm: direct sound, falling 6 dB per doubling. Blue: the reverberant floor. Teal: what a microphone hears, the sum. The vertical dashed line is the critical distance. Drag the distance, add people, and try an aimed source.
Diffuse-field model with the showroom of the hero (480 m³, 416 m², α 0.12, 0.45 m² per person, illustrative). Levels are relative to the direct sound of an even source at 1 m. An aimed source (Q = 4) pushes the critical distance out by √4 = 2 on its axis; real aiming varies with frequency. Reverberant level uses the room constant R = A/(1 − α) with A from Sabine.
Drag to 4 m with no people and read the ratio: about −11.5 dB. Add 100 people and RT60 drops, R grows, and the floor drops, so the critical distance moves out. Switch to Q = 4 and it moves out by a factor of two on-axis.
The inverse distance law has a catch. It holds only in the far field, well away from the source compared with the source’s size and the wavelength of the sound. Very close to a speaker cone, the pressure from different parts of the cone has not yet merged into one wave. This is the near field, and levels there do not follow a clean 6 dB per doubling.
That helps in measurement. A microphone a few centimetres from the cone hears almost no room, so it measures the speaker alone. A microphone at 1 m or more, with the response cut before the first reflection (Chapter 6), measures the speaker in the far field. Mixing the two without care gives wrong curves.
The symptom: the speech recogniser works at 0.5 m and fails at 3 m even after you raise the gain. The measurement: compute DRR from the impulse response, as the energy in a few milliseconds around the direct peak against the energy of everything after. The fix: bring the microphone closer to the talker, use a directional microphone or array, or add absorption to push the critical distance out. Gain cannot help, since it lifts the room and the voice together.
Chapter 6
Build a measurement chain with a reference, a calibrated microphone and a time window, and learn what each choice does to the curve you plot
You plot your robot speaker’s frequency response on the showroom table and get a curve full of deep, regular dips, like the teeth of a comb. Is the speaker that bad? No. The table, the glass and the floor are in the measurement. A good rig removes them, and a bad one hides them in the curve.
The frequency response of a speaker is how loud it plays each pitch when you drive it with the same level at every pitch. A flat response means no pitch is favoured. In practice, a speaker has bumps and cliffs, and that is what we want to see, and then fix with EQ (Chapter 7).
A measurement rig has six parts, and each can add its own error.
Calibration needs a worked example. A calibrator puts a 1 kHz tone at 94 dB SPL on the microphone. That level is a sound pressure of 1 pascal rms. (The dB SPL scale starts at 20 µPa; 20 log10(1 / 0.00002) = 94 dB. Chapter 9 explains it.) Suppose the recording shows −30 dBFS rms for that tone. Then −30 dBFS in this file means 94 dB SPL. A later reading of −20 dBFS means 94 + 10 = 104 dB SPL. Analog Devices’ note on microphone specifications uses the same convention for MEMS microphones: sensitivity is quoted at 94 dB SPL.
The impulse response contains the direct sound first and the room’s reflections after. If you keep only the first few milliseconds, before the first reflection arrives, the room is gone. This is a gated measurement: you multiply the response by a window, a shape that is 1 while you trust the data and fades to 0 afterwards.
The price is frequency resolution. A window of length T seconds cannot tell apart two pitches closer than about 1/T hertz. Think of it as listening for T seconds: with a quarter-second you can tell 4 Hz apart, with 4 ms you cannot tell 100 Hz from 300 Hz.
Worked example. The speaker and microphone are both 1 m above the floor, 1 m apart. The floor bounce travels sqrt(12 + 22) = 2.236 m, which is 1.236 m longer than the direct path. At 343 m/s that is 3.6 ms. The window may be 3.6 ms long. Its resolution is 1 / 0.0036 = 277 Hz. Below about 280 Hz the gated curve means little. For those pitches, measure near the cone (Chapter 5, near field) and splice.
Dashed: the speaker’s true response. Solid: what you measure. A reflection arrives after the delay you choose. Make the window longer than that delay and the comb appears. Make it very short and the low end smears.
Toy at 8,000 samples per second: a speaker made of a +8 dB bump at 700 Hz (Q 4), a 2.2 kHz low-pass, and a 0.7-strength reflection after the delay, plus a faint noisy room tail. The window is flat then fades with a half-cosine over its last quarter. The measured curve is the FFT of the windowed response; the error is the RMS difference from the true curve between 150 Hz and 3 kHz.
At the defaults the window is just shorter than the reflection. The measured curve follows the truth above the resolution limit and drifts below it. Stretch the window to 20 ms and a comb with teeth spaced 1 / 3.6 ms = 278 Hz apart appears. The 3.6 ms delay and the 278 Hz tooth spacing are one fact seen twice.
Even a good curve is spiky. Engineers often smooth it over a fraction of an octave, such as one third, because ears hear broad shapes. It makes the plot readable. But it also hides narrow dips, which the ear can still hear. Smooth to see, then check the unsmoothed curve before you write an EQ filter.
The symptom: regular ripple across the curve. The measurement: the spacing between the dips is 1/Δt, so a 278 Hz spacing means a 3.6 ms path difference, which is 1.24 m of extra path. That points at the floor or the table. The fix: shorten the window, move the microphone, or lay the rig on the floor so the reflection merges with the direct sound.
Chapter 7
Place a peaking filter on a measured bump, set its three knobs, and compute the five numbers that make it run in real time
The sweep from Chapter 6 shows a fat bump at 180 Hz. In the showroom the robot’s voice sounds boomy, as if it spoke from inside a cardboard box. You want to turn that one region down without touching the rest of the sound.
That is the job of an equaliser, or EQ: a filter that changes the loudness of chosen pitches. A parametric EQ gives each band three knobs. They are the centre frequency f0, the gain in decibels (positive boosts, negative cuts), and the Q, which says how narrow the band is. A high Q is a thin needle. A low Q is a broad hill.
A biquad is a small filter that computes each output sample from the last two inputs and the last two outputs. It needs five numbers. The W3C Audio EQ Cookbook (by Robert Bristow-Johnson) gives them for a peaking band. First compute three helpers:
A = 10dBgain/40 ω0 = 2π f0 / Fs α = sin(ω0) / (2Q)
Worked example. Cut 9 dB at 180 Hz, Q = 5, at Fs = 48,000 Hz. Then A = 10−9/40 = 0.5957. ω0 = 2π × 180 / 48000 = 0.023562, so sin ω0 = 0.023559 and cos ω0 = 0.999722. α = 0.023559 / 10 = 0.0023560. Now a0 = 1 + 0.002356 / 0.5957 = 1.003955. Divide each coefficient by a0:
b0 = 0.997458 b1 = −1.991568 b2 = 0.994663 a1 = −1.991568 a2 = 0.992121
That is the whole filter. Notice b1 and a1 are equal. That is why a cut and a boost of the same size cancel exactly: swap A and 1/A and you get the inverse filter. The cookbook notes this too.
The dashed curve is a measured response with two bumps and one dip. Choose a band, then set its frequency, gain and Q. The purple curve is your filter. The teal curve is the measured response plus your filters. Aim for the flattest teal line.
Illustrative measurement built from three peaking bands: +9 dB at 180 Hz (Q 5), a −5 dB dip at 650 Hz (Q 2.5) and +6 dB at 1.8 kHz (Q 3). Filter curves use the exact Audio EQ Cookbook peaking coefficients at 48,000 samples per second. Ripple is the RMS deviation of the corrected curve from 0 dB between 60 Hz and 4 kHz.
Try band 1 at 180 Hz, −9 dB, Q 5. The boom vanishes and the ripple falls from 2.6 dB to 1.9 dB. Band 2 at 1.8 kHz, −6 dB, Q 3 takes it down to 1.4 dB. What remains is the dip at 650 Hz. You could boost it, but should you?
Musicians think in octaves, not in Q. The cookbook links them: 1/Q = 2 sinh( (ln 2 / 2) · BW · ω0 / sin ω0 ), where BW is the width in octaves between the points half the gain away from the centre. For a narrow band at a low frequency, ω0 / sin ω0 is almost 1 and sinh x is almost x, so BW ≈ 1.44 / Q. The cut above, with Q = 5, is 0.29 octave wide, about 163 to 199 Hz. A Q of 1.44 spans one full octave. Match the filter’s width to the bump’s width, or you cut too much around it or too little in it.
A peak at one spot in a room is often a standing wave: the room helps that pitch. A cut brings it back. A dip is more often a cancellation, where two paths meet out of step. Move the microphone half a metre and the dip moves with it. A boost aimed at a dip burns amplifier power and speaker travel, and fixes nothing in other places. Cut broad peaks and leave narrow dips alone.
The symptom: the curve is flat at the measuring spot, but a visitor three steps to the side says it sounds hollow. The measurement: repeat the sweep at five or six positions where listeners will stand, and look at the spread between them. The fix: correct only what is common to all positions, which means the broad shape, and check the clipping margin after every boost.
Chapter 8
Build the same EQ cut two ways and count the milliseconds, the multiplications and the pre-ringing each one costs
A visitor speaks. The robot hears, thinks, and answers. Every stage adds delay, and a filter is a stage. If your EQ adds 20 ms, the robot’s voice also arrives 20 ms later, and any loop that listens to its own output has to wait 20 ms to learn what it said. You need to know what a filter costs before you put it in the path.
There are two families. Both can make the same magnitude curve. They differ in how they get there, and the difference shows up in time.
The biquad of Chapter 7 feeds its own past outputs back in. That feedback makes a short recipe act like a long one. A tiny change in the input can keep echoing inside the filter, fading out slowly. In theory it never stops, which is why it is called an IIR filter, for infinite impulse response. A stable one fades towards zero.
An IIR biquad costs five multiplications per sample. At 48,000 samples per second that is 0.24 million per second. A cut like the one in Chapter 7 is a minimum-phase filter: it does the least delay that its magnitude curve allows. Its delay changes with frequency, and it is largest near the centre of a sharp band.
An FIR filter, for finite impulse response, has no feedback. Each output is a weighted sum of the last N inputs, which is the convolution of Chapter 1 with a short impulse response of N taps.
y[n] = b0 x[n] + b1 x[n−1] + … + bN−1 x[n−N+1]
Its great gift is that the taps can be symmetric. A symmetric FIR is linear-phase: every pitch is delayed by exactly the same time, (N − 1) / 2 samples. The waveform keeps its shape. For a very sharp EQ curve this is attractive, since you can shape the magnitude without bending the timing.
The price has two parts. First, the delay is built in. With N = 2,049 taps at 48,000 samples per second, the delay is 2,048 / 2 / 48,000 = 21.3 ms. Second, the cost per sample is N multiplications: 2,049 × 48,000 = 98 million per second per channel, about 400 times a biquad. Fast convolution with the FFT cuts the arithmetic but not the delay.
To copy a curve with a feature of width w hertz, an FIR needs a frequency resolution finer than w. Just as in Chapter 6, a response of N samples resolves only so much. With a Hann window (the smooth fade used here), detail is smeared over about 4 Fs / N hertz. A band at 180 Hz with Q = 5 is only 36 Hz wide, so it needs about 4 × 48,000 / 36, which is 5,300 taps. A band at Q = 1 is 180 Hz wide, and about 1,100 taps will do.
The target is a −9 dB cut at 180 Hz. Purple: the exact IIR biquad. Teal: an FIR built from the target with the number of taps you choose. Below, the two impulse responses on a shared time axis. Choose a wide or a narrow cut, then drag the taps.
Computed live at 48,000 samples per second. The FIR is designed by sampling the target magnitude on an 8,192-point grid, taking the inverse FFT as a zero-phase response, keeping the central taps and applying a Hann window. The tap count runs from 32 to 4,096 on a log slider. The IIR delay is the largest group delay of the biquad, from the slope of its phase. The error is the RMS difference from the target between 40 Hz and 4 kHz.
Start with the narrow cut at 512 taps. The FIR costs 5.3 ms and misses the target by 1.2 dB RMS, because the notch is shallow and smeared. Drag to 4,097 taps and the error shrinks to 0.2 dB while the delay climbs to 42.7 ms. Switch to the wide cut: 513 taps leave 1.0 dB, 1,025 taps leave 0.3 dB at 10.7 ms, and 2,049 taps leave 0.1 dB at 21.3 ms. The IIR matched both exactly and delayed by about a millisecond.
Look at the lower panel. The IIR response begins at time zero and rings after. The linear-phase FIR is symmetric: it rings before its centre as well as after. That is pre-ringing. The filter cannot know the future, so it is not literally predicting the click. It is delayed by half its length, and the part that looks early is only early relative to the centre. But the energy is real and audible after sharp sounds, such as a consonant. The IIR puts all its ringing after the event, where the ear masks it better.
The symptom: the correction measures flat, but the robot answers late and its echo canceller drifts. The measurement: the delay of the whole path, found as the peak of the impulse response of the path (Chapter 2), before and after the filter. The fix: use the IIR for parametric cuts, keep the FIR short or minimum-phase, and keep linear-phase FIRs for places where waveform shape matters more than a few milliseconds.
Chapter 9
Convert between pascals, decibels and digital numbers, add sources correctly, and read a voice-to-babble ratio at a visitor’s ear
The robot says “welcome” at a level you set to 70 on a dial. What does 70 mean? To a listener, to a microphone, and to an engineer comparing two rooms, it means three different things. This chapter ties them together, so that when you read “−50 dBFS” in a file, you know what pressure moved the microphone.
Sound is a tiny change in air pressure. The quietest sound a young listener can hear moves the air by about 20 millionths of a pascal. A very loud shout moves it a million times more. Numbers across that range are clumsy, so we use a log scale. The decibel (dB) compares two things by the log of their ratio. For pressure:
Worked example. A pressure of 1 Pa gives 20 log10(1 / 0.00002) = 20 log10(50,000) = 20 × 4.699 = 93.98 dB SPL, which is why calibrators play 94 dB. Doubling the pressure adds 6.02 dB. Ten times the pressure adds 20 dB.
Two talkers speak at 60 dB each. The total is not 120 dB. Independent sounds add their power, so you convert to power, sum, and convert back: L = 10 log10(106.0 + 106.0) = 10 log10(2 × 106) = 63.01 dB. Two equal sources add 3 dB. Ten add 10 dB. Forty add 16 dB. This is why a crowd of quiet voices becomes a wall of noise.
Microphone makers fix the link for you. Analog Devices’ application note AN-1112 explains that a digital MEMS microphone with a maximum acoustic input of 120 dB SPL maps that level to 0 dBFS, so a 94 dB SPL test tone reads −26 dBFS peak. For such a microphone, dBFS = dB SPL − 120. The same note quotes a microphone with 33 dBA equivalent input noise, which sits at −87 dBFS. A voice must stand well above that to be heard by your code.
Two voice lines can have the same peak and sound very different in volume. Loudness tries to measure what a listener feels. Broadcasting uses the unit LUFS, defined in ITU-R BS.1770 with a frequency weighting called K-weighting, and averaged over the whole programme. The European rule EBU R128 asks for −23 LUFS, within ±0.5 LU, with a true peak no higher than −1 dBTP. A robot with fifty recorded lines can use the same measure to make them equally loud.
Three bars at the visitor’s ear: the robot’s voice, the crowd’s babble and the room’s background noise. The left scale is dB SPL. The right scale is dBFS for a microphone with a 120 dB SPL maximum. Set the robot’s level, the distance and the crowd.
Illustrative toy on the showroom of the hero. Each talking person makes 60 dB SPL at 1 m, and one in four people talks at once; they add as independent powers in the diffuse field, 10 log10(talkers × 16π/R). Background noise is a flat 40 dB SPL. The robot’s level at the visitor is 10 log10(1/d2 + 16π/R) above its level at 1 m. The dBFS scale is dB SPL − 120, as in the AN-1112 example.
With the defaults (68 dB at 1 m, 2 m away, 40 people) the voice at the visitor is 67 dB SPL and the noise is 68 dB, so the voice sits 0.5 dB under the crowd. Move the visitor to 1 m and the voice leads by 2.2 dB. Raise the robot to 80 dB at 2 m and it leads by 11.5 dB, but at 80 dB the voice is harsh, and in a real crowd people raise their own voices in turn. Tune the level, the distance and the room together.
Here is the dBFS link in numbers. A visitor speaks at 70 dB SPL at the robot’s microphone. For the 120 dB SPL microphone above, that is 70 − 120 = −50 dBFS, which uses 1 part in 316 of the converter’s range in amplitude. A quiet background of 40 dB SPL sits at −80 dBFS. The gap between them, 30 dB, is the ratio your software must work with, and no later gain can widen it.
The symptom: some voice lines jump out and one crackles in the speaker. The measurement: loudness in LUFS for each line and its true peak in dBTP. The fix: normalise each line to the same LUFS and leave headroom below 0 dBFS, such as the −1 dBTP of R128, so the converter and the speaker do not clip.
Chapter 10
Put every measurement together and see which assumptions break when the room fills with people
On Monday at seven, the showroom is empty. You run your sweep, read an RT60 of 1.55 s, and tune the robot’s EQ until the curve is flat. On Saturday at noon, eighty people are inside. The robot sounds different, hears worse, and the careful EQ is slightly wrong. Nothing broke. The room changed, and every tool in this lesson told you it would.
An anechoic chamber is a room whose walls, floor and ceiling are covered in deep wedges that absorb almost all sound. “Anechoic” means without echo. There the inverse distance law holds everywhere and the room is a simple pipe for sound: no reverberant floor, no critical distance, almost no background noise. A speaker is measured there to learn what the speaker does by itself.
A showroom is the opposite in three ways. It is live: hard surfaces give an RT60 over a second. It is noisy: air conditioning, music, and above all other people talking. And it is moving: people walk through the signal path and change the room each minute.
Chapter 1 promised the room is linear and time-invariant. A chamber is. An empty showroom nearly is. A crowd breaks the second promise a little, since bodies move. Chapter 2’s sweep tolerates small changes, but averaging many sweeps in a crowd smears the tail.
Chapter 4 said absorption sets the ringing. Each person adds roughly half a sabin (this lesson’s illustrative figure). Eighty people add 36 sabins to the showroom’s 50, so RT60 falls from 1.55 s to 0.90 s. Chapter 5 follows: the reverberant floor falls by 2.8 dB, and the critical distance grows from 1.06 m to 1.47 m. The crowd helps clarity.
Chapter 9 gives the cost. The crowd talks. One in four people talking at 60 dB SPL at 1 m puts a babble in the diffuse field that outweighs the gain from absorption. The table runs the same robot, at 68 dB SPL at 1 m, talking to a visitor 2 m away:
| Room | RT60 | Critical distance | Direct to reverberant at 2 m | Noise at the visitor | Voice-to-noise at 2 m |
|---|---|---|---|---|---|
| Anechoic chamber (illustrative) | about 0 s | over 40 m | +27.0 dB | 20 dB SPL | +42 dB |
| Empty showroom | 1.55 s | 1.06 m | −5.5 dB | 40 dB SPL | +28.6 dB |
| Showroom, 80 people | 0.90 s | 1.47 m | −2.7 dB | 70 dB SPL | −3.1 dB |
Read the table by columns. The room’s ring (RT60) and the direct-to-reverberant ratio improve with the crowd. The noise column ruins it: from 40 to 70 dB SPL, a 30 dB rise. The voice at the visitor is nearly the same, 68.6 dB for the empty room and 66.5 dB for the full one, but the noise rose 30 dB, and the voice-to-noise ratio swung from +28.6 dB to −3.1 dB.
Each small chart compares the chamber, the empty showroom and the crowded showroom on one number. Change the visitor’s distance, the robot’s level or the crowd and watch which numbers move and which do not.
Same toy model as Chapters 4, 5 and 9: 480 m³, 416 m², α 0.12, 0.45 m² of absorption per person (illustrative), one in four people talking at 60 dB SPL at 1 m, showroom background noise 40 dB SPL. The chamber is idealised: room constant 100,000 m², noise 20 dB SPL, nobody talking. The sums here match the table above for 2 m, 68 dB and 80 people.
Slide the crowd from 10 to 150 and see the voice-to-noise ratio fall, while the RT60 and the DRR get better. Then move the visitor to 0.5 m and raise the robot to 75 dB, to find a setting that holds above zero even at 150 people. That is the kind of trade a room measurement lets you make before the opening day instead of during it.
Follow the babble number by hand. With 80 people, 20 talk at once. Each makes 60 dB SPL at 1 m. In the diffuse field each adds the floor term 16π/R, which is 0.464 for this crowded room, or −3.3 dB. The 20 talkers together give 60 + 10 log10(20 × 0.464) = 60 + 9.7 = 69.7 dB SPL. The empty room’s 40 dB of air-conditioning hum is now 30 dB below the crowd and no longer counts. The voice, at 68 dB SPL at 1 m, reaches the visitor at 68 + 10 log10(1/4 + 0.464) = 66.5 dB SPL. Subtract: 66.54 − 69.68 = −3.14 dB. The voice sits 3 dB under the crowd.
Measure the room at several occupancies, or measure empty and predict the crowd with Sabine (Chapter 4). Treat any EQ you derive as correct for the state of the room you measured. Crowd absorption works mostly on treble, so a crowd takes the top end out of the reverb tail and leaves the bass ringing. Measure the noise floor of the crowded room in dB(A) as well, since that, not RT60, is what the visitor’s hearing fights.
The failure mode in one line. The symptom: “it sounded perfect on setup day.” The measurement: the table above, per band, for empty and full. The fix: tune for the busy room, keep a margin in level, and place the robot and its microphone to keep the direct sound ahead.
Chapter 11
Keep the numbers, steps and sources in one place, and go back to the hero with new eyes
A room is a filter. One click, or better one sweep, measures it. The decay of that response gives the reverberation time, which the room’s size and surfaces predict. Distance decides whether the voice or the room dominates. A gated sweep measures a speaker. EQ, in IIR or FIR form, corrects what you find. Decibels, in SPL, dBFS and LUFS, let you compare it all. And a crowd changes the answer.
| Quantity | Value or rule | Chapter |
|---|---|---|
| Speed of sound in air at 20 °C | 343 m/s | 0 |
| Convolution output length | N + M − 1 samples | 1 |
| Harmonic k appears before the main peak | Δtk = T ln k / ln(ω2/ω1); 1.00 s and 1.59 s for k = 2, 3 in a 10 s, 20 Hz to 20 kHz sweep | 2 |
| Averaging N sweeps, or a sweep N times longer | about 3 dB gain per doubling | 2 |
| RT60 | time for a 60 dB fall; T20 from −5 to −25 dB, T30 from −5 to −35 dB, scaled to 60 dB | 3 |
| Sabine | RT60 = 0.161 V / (Sα) | 4 |
| Eyring | RT60 = 0.161 V / (−S ln(1 − α)) | 4 |
| Direct sound falls with distance | 6 dB per doubling | 5 |
| Critical distance (even source) | dc ≈ 0.057 √(V / RT60) | 5 |
| Window length T resolves | about 1/T hertz | 6 |
| Peaking EQ | A = 10dB/40, α = sin ω0 / 2Q; BW ≈ 1.44 / Q octaves for narrow bands | 7 |
| Linear-phase FIR delay | (N − 1) / 2 samples | 8 |
| dB SPL | 20 log10(p / 20 µPa); 1 Pa = 94 dB | 9 |
| Equal sources add | 10 log10(N); 2 sources +3 dB | 9 |
| MEMS microphone with 120 dB SPL maximum | dBFS = dB SPL − 120; 94 dB SPL reads −26 dBFS | 9 |
| EBU R128 programme loudness | −23 LUFS ± 0.5 LU, peak at most −1 dBTP | 9 |
# Room measurement in 40 lines of NumPy (fs in Hz, f1 and f2 in Hz, T in seconds) import numpy as np def sweep_and_inverse(f1, f2, T, fs): t = np.arange(int(T * fs)) / fs L = np.log(f2 / f1) w1 = 2 * np.pi * f1 x = np.sin(w1 * T / L * (np.exp(t * L / T) - 1)) # shape (T*fs,) inv = x[::-1] * np.exp(-t * L / T)[::-1] # reversed, -6 dB per octave return x, inv def impulse_response(recording, inv, x, fs): n = 1 << int(np.ceil(np.log2(len(recording) + len(inv)))) ir = np.fft.irfft(np.fft.rfft(recording, n) * np.fft.rfft(inv, n), n) k0 = np.max(np.abs(np.fft.irfft(np.fft.rfft(x, n) * np.fft.rfft(inv, n), n))) peak = len(x) - 1 # the linear response starts here return ir / k0, peak # harmonics sit before `peak` def schroeder_db(h): e = np.cumsum((h ** 2)[::-1])[::-1] # energy still to come return 10 * np.log10(e / e[0]) def rt60(h, fs, lo=-5, hi=-25): d = schroeder_db(h); t = np.arange(len(d)) / fs m = (d <= lo) & (d >= hi) slope, _ = np.polyfit(t[m], d[m], 1) # dB per second return -60 / slope def sabine(V, S, alpha): return 0.161 * V / (S * alpha) def peaking_biquad(f0, fs, db, Q): # RBJ Audio EQ Cookbook A = 10 ** (db / 40); w = 2 * np.pi * f0 / fs; al = np.sin(w) / (2 * Q) b = np.array([1 + al * A, -2 * np.cos(w), 1 - al * A]) a = np.array([1 + al / A, -2 * np.cos(w), 1 - al / A]) return b / a[0], a / a[0] # feed to scipy.signal.lfilter
For how a microphone signal becomes features, read Audio Representations. For filters that adapt on their own, such as the echo cancellers that remove a robot’s own voice from its microphone, see EE269: Adaptive Filters. For sampling and the discrete-time basics used here, see EE269: Discrete Signals. For voice in a live loop with a tight delay budget, see Streaming Speech. For how classifiers hear rooms and scenes, see Acoustic Scene Classification.
Every toy number in the devices is labelled illustrative where it is. The occupant absorption of 0.45 m² per person, the 60 dB SPL talker, the 40 dB SPL background and the chamber figures are lesson choices, not measurements from these sources.
Try teaching the sweep back with Teach, and then go back to the hero: add the crowd again and read the numbers with new eyes.