Cancelling sound with more sound
Sound is a pressure wave, and pressure waves add linearly (superposition). If you generate a second wave with the same amplitude and frequency as an unwanted sound, but shifted by exactly half a cycle — 180° out of phase — the peaks of one line up with the troughs of the other and the two sum to (ideally) silence at the point where they overlap. That is the entire principle of active noise cancellation (ANC): a microphone senses the incoming noise, electronics generate an inverted copy of it, and a speaker emits that anti-phase wave close enough to the listener's ear that the two combine before either is perceived on its own.
s(t) = A·sin(ωt) incoming noise s_anti(t) = -A·sin(ωt) = A·sin(ωt + π) anti-phase copy s(t) + s_anti(t) = 0 for every t (perfect cancellation)
Feedforward versus feedback
Headphone ANC uses two architectures, often combined. Feedforward ANC places a microphone outside the ear cup, facing the noise source; it senses the sound before it reaches the ear and generates a cancelling signal in anticipation, which works well for noise the electronics can predict from that outside reference. Feedback ANC places a microphone inside the ear cup, listening to whatever the ear is actually about to hear (including noise that leaked past the seal or was created inside the cup), and continuously corrects the cancelling signal against that measurement — a closed control loop rather than an open prediction. Feedforward reacts faster to loud, sudden reference noise; feedback compensates for whatever the feedforward path misses, at the cost of being limited by loop-stability constraints on how aggressively it can correct.
Why ANC struggles at high frequencies
Perfect cancellation needs the anti-phase signal to line up with the original to a small fraction of a wavelength at the point of interest. At 100 Hz the wavelength in air is roughly 3.4 metres, so a few centimetres of timing or positioning error is a tiny fraction of a cycle and cancellation stays good. At 2 kHz the wavelength shrinks to about 17 centimetres, so the same few centimetres of error is now a large fraction of a cycle, and above a few kHz the geometry of a moving head relative to a fixed microphone makes reliable phase alignment essentially impossible. This is why ANC headphones cancel the steady rumble of an aircraft cabin or a train very well but leave high-frequency consonant sounds and clinks almost untouched — those are handled by passive attenuation (the physical seal and cushioning) instead.
Adaptive filtering: the FxLMS algorithm
Real noise is not a single fixed sine wave, so the cancelling signal has to be generated by an adaptive filter that continuously updates itself. The standard approach is the Filtered-x Least Mean Squares (FxLMS) algorithm: an adaptive FIR filter processes the reference microphone signal to produce the cancelling output, an error microphone measures the residual (uncancelled) sound at the target location, and the filter's coefficients are nudged, sample by sample, in the direction that reduces that residual — accounting for ("filtering") the known delay and distortion of the secondary speaker path in its update rule. This lets the system track slowly changing noise (engine RPM rising, wind gusts) rather than being tuned to one fixed frequency.
Beyond headphones
The same idea scales up: cars use ANC in the cabin to cancel engine and road drone through the audio system's existing speakers and dashboard microphones, and industrial duct silencers use loudspeaker arrays to cancel low-frequency fan noise travelling down HVAC ductwork, where the 1-D geometry of a duct makes phase alignment far easier to maintain than in open air.
Frequently asked questions
Why does active noise cancellation work so much better on low, steady sounds like engine rumble than on sudden sharp sounds?
Low frequencies have long wavelengths, so small errors in timing or microphone placement are a tiny fraction of a cycle and the anti-phase signal still lines up well. Sudden or high-frequency sounds have short wavelengths and unpredictable onsets, so the same small timing error becomes a large fraction of a cycle and the cancelling wave arrives out of alignment, or too late to cancel a transient at all.
What is the difference between feedforward and feedback ANC?
Feedforward ANC uses an outward-facing microphone to sense noise before it reaches the ear and generates a cancelling signal in anticipation. Feedback ANC uses an inward-facing microphone to measure what the ear is actually about to hear, including sound the feedforward stage missed, and continuously corrects against that measurement in a closed loop.
Why do ANC systems need an adaptive filter instead of a fixed inverted copy of the noise?
Real-world noise, such as engine or wind sound, constantly changes in frequency and amplitude, so a fixed anti-phase signal would only cancel it at one instant. An adaptive algorithm like FxLMS continuously updates the cancelling filter based on the residual sound measured by an error microphone, letting the system track the changing noise in real time.
Try it live
Everything above runs in your browser — open Noise Cancellation and change the parameters while it is running. Nothing is installed, nothing is uploaded, the whole model lives in one tab.
▶ Open Noise Cancellation simulation