Noise cancellation plays the mirror image of a sound, but the mirror must arrive on time. At 50 µs late it still helps up to about 3 kHz, and above that it makes the noise worse.
Learn how an earbud or a robot cancels a hum, lets a voice through, and keeps its own loop stable, with the real delays and gains that decide each case.
Pick how late the anti-noise arrives, then drag the gain error. Watch where the green region (quieter) turns into the red region (louder). Then we build, piece by piece, the feedforward and feedback loops, the adaptive filter, the transparency mode and the limits that a robot adds.
You need the idea of a sine wave (a smooth wave with a pitch, a height and a position) and a little algebra. We build the rest from zero.
Built from primary sources: Rivera Benois, Nowak and Zölzer on hybrid ANC, Gupta et al. on hear-through (Interspeech 2025) and Valin on noise suppression. Every link is in the Field Guide.
Exact maths for broadband noise with the anti-noise arriving late by the chosen time: the change in level is −20 log10 of the size of 1 − g·e−j2πfτ, where g is the gain and τ the delay. The stops are illustrative: 5 µs is the 3 µs ADC plus 2 µs DAC that Dolphin Semiconductor quotes as an example, and the 150 and 500 µs stops are made-up slower chains. The amber band is the 500 to 700 Hz where Gupta et al. say earbud materials start to block sound passively.
Chapter 0
See why one loud kitchen needs three different tools, and why the size of a sound wave sets the limits
Picture a small robot on a kitchen counter. It has a face, two arms, a speaker and four microphones. The fridge hums. A fan whirs. Someone is talking to it. And every time it turns its head, its own motors whine.
Now picture its owner on a train, wearing earbuds. The engine drones, a stranger laughs, and an announcement comes over the speakers. The problem is the same from the other side. A microphone sits near a noise, and a speaker sits near a listener.
Three different jobs hide in these two scenes. The first is to remove a sound you do not want, like the hum. The second is to keep a sound you do want, like the announcement, even though the earbud blocks the air. The third is to clean up what a microphone hears, so the robot can understand speech over its own motors. This lesson teaches all three, and shows why they need different tools.
To cancel a sound, the device plays its mirror image through a speaker. The two waves meet at the ear and add up to almost nothing. This is active noise cancellation (ANC), and the mirror image is the anti-noise. It works on waves, so it needs the right timing.
To let the world in, the device records the outside sound with a microphone and plays it back inside. This is transparency mode, also called hear-through or ambient mode. It also works on waves, and it too needs the right timing, because the played sound and the leaked sound must line up.
To suppress noise, a program looks at a recording and turns down the parts that look like noise and not speech. This is noise suppression. It works on statistics, not on waves, so it needs no mirror and no timing. It also cannot make a loud sound quiet in the air. Chapter 9 draws that line sharply.
Sound is a wiggle of air pressure that travels. Its frequency is the number of wiggles per second, in hertz (Hz). A fan hum sits near 100 Hz. A hiss sits near 4,000 Hz. In air at room temperature, sound moves at about 343 metres per second.
That speed turns frequency into size. The wavelength is the distance between two wave peaks. It equals the speed divided by the frequency. At 100 Hz it is 343 / 100 = 3.43 m. At 1,000 Hz it is 34.3 cm. At 4,000 Hz it is 8.6 cm.
The same speed turns distance into time. Sound covers 1 cm in 29 µs. It covers 34.3 cm in 1 ms. Keep these two numbers in mind, 29 µs per centimetre and 1 ms per 34 cm, because every latency budget in this lesson is built from them.
Now the key limit. Anti-noise cancels the noise only near the spot where the two waves match, and that spot is small. A common rule of thumb from the ANC literature (Elliott and Nelson) says the zone of quiet is about one tenth of a wavelength wide. The next device draws it. Slide the pitch and watch the green zone shrink against the length of an ear canal.
The warm wave is the noise along 40 cm of air. The green strip is the zone of quiet, one tenth of a wavelength. The pink bracket is an ear canal. Drag the pitch, or press a preset.
Wavelength is exact: 343 m/s divided by the pitch. The one tenth rule is a rule of thumb for roughly 10 dB of quiet, not a sharp edge. The 2.5 cm ear canal is a typical adult value used here as an illustration; real ears differ.
Read the numbers. At 1,000 Hz the zone is 3.4 cm, a little wider than an ear canal. At 1,400 Hz it shrinks to the size of the canal. Above that, the quiet spot is smaller than the place you want it, so cancellation weakens. Below it, the zone grows fast: at 120 Hz it is about 29 cm wide.
This is why earbuds cancel low sounds well and high sounds badly. It is also why the earbud's own body helps. Gupta and colleagues note that the materials of earbuds block sound passively above roughly 500 to 700 Hz. Cancellation covers the low end, the plastic and foam cover the high end, and together they leave a quiet ear. The 1957 Meeker headset, an early working design, cancelled about 20 dB between roughly 50 and 500 Hz.
Back to the counter. The robot's speaker is not at the listener's ear. It is across the room. A zone of quiet 3.4 cm wide at 1 kHz cannot cover a person. So a robot cannot make the room quiet for someone far away. It can quiet the hum near its own microphones, and that is the job that matters for its hearing.
The data flow is the same in both devices. A microphone makes a voltage. An ADC (analog-to-digital converter) turns it into numbers, one sample every 20.8 µs at 48 kHz. A filter makes new numbers. A DAC (digital-to-analog converter) turns them back into a voltage for the speaker. Each stage costs time, and Chapter 2 adds the costs up.
Chapter 1
Add a wave to its mirror image, then measure how close to the mirror you must stay to get 20 dB of quiet
Drop two stones into a still pond at the same moment. Where a crest from one ripple meets a trough from the other, the water stays flat. The two motions add up to nothing. Sound waves do the same thing in air, because air pressure also rises and falls.
This is destructive interference. A speaker can use it on purpose. It plays a wave that is the exact opposite of the noise: high pressure where the noise is low, low where the noise is high. The result at the listener is a flat line.
Engineers name three signals at the ear. Rivera Benois, Nowak and Zölzer use these names, and so do we. d is the disturbance: the noise as it arrives at a small microphone placed at the ear, called the error microphone. y is the anti-noise as the error microphone hears it after it leaves the speaker. e is the residual: what is left, and what the listener hears.
Where does R come from? Draw each wave as an arrow whose length is its size and whose angle is its phase. The noise is an arrow of length 1 pointing right. The anti-noise is an arrow of length g, pointing left but turned by the phase error φ. Adding waves means adding arrows. The squared length of the sum is 1 − 2g cos φ + g2.
Now try it. The device plots one pitch, 1,000 Hz, as noise, anti-noise and residual. Start at the perfect mirror, then break it.
Warm is the noise, teal is the anti-noise, blue is what the ear hears. Drag the phase error and the gain error. Press Perfect mirror to reset.
Exact maths for a single 1,000 Hz tone. At that pitch 1 degree of phase equals 2.78 µs of timing. The wave heights are in arbitrary units, scaled so the largest wave fits.
Use 1,000 Hz, a gain 1 dB too high, and a phase error of 10 degrees. First turn the gain into a plain number: g = 101/20 = 1.122. Then cos 10° = 0.9848. Now put them into the formula.
R² = 1 + 1.122² − 2 × 1.122 × 0.9848 = 1 + 1.259 − 2.210 = 0.049, so R = 0.221
A size of 0.221 is a depth of −20 log10(0.221) = 13.1 dB. The listener hears about a fifth of the noise amplitude. A perfect gain with the same 10 degrees gives 15.2 dB. A perfect phase with the same 1 dB of gain gives 18.3 dB. So small mismatches in either one cap the quiet at ten-odd dB.
A real controller never sees a wave. It sees numbers. The microphone makes a voltage, and the ADC turns it into one number every 20.8 µs at 48 kHz. Each number is a snapshot of air pressure. To make anti-noise, the controller flips the sign of each snapshot, scales it by the gain g, and hands it to the DAC. So the whole of Chapter 1 reduces to one multiplication by −g.
The hard part is not the sign. It is the timing of that multiplication, and the match of g. A flip is exact in the numbers. It becomes inexact only in the air, where the speaker, the ear canal and the time of travel all bend it. Every later chapter is a way to cope with that bending.
Set the gain to be perfect and let only the phase err. For small errors, R is close to φ measured in radians (one radian is 57.3 degrees). The table below follows from that. Each extra 10 dB of quiet needs a phase error about 3.2 times smaller.
| Quiet wanted | Residual size R | Phase error allowed | Timing error at 1 kHz | Timing error at 100 Hz |
|---|---|---|---|---|
| 20 dB | 0.1 | 5.7° | 16 µs | 159 µs |
| 30 dB | 0.032 | 1.8° | 5 µs | 50 µs |
| 40 dB | 0.01 | 0.57° | 1.6 µs | 16 µs |
This table explains the hero. A fixed delay is a different phase error at every pitch. The error grows in step with pitch, so the same 50 µs that is harmless at 100 Hz (1.8 degrees) is 18 degrees at 1 kHz and 180 degrees, a perfect wrong answer, at 10 kHz. Cancellation is a low-pitch tool because time is cheap there.
A tester wears the earbuds and says the hum is gone, but now there is a faint whoosh. The measurement is a spectrum at the error microphone with ANC on and off. It shows a dip below 300 Hz and a bump near 3 kHz. The cause is delay. The fix is not a louder anti-noise. It is less delay, or a filter that stops cancelling above the pitch where the phase error passes 60 degrees. Chapter 2 builds the delay budget, and Chapter 4 shows what limits the bump from the feedback side.
Chapter 2
Listen to the noise before it reaches the ear, then add up the microseconds that decide whether the anti-noise arrives first
You stand at a bus stop and hear a truck far down the road. You know it will pass you in a few seconds. That head start lets you cover your ears in time. A noise canceller wants the same thing: a warning before the noise arrives.
In feedforward ANC the warning comes from a reference microphone on the outside of the earbud or earcup. It hears the noise a little earlier than the ear does. The controller uses that sample to build the anti-noise. Dolphin Semiconductor describes it in one line: feedforward microphones sit outside the earbuds, and pick up sound before it reaches the ear.
Two physical paths matter. The primary path P is everything the noise passes through on its way from the reference microphone to the error microphone: air, the earbud body, leaks. The secondary path S is everything the anti-noise passes through: the speaker, the air in front of it, the error microphone. Rivera Benois, Nowak and Zölzer define both this way.
The controller is a filter W. It takes the reference sample x and makes the control signal. The noise at the ear is d = P · x. The anti-noise at the ear is y = S · W · x. We want y to be the mirror of d. So S · W must equal P, and the best filter is the one the paper gives:
In words: copy what the noise will do, and undo what the speaker path will do to your copy. Notice what W must know. It must know both P and S, and it must know them well, because Chapter 1 showed that a few degrees of error cost you ten dB.
W has a hidden rule. It must be causal: its output at one moment can depend only on samples that have already arrived. Look at the delays. P contains the acoustic head start, the time the noise needs to travel from the reference microphone to the ear. S contains the electrical delay plus the acoustic delay from the driver to the error microphone. The ratio P / S then holds a delay equal to P's delay minus S's delay.
If P's delay is larger, W is a normal delayed filter and everything works. If S's delay is larger, W would have to answer before it hears the question. It must predict. A tone or a steady hum is easy to predict. A clap or a voice is not. Late anti-noise therefore fails first on sudden, wideband sounds.
Count the delays. Sound travels 1 cm in 29 µs, so an earbud whose reference microphone sits 2 cm from the ear gives a head start of 58 µs. The costs are the converters (Dolphin quotes 3 µs for the ADC and 2 µs for the DAC as an example), the filter itself, and the 1 to 3 cm from the speaker to the error microphone. The next device adds them up.
Top bar: the noise travels from the reference microphone to the ear. Bottom bars: the anti-noise chain. If the bottom bar is longer, the anti-noise arrives late. Press a preset, then change the delays.
Air travel is exact at 343 m/s, 29.15 µs per cm. The distances and the filter delay are illustrative; the ADC plus DAC default of 5 µs is the 3 µs and 2 µs example from Dolphin Semiconductor. The pitch limits use the Chapter 1 results: 20 dB needs a phase error under 5.7 degrees, and the anti-noise stops helping at 60 degrees.
On the earbud preset the head start is 58 µs and the chain needs 69 µs. It is about 10 µs late. The device then tells you the highest pitch that still gets 20 dB, which is 5.7 degrees of phase: 5.7 / 360 / 10.4 µs = about 1,500 Hz. That is a real design answer. A small earbud has little room, so every microsecond counts.
Now press the over-ear preset. The reference microphone sits 8 cm from the ear, which is 233 µs of head start. The chain needs about 108 µs. The anti-noise arrives with about 125 µs to spare. That spare time is not wasted. The filter W can use it to be a longer, more accurate filter.
There is a second limit, and it has nothing to do with time. The controller sees only the reference microphone. It can cancel only the part of the noise that the reference microphone also heard. Rivera Benois and colleagues state the consequence: only disturbances correlated with the reference can be attenuated, so the best result is capped by the cross-correlation between x and d. A gust of wind that hits the ear but not the outside microphone cannot be cancelled by feedforward.
Failure mode, with the usual steps. Symptom: the hum is quiet, but a door slam comes through almost untouched. Measurement: record the reference and error microphones together and check whether the slam is in both and whether the chain is late. Fix: move the reference microphone farther out for more head start, shorten the chain, or add a feedback loop for what the reference misses. The next chapters build the second and third of these fixes.
Chapter 3
Run the real adaptive filter in your browser and find the step size where it learns fast without blowing up
Chapter 2 said the best filter is W = P / S. But nobody knows P exactly. Every ear is different. An earbud that sits well in the morning leaks after a smile or a bite of lunch. The filter cannot be fixed at the factory. It must learn, and keep learning, from the one thing it can always measure: the error microphone.
The learning rule is old and simple. The LMS algorithm (least mean squares) is Widrow’s method, and he and his colleagues used it for noise cancelling in 1975. Think of a mixing desk with 16 knobs. The sound at your ear is too loud. You nudge each knob a tiny bit in the direction that makes it quieter, and you repeat this thousands of times a second.
The controller W is an FIR filter (finite impulse response). It keeps the last L reference samples in a list and takes a weighted sum. Here L = 16. So the input is a list x of 16 numbers, the knobs are a list w of 16 numbers called the weights, and the output is one number.
python y = sum(w[k] * x[k] for k in range(16)) # one output sample; w and x each have shape (16,)
At 8,000 samples per second this runs once every 125 µs. On a real earbud it runs at 48,000 samples per second, once every 20.8 µs. The output y goes to the speaker, and the error microphone reports back one number e.
Here is the catch. When you turn knob k, the effect does not reach the error microphone at once. It first passes through the speaker path S, which delays and reshapes it. If you blame the error you hear now on the knob positions you chose just now, you blame the wrong knobs.
The fix is to carry the same delay and reshaping into the blame. Pass the reference x through a copy of the speaker path, call it S-hat (Š), and get a new signal x′. Then use x′ to blame knobs. This is the filtered-x trick, and it gives FxLMS. Gupta and colleagues write the update as the same line you see here.
A one-knob example shows the sign. Let w = 0 and x′ = 1. The error is e = 0.5, so the ear hears a positive push. With μ = 0.1 the new weight is 0 − 0.1 × 0.5 × 1 = −0.05. The weight turned negative. Next time the speaker plays a small flipped copy of x, which is exactly an anti-noise. The error shrinks, so the nudges shrink. When e reaches zero the filter stops moving.
The simulation below does this for real. A hum at 180 Hz plus a hiss reaches the reference microphone. A made-up primary path P delays it by 4 to 6 samples. A made-up secondary path S delays the anti-noise by about 2 samples. The filter starts at zero and knows nothing. It uses a normalised step, which divides μ by the power of x′ so the setting does not depend on how loud the room is.
The line shows how much quieter the ear is than with ANC off, in dB, over the last 3 seconds. Change the step size, change the noise, and break the S-hat estimate.
This is a real FxLMS loop with 16 weights at 8,000 samples per second, running about twice as fast as real time. The paths P and S are invented short filters, the noise is a sine plus filtered random noise, and the numbers vary a little with the random draw. The normalised step is an NLMS-style choice, so the stable range here is not the same as for a plain fixed step.
At the default step of 0.10 with an exact Š, the ear is about 24 dB quieter after the first tenth of a second and about 30 dB quieter after one second. Press Change the noise: the hum jumps to 260 Hz, the quiet dips for a moment and returns. That return is tracking. A fixed filter cannot do it.
Now raise the step toward 0.3. With the exact Š, the filter still converges, faster. Switch to Š one sample late and the same step makes the loop blow up in about a tenth of a second. A small error in Š narrowed the safe range of μ. Switch to a flipped Š and nothing is safe: the filter pushes the weights the wrong way at every step, and the error grows at any step size.
The textbook rule behind this is that FxLMS converges only while the phase error of Š stays under 90 degrees at the frequencies present in the noise. The flipped Š has 180 degrees at every pitch. The late one has 8 degrees at 180 Hz, which is fine.
Symptom: a user hears the hum fade, then a rising howl after a few seconds. Measurement: log the largest weight and the error power. Both climb without limit. Fix: lower μ, re-measure S at start-up so Š matches the speaker and seal in use, and add a small leakage term so the weights decay a little each step. Real products clamp the output as a last guard.
Chapter 4
Close a loop around the error microphone, then find how much gain and delay it can take before it squeals
You adjust a shower with your hand under the water. Too hot, so you turn the tap toward cold. The pipe is long, so nothing changes for two seconds. You turn more. Then the cold wave arrives, and you turn back too far. You swing between scalding and icy. Delay inside a loop makes it overshoot.
That story is feedback ANC. The microphone sits inside the earcup, at the ear. It hears what is left, the residual e. The controller reads that residual and drives the speaker to reduce it. Dolphin Semiconductor puts it plainly: feedback uses microphones inside the earbuds, which detect sound that has already reached the ear.
This brings two gifts. There is no reference microphone to place. And the loop corrects itself: if the seal changes or the speaker ages, the error shows it. It costs one big risk, which is the shower. A loop with delay can swing.
Rivera Benois and colleagues call this the minimum variance structure. The controller W reads e and drives the speaker through the secondary path S. The signals at the ear obey one short equation.
Read it like this. Where L is big, say 9, the sensitivity is 1 / 10, so the noise drops by 20 dB. Where L is near 0, the sensitivity is 1, so nothing changes. So far it sounds easy: make L big everywhere.
L is a complex number: it has a size and a phase. Delay turns the phase. A delay τ adds a phase lag of 360 × f × τ degrees. The speaker and microphone also lag at high pitch. Somewhere the lag reaches 180 degrees. There the controller's correction, which was meant to oppose the error, now pushes the same way as the error.
If the loop gain at that pitch is below 1, the swing dies out. If it is 1 or more, the swing grows into a squeal. The gap, in dB, between the loop gain at that pitch and 1 is the gain margin. A positive margin means stable. Engineers want several dB at least, because real ears and seals change L.
There is a second price, the waterbed effect. A result by Bode says that for a loop that rolls off fast enough, the area where sensitivity is below 1 (quieter) must be paid back by an equal area where it is above 1 (louder). Push the water down in one place, and it rises in another. Feedback ANC is quiet at low pitch and slightly noisy near the top of its band.
Rivera Benois and colleagues note why early designs used analog circuits: the reachable bandwidth is limited by the delays inside the loop, and analog avoids the converter delays. Dolphin Semiconductor makes the same point: in feedback systems, too much latency makes the closed loop unstable.
The green region is quieter, the red region is louder. Raise the loop gain or the delay and watch the red bump grow and move down in pitch until the loop is unstable.
Illustrative loop: L is the gain K, a delay, a controller pole at 500 Hz and a driver pole at 4 kHz. The maths is exact for that loop: the plotted value is 20 log10 of |1 + L|, and the margin is read at the pitch where the phase reaches 180 degrees. The +8 dB for a hand over the earbud is an illustration of a seal change that raises the loop gain, not a measured value.
At the default, 16 dB of loop gain gives 20 log10(1 + 6.3) = 17.3 dB of quiet at low pitch. The phase hits 180 degrees at about 5.6 kHz, where the loop gain is 9.8 dB below 1. The loop is stable with 9.8 dB to spare. The price is a bump: between about 2.3 kHz and 14.7 kHz the noise gets louder (the plot ends at 8 kHz), by up to 5.4 dB near 3.9 kHz.
Now triple the delay to 60 µs. The 180-degree pitch drops, the margin shrinks, and the red bump becomes taller. At 50 µs the margin is only 2.7 dB. This is the trade the hero showed from another angle: delay is the budget, and feedback spends it as stability.
Press the hand button. A hand over an earbud changes the acoustic seal, and it raises the loop gain. At the default delay the margin falls from 9.8 to 1.8 dB. At 20 dB of base gain the same hand makes the loop unstable. That is the squeal people hear when they cup a hand over noise-cancelling headphones.
Symptom: a steady whistle when the user touches the earbud. Measurement: sweep a test tone through the loop and record the loop gain; the gain margin has fallen below 3 dB or gone negative. Fix: lower the gain, move the roll-off lower in pitch, shrink the delay, or let a monitor switch ANC off when it hears the loop ring.
Chapter 5
Combine the loop that looks ahead with the loop that looks back, and check what each one does to the other
On a rainy walk you want an umbrella and a raincoat. The umbrella stops most of the rain before it reaches you. It needs you to see the rain coming and hold it in the right place. The raincoat catches what slips through, and it works without any help from you.
Feedforward is the umbrella. It has a reference microphone and a head start, so it can cancel broadband noise, but only the noise it can see, and only if its model of the paths is right. Feedback is the raincoat. It cancels whatever is left at the ear, even a gust the outside microphone missed, but it can only react, and delay limits it.
A hybrid ANC system uses both. Rivera Benois, Nowak and Zölzer give the reason in one sentence: the classical feedforward and feedback structures can be combined in pairs, to partially compensate for their individual limitations, and the extra complexity pays for itself in flexibility and attenuation.
Both controllers write to the same speaker and read the same error microphone. That sharing is the trap. When the feedback loop is closed, it changes what the feedforward filter sees. Work it out. Let u be the feedforward output, d the noise at the ear, and Wb the feedback controller. The speaker plays u plus the feedback signal −Wb · e. The ear hears:
Two facts follow. First, the feedforward filter now sees a different secondary path, S / (1 + S·Wb). The S-hat in its FxLMS update must model that, not the bare speaker, or Chapter 3's 90 degree rule can break. Second, the noise it must cancel is already shaped by the feedback loop, so the best feedforward filter changes too.
The overview paper lists six ways to pair the classical structures. It sorts every pair into two kinds: one where the controllers have independent best answers, and one where each depends on the other. The independent kind is easier to tune and to trust. The dependent kind can squeeze out more, at the cost of a harder design. One of the pairs joins the minimum variance loop of Chapter 4 with an internal model loop. That second loop uses S-hat to estimate the noise at the ear by subtracting the controller's own contribution from e. If S-hat equals S, it behaves like a feedforward controller.
In the best case the two parts cover different pitches and different noises. Feedforward takes the broad band where its head start pays. Feedback takes the low pitch, the steady tones, and the changes in fit. Try it below. The device adds the two effects in dB, which is the independent case.
Dashed teal is feedforward alone. Dotted teal is feedback alone. The blue area is what the ear hears with the parts you switch on. Move the two sliders and switch parts on and off.
Illustrative and independent: the blue curve is simply the feedforward dB plus the feedback dB, which holds only for a decoupled design. Feedforward uses the Chapter 1 formula with a 1 dB gain error and a timing error of the chosen lateness plus 5 µs of path-model error. Feedback is the Chapter 4 loop with 20 µs of delay.
At the defaults, feedforward alone gives about 18 dB at 100 Hz, and feedback alone gives about 14 dB there. Together they reach about 32 dB. At 1 kHz feedforward gives 16 dB and feedback only 6 dB. At 3 kHz feedforward helps less, 10 dB, because of its 15 µs timing error, and feedback has turned into a bump of 3 dB of extra noise. So the stack is deeper at low pitch, and a little worse than feedforward alone at 3 kHz.
Now raise the feedback gain to 26 dB. The device warns that the loop is unstable. This is the hybrid's real limit: the extra depth at low pitch is paid for in stability margin. Set the lateness to 100 µs instead. Feedforward falls to 3 dB at 1 kHz and turns into extra noise at 3 kHz, while feedback still gives its 14 dB at 100 Hz. Late feedforward is a low-pitch tool only.
This also sets the order of the design work. First choose the feedback loop and check its margin, since an unstable loop ruins everything else. Then measure the effective path with that loop closed. Only then adapt the feedforward filter on top. Doing it the other way round means tuning the filter on a path that is about to change.
Symptom: with only feedforward the hum drops by 25 dB. With both on, the result at 2 to 4 kHz is worse than with feedforward alone. Measurement: record e with each part on and off, and compare spectra; also measure the path from the feedforward output to e with the feedback loop closed. Fix: roll the feedback loop off lower in pitch so its bump falls outside the feedforward band, and re-measure S-hat with the feedback loop closed.
Chapter 6
Rebuild the sound of an open ear from a microphone and a speaker, and see why one fixed filter cannot fit every ear
You wait at a crossing with earbuds in. A bike bell rings behind you. With the earbuds off, you would hear it clearly. With them in, the bell is dull, because the foam and plastic block the high pitches. You need the bell. You also want your music. You press the transparency button.
Hear-through (HT), also called transparency or ambient mode, makes the earbud acoustically invisible. Gupta, Karthik and Palanivel state the goal in their 2025 Interspeech paper: let the user have a listening experience over earbuds that is perceptually similar to the open ear, with full environmental awareness.
Look at the parts. A microphone faces the outside, the same reference microphone that feedforward ANC uses. Its samples go through an HT equalizer, a filter that reshapes the spectrum. The result is a pseudo-ambient signal that the speaker plays into the ear. Gupta and colleagues describe how it combines with the sound that leaks through the earbud by passive isolation, and the sum is what the user hears.
Note the surprising part. Hear-through uses the same microphones, the same converters and the same speaker as ANC. It simply runs the opposite policy. ANC plays the mirror image of the outside sound. HT plays a corrected copy of it.
What should the corrected copy be? The answer is the sound you would hear with no earbud at all, measured at the eardrum. The paper says materials in earbuds attenuate sound passively above roughly 500 to 700 Hz. So the HT filter has to fill in what the plastic removes. Where the earbud already lets sound leak in, below that range, the filter should add little. Where it blocks well, the filter should add almost the whole sound back.
That gives a simple recipe. If the leak at some pitch has amplitude L (a number between 0 and 1), the filter must supply 1 − L. Take a good seal that blocks 30 dB at high pitch. Then L = 10−30/20 = 0.032, and the filter supplies 0.968. At low pitch the earbud blocks almost nothing, so L is near 1 and the filter supplies almost nothing. The sum of leak and filter is 1 at every pitch: flat, as if nothing were in the ear.
L is not a constant of the earbud. It depends on the person. A tip that seals well in one ear leaks in another. The paper points out that fixed HT filters can mismatch the modelled open ear response for different users and different fittings of the same user. Adaptive FIR filters fix the mismatch, at the price of more computation, more memory and more delay. The authors propose an adaptive IIR (recursive) filter with a virtual sensing model of the ear canal. It cuts the computation by 34 percent and, they report, improves the result by up to 10 dB in changing scenes, with stability checked by design.
The next device shows the problem. The filter is tuned for a good seal. Switch the ear to a loose fit and watch what the old filter does.
The grey line is the level with the open ear: 0 dB. The blue line is what the user hears. First leave hear-through off, then turn it on, then change the fit.
Illustrative: the passive loss is made up, 30 dB at high pitch for a good seal and 20 dB, starting higher in pitch, for a loose fit, rising from near 0 dB at low pitch. The filter supplies 1 minus the good-seal leak. The sum ignores timing, which Chapter 7 adds. The 500 to 700 Hz amber band is the start of passive loss that Gupta et al. report.
Set the gain to 0. This is a closed earbud. The curve falls from 0 dB at low pitch to about −30 dB at high pitch, and you cannot hear the bell. Set it to 100 percent with a good seal: the curve lies on 0 dB. The earbud has become invisible.
Now press Loose fit with the gain at 100. More sound leaks through the gap, and the filter adds its full amount on top. Near 500 Hz the user hears 3.3 dB too much. At 200 Hz the error is 1.8 dB, and at 4 kHz it is 0.7 dB. The old filter was right for the old ear. This is why serious designs measure the leak while the product is in use, and adapt.
Real tuning has one more problem: the filter must also match the shape that the ear canal and outer ear give to sound at the eardrum. That is a measured target (an open-ear response), not a flat line. The paper measures near the eardrum, with a model of the canal, because the error microphone inside the earbud sits in the wrong place.
Symptom: with transparency on, the street sounds thin and hissy, and voices have a ringing edge. Measurement: put the earbud on a test head, play a sweep from outside, and compare the response at the eardrum point to the open ear. Fix: re-tune the target shape, trim the gain where the leak is large, and adapt the filter to the real fit. The next chapter adds the second half of the problem, the timing of the two copies of the sound.
Chapter 7
Add two copies of one sound with a small gap between them, and see why late hear-through sounds hollow
You talk into a long tube, a cardboard roll, and your voice comes back a little late. The sound is hollow, like a voice in a bathroom. The room is not the cause. The cause is that two copies of the same sound reach your ear, one a moment after the other.
Hear-through has exactly this problem. One copy of the outside sound leaks straight through the earbud with no delay. The other copy goes through the microphone, the filter, the converters and the speaker, and it arrives later. Gupta and colleagues warn that large processing delays can lead to an unnatural hear-through experience and comb-filtering effects. This chapter shows what the comb is and how to flatten it.
Take one pitch f. The leaked copy is a wave of size L. The processed copy is a wave of size 1, shifted in time by the delay τ. A delay of τ shifts the phase by 360 × f × τ degrees. The two waves add as arrows, as in Chapter 1, and the sum has a size that depends on f.
Look at the extremes. When the phase shift is a whole turn (360 degrees), the two arrows point the same way and the size is 1 + L: a peak. When the shift is half a turn (180 degrees), they point opposite ways and the size is 1 − L: a notch. Peaks come at f = 0, 1/τ, 2/τ, and notches come between them at f = 1/(2τ), 3/(2τ), 5/(2τ). The pattern looks like the teeth of a comb, so engineers call it comb filtering.
A worked case. Let τ = 1 ms and L = 1. The first notch is at 1 / (2 × 0.001) = 500 Hz. The next ones are at 1,500 and 2,500 Hz. With L = 1, 1 − L = 0, so each notch is a total hole. Speech lives from about 100 Hz to a few kHz, so a 1 ms delay puts several holes right in the middle of the voice. That is the hollow sound.
Now cut the delay to 100 µs. The first notch moves to 5,000 Hz. Almost all of the voice sits below it. The sound is natural. The lesson is short: the first notch is at 1/(2τ), so every microsecond saved moves it up. Sample counting helps: at 48 kHz one sample lasts 20.8 µs, so a block of 48 samples is 1 ms, and a block of 5 samples is 104 µs.
The blue line is the level the ear hears, compared with the processed copy alone. Choose a delay, then raise the leak reduction (for example by turning ANC on). Watch the teeth shrink.
Exact maths for two copies of equal-shaped sound, one delayed and one not, with the leak a flat number of dB below the processed copy. Real leaks change with pitch and with the fit, and real ears add phase of their own, so the real comb is less regular. Sample counts assume 48 kHz.
The formula shows three levers. The first is less delay: low-cost filters with few steps, and short blocks. Gupta and colleagues build their adaptive filter for this reason, since they note that low processing delay and low computation go together.
The second lever is a smaller leak. If the leak L falls, the notch 1 − L gets shallower. Move the slider to 20 dB. L = 0.1, so the notches are 20 log10(0.9) = −0.9 dB deep and the peaks are 20 log10(1.1) = +0.8 dB tall. The whole comb spans under 2 dB, which most listeners would not notice. A design idea that follows from the formula, not a claim from a source here: run feedforward ANC while in transparency mode, so the leak turns down and the delayed copy dominates. It would cost battery and add the ANC loop's own latency.
The third lever is a different design: Gupta and colleagues pick an adaptive IIR filter, which needs less computation than an adaptive FIR filter, so a short chain costs less processing.
A product team does not tune by ear alone. It changes one knob at a time and measures on a test head. This table lists the common symptoms, how to measure each, and what to turn.
| Symptom | Measure | Likely cause | Fix |
|---|---|---|---|
| Hollow, tunnel voice | Sweep at the eardrum point; look for notches at 1/(2τ) | Delay too long with a strong leak | Shorten the chain, or reduce the leak |
| Thin, bright world | Compare to the open-ear response | Filter ignores the ear canal colour | Re-fit the target curve |
| Too much bass on some people | Repeat on a loose fit | Fixed filter plus a bigger leak (Chapter 6) | Adapt to the fit |
| Steady hiss | Record in a silent box with the filter on | The microphone's own noise, raised by the filter gain | Cap the gain where the leak is already high |
Symptom: your own voice sounds like a tunnel when transparency is on. Measurement: the spectrum of your voice at the ear, with and without hear-through, shows regular dips. The spacing between dips is 1/τ, so the spacing gives you the delay: dips every 1,000 Hz mean a delay of 1 ms. Fix: shorten the path first. Only after that reach for EQ, since EQ cannot fill a hole made by cancellation.
Chapter 8
Sort six robot noises by the tool that fits, and see which hearable tricks transfer and which do not
Back to the counter. The robot has four microphones in its head, a speaker in its chest and motors in its neck. A man asks it for a recipe while the fan runs. The robot answers, and its own voice bounces off the wall back into its microphones. Four different noises hit one pair of ears, and the earbud's toolbox fits some of them and not others.
The way to carry a design across is to swap part for part. Every earbud part has a robot partner, and every partner has a new budget. The table lists them.
| Earbud part | Robot partner | What changes |
|---|---|---|
| Reference microphone | Motor current, joint speed, a fan tachometer, or the audio the robot is about to play | The reference is electrical, so it arrives before the sound, with a head start of its own |
| Error microphone at the ear | The robot's own microphones | The quiet spot is at the microphones, not at a listener's ear |
| Secondary path S | The path from the robot's speaker to its microphones | The same filter-learning problem, with the same stability rules |
| Latency budget, tens of µs | Frame budget, tens of ms | Software cancelling works on a recording, so the delay can be 200 times longer |
| Zone of quiet, 3 cm at 1 kHz | Not available at a distance | A robot cannot hush a room for a person across it |
Widrow and colleagues showed in 1975 that an adaptive filter can remove noise from a signal if it gets a second input that is correlated with the noise but not with the signal. This is Chapter 3 without the speaker. The filter learns the path from the reference to the noise in the recording, and subtracts a copy. Nothing is played into the air.
Two robot problems have exactly this shape. The first is acoustic echo cancellation (AEC). The reference is the signal the robot sends to its speaker. The filter learns the room path from speaker to microphone, and subtracts the echo from what the microphones hear. The second is ego-noise: the robot's own motors. Ince, Nakadai and colleagues predict the motor noise from each joint's position, speed and acceleration, find the stored noise template with the most similar joint state, and subtract it.
The scales differ. Air cancellation needs microseconds because the anti-noise must land on the noise. A recording-side subtraction only needs the estimate to be right, and a frame of 20 ms is fine. Valin's noise suppressor, for example, works on 20 ms windows that overlap by half, with a 10 ms offset. That is 200 times the 100 µs of the hero. For a robot that talks, 20 ms is invisible. For air cancellation it would be fatal.
The zone of quiet does not scale up. At 100 Hz it is about 34 cm, enough to cover the cluster of microphones. At 1 kHz it is 3.4 cm, enough for one microphone. It will never cover a person on the sofa. A robot that wants a quiet room has to make less noise itself, damp its fan and shape its voice, because it cannot cancel sound across a room.
Hear-through carries over as an idea, not as a filter. A robot has no earbud that blocks the world. Its job is the opposite: make sure its own speech is clear in the room. A design idea, not from a source here, is to measure the room noise and lift its speech where the noise would mask it. That is transparency run backwards: keep the room audible to the user while the robot talks.
A robot head has more microphones than an earbud, and it can space them wider. Suppose two microphones sit 6 cm apart. A voice from the side reaches one microphone later than the other, by at most 6 cm × 29 µs per cm = 175 µs. A delay-and-sum beamformer delays one channel by that amount and adds the two. The voice from that direction adds up. Voices from other directions do not line up, so they add up less.
There is a limit. When the pitch is so high that half a wavelength is shorter than the spacing, the microphones cannot tell directions apart. For 6 cm that pitch is 343 / (2 × 0.06) = 2.86 kHz. Above it the beam grows false copies of itself, called spatial aliasing. So an array separates the low and mid pitches of speech well and the high ones less well.
Read the noise, then pick one of the five tools. You see the verdict at once, with the reason. Six noises in all.
The verdicts are engineering judgements from the physics in this lesson (zone of quiet, causality, reference signals), with the reasons shown. They are not measurements from a product.
Symptom: the robot answers, then hears its own answer, treats it as the next question, and replies to itself. Measurement: play a known sentence, record the microphones, and compute the ERLE (echo return loss enhancement): the dB by which the canceller cuts the echo. Fix: give the canceller the exact signal sent to the speaker as its reference, let it adapt only while the robot is speaking and the user is silent, and freeze it when both talk at once, so the user's voice is not learned as an echo.
Chapter 9
Compare quieting the air with cleaning a recording, and see why they fail in different ways
Two people share a noisy cafe. One wears noise-cancelling earbuds. The room feels calmer to her. The other makes a phone call. His friend hears a clean voice and no cafe. Both of them say "noise reduction". But the cafe is exactly as loud as before for everyone else, and the friend's room is as noisy as ever. The two tools do different jobs.
Cancellation changes the sound in the air at one spot. Suppression changes a recording. If you only remember one line from this lesson, remember that line.
A noise suppressor takes a recording and cuts the parts that look like noise. Valin’s RNNoise is a clear example. It takes the signal at 48 kHz in windows of 20 ms, which overlap by half, so a new window starts every 10 ms. Each window is 960 samples. The program turns each window into a spectrum, groups the spectrum into 22 bands on the Bark scale (bands that are narrow at low pitch and wide at high pitch, as the ear hears them), and asks a small recurrent neural network one question per band.
The question is: how much of this band is speech? The answer is a gain between 0 and 1. A gain of 1 keeps the band. A gain of 0 removes it. The ideal gain for a band b is the square root of the speech energy divided by the energy of the noisy input.
A worked band. Suppose the speech in a band holds 100 units of energy and the noisy input holds 400. Then g = √(100 / 400) = 0.5. The band amplitude is halved, which is −6 dB. A band with no speech gets g near 0. A band that is all speech gets g near 1.
One more trick fixes a problem with wide bands. Inside a band, a speaker’s voice has sharp peaks at the multiples of the pitch, and valleys in between where noise sits. A band gain cannot reach into the valleys. So RNNoise adds a pitch filter, a comb filter at the pitch period that attenuates the noise between the harmonics, the same comb you met in Chapter 7, used on purpose. Valin reports a total of around 40 Mflops (millions of operations per second) for one channel, which is low enough for a small processor.
| Cancellation (ANC) | Suppression | |
|---|---|---|
| Acts on | Sound in the air at one spot | A recorded signal |
| Needs | A reference and microsecond timing | Nothing but the recording (and training data) |
| Delay | Tens of µs | 10 to 20 ms per window |
| Works best on | Steady low pitches | Steady noise against clear speech |
| Cannot tell | Noise from a voice you want | Speech from noise that looks like speech |
| Fails as | Whoosh, squeal, hollow comb | Warbling, clipped words |
Try both on the same scene. The device builds a made-up room: a voice with harmonics, and a low hum with a hiss. Switch between modes and look at the numbers.
Pink is the voice, warm is the noise. Dashed lines are before, solid lines are after. Pick a tool, then raise the noise.
Toy scene, not measured: the voice has a 150 Hz pitch with harmonics and falls off above 500 Hz; the noise is a steep low hum plus a flat hiss. Suppression uses a simple per-band gain, the speech share of the input power, with a floor you set, plus an optional pitch filter that cuts only the noise between the harmonics. It is a stand-in for what a trained network estimates, not RNNoise itself. Cancellation uses the Chapter 1 formula with 1 dB of gain error and 15 µs of timing error, applied to everything that reaches the reference microphone.
In Cancel in the air mode the voice falls too. Anti-noise cannot tell which sounds you want, so everything that reached the reference microphone is cancelled, voice included. The loudness at the ear falls a lot, but the voice and the noise fall together, so the ratio between them changes little. That is why a hearable needs a hear-through mode next to its cancel mode.
In Suppress in the recording mode the loudness in the air does not change: 0 dB, because nothing is played. The recording improves. The bands where noise dominates, the low ones, shrink most, and the voice survives in the bands where it is strong. Lower the gain floor and the voice starts to lose energy too: the price of cleaner noise is a damaged voice.
In a robot that listens and talks, the tools run in a fixed order. First the echo canceller removes the robot’s own voice, because it needs the clean microphone signals that match its speaker reference. Then the array points a beam at the talker. Then the suppressor cleans the hiss. Last comes the speech recogniser. The suppressor goes late because it is not a straight line. It changes the signal in ways that would confuse an echo canceller placed after it.
Symptom: the cleaned voice warbles, and the ends of words are clipped. Measurement: compare the speech energy before and after in each band, and run the speech recogniser on both recordings. Fix: raise the gain floor so no band is cut to zero, smooth the gains over time, and choose the tool by the listener. A person on the call prefers a softer cut. A speech recogniser may prefer a harder one.
Chapter 10
Review the numbers, the terms and the core code, then follow the sources further
You can now follow a sound from a noisy room to a quiet ear, and from a recording to a clean voice. Anti-noise is the mirror of the noise, and it must arrive within a few degrees of phase. Feedforward looks ahead and races against time. Feedback looks back and risks a squeal. An adaptive filter tunes either one. Hear-through rebuilds the open ear, and delay turns it hollow. Suppression cleans a recording and cannot quiet the air. Here is everything in one place.
| Quantity | Value | Where it comes from |
|---|---|---|
| Speed of sound in air | 343 m/s, so 29 µs per cm and 34.3 cm per ms | Physics, room temperature |
| Zone of quiet | About one tenth of a wavelength: 3.4 cm at 1 kHz, 34 cm at 100 Hz | Rule of thumb, Elliott and Nelson |
| Phase error for 20, 30, 40 dB | 5.7, 1.8, 0.57 degrees (perfect gain) | Chapter 1 formula |
| Where anti-noise stops helping | Phase error of 60 degrees: f = 1 / (6τ) for a perfect gain | Chapter 1 formula |
| Optimal feedforward filter | W = P / S | Rivera Benois et al. |
| Feedback residual | E / D = 1 / (1 + S·W) | Rivera Benois et al. |
| Example converter delays | ADC 3 µs, DAC 2 µs | Dolphin Semiconductor (example) |
| Passive loss of earbud materials | Starts above roughly 500 to 700 Hz | Gupta et al., Interspeech 2025 |
| Adaptive IIR hear-through | 34% less computation, up to 10 dB better in changing scenes | Gupta et al., Interspeech 2025 |
| First comb notch | f = 1 / (2τ): 500 Hz at 1 ms, 5 kHz at 100 µs | Chapter 7 formula |
| RNNoise window | 20 ms, 10 ms offset, 22 bands, about 40 Mflops | Valin 2018 |
| Early working headset | About 20 dB between about 50 and 500 Hz (1957) | Active noise control (Wikipedia) |
| Term | Meaning |
|---|---|
| Anti-noise | A sound played to cancel another by destructive interference. |
| Primary path P | How noise changes from the reference microphone to the ear. |
| Secondary path S | How the controller output changes on its way to the error microphone. |
| FxLMS | An adaptive filter that blames each weight using the reference filtered through an estimate of S. |
| Gain margin | How many dB the loop gain sits below 1 where the phase reaches 180 degrees. |
| Waterbed effect | Quiet in one band is paid for by extra noise in another. |
| Hear-through | A processed copy of outside sound, played so the earbud matches the open ear. |
| Comb filtering | Regular dips and peaks from adding a signal to a delayed copy of itself. |
| AEC | Acoustic echo cancellation: subtract the known speaker signal from the microphone signal. |
| Suppression | Turn down the parts of a recording that look like noise. It acts on a recording, not on the air. |
Here is the adaptive filter of Chapter 3 and the two formulas of Chapters 1 and 7 in runnable form. On the lesson’s invented paths it reaches about 39 dB of quiet at the end of two seconds.
pythonimport numpy as np def fxlms(x, d, S, S_hat, L=16, mu=0.1): """x: (N,) reference mic. d: (N,) noise at the ear. S, S_hat: (K,) secondary path and its estimate. Returns e: (N,) residual at the error mic.""" N = len(x) w = np.zeros(L) # (L,) controller weights xb = np.zeros(max(L, len(S_hat))) # recent reference samples, newest first yb = np.zeros(len(S)) # recent controller outputs, newest first xf = np.zeros(L) # recent filtered-x samples e = np.zeros(N) for n in range(N): xb = np.roll(xb, 1); xb[0] = x[n] y = w @ xb[:L] # controller output: one number yb = np.roll(yb, 1); yb[0] = y e[n] = d[n] + S @ yb # error mic hears noise plus anti-noise through S xf = np.roll(xf, 1); xf[0] = S_hat @ xb[:len(S_hat)] w -= mu * e[n] * xf / (xf @ xf + 1e-3) # normalised FxLMS update return e def attenuation_db(f, tau, g=1.0): """Quiet (dB, positive = quieter) when anti-noise of gain g arrives tau seconds late.""" return -20 * np.log10(np.abs(1 - g * np.exp(-2j * np.pi * f * tau))) def comb_db(f, tau, leak=1.0): """Level heard when a leaked copy (size leak) meets a copy delayed by tau.""" return 20 * np.log10(np.abs(1 + leak * np.exp(-2j * np.pi * f * tau)))
The adaptive filter of Chapter 3 is the same family as the one in EE 269 adaptive filters, which derives LMS and its cousins from the ground up. The spectra and band gains of Chapter 9 build on audio representations. For a robot that must classify what it hears, see acoustic scene classification.
Now press Present or Teach and explain one earbud from memory: why the anti-noise must arrive within a few degrees, how the race is counted, why a feedback loop squeals, what hear-through must supply, and why a robot cleans a recording instead of the air. Then go back to the delay selector at the top, pick 150 µs, and explain why the green region stops at about 1 kHz.