Home / Hardware y Moviles / The physics of noise cancellation: how your headphones silence the subway

The physics of noise cancellation: how your headphones silence the subway

Ilustración de ondas sonoras cancelándose en un auricular ANC

The subway car rumbles, the motor vibrates under your feet and the platform horn slips in through the window. Then you put on your headphones, press a button and the roar disappears as if someone had turned down the volume of the world. It is not magic, and it is not that the headphones isolate you completely: it is physics, and your headphones are applying it in real time, 48,000 times per second.

A wave that erases another

Sound is a pressure wave: the air compresses and expands periodically, and those pressure variations reach your eardrum. When two waves meet at a point, their effects add up. That is the principle of superposition, and everything follows from it: if the compression of one wave meets the compression of the other, the sound is reinforced; if it meets an expansion, they cancel out.

That second case is destructive interference. A wave and its twin shifted by half a wavelength — that is, 180 degrees, or π radians in the physicist’s notation — cancel each other: where one pushes, the other pulls. At that point the net pressure is zero and the ear perceives nothing. Active noise cancellation (ANC) is just the engineering of this trick.

Headphones that listen first

The idea is not new: Paul Lueg patented it in 1934 to silence the noise of aircraft propellers, and Amar Bose, founder of Bose, brought it to consumer headphones in the year 2000. But turning the idea into a pocket product demanded the key piece that was missing in the 1930s: a digital signal processor (DSP) capable of computing the anti-wave on the fly.

The layout of an ANC headphone is deceptively simple. External microphones capture the real ambient noise reaching the earcup. The DSP analyses it and computes the inverted wave: same shape and amplitude, flipped phase. The speaker emits it towards your ear. And in your eardrum, the original noise and its antidote add up and cancel each other.

The key word is in your eardrum, because the anti-wave has to arrive exactly when the wave it intends to erase does. A difference of a couple of microseconds and the cancellation falls apart. That is why the DSP works in samples: an analogue-to-digital converter (ADC) turns the microphone signal into numbers, the processor combines them, and a digital-to-analogue converter (DAC) sends the result back to the speaker. Each cycle of this loop completes in about forty microseconds.

Feedforward, feedback and the art of latency

There are three classic architectures. Feedforward places the microphone outside the earcup and tries to anticipate the noise before it reaches the ear: ideal for isolation, yet sensitive to tuning, because if the anti-wave arrives late it becomes another source of noise. Feedback puts the microphone inside, next to the ear, and corrects what actually arrives: it is more robust on the low frequencies, but if the algorithm amplifies one particular frequency too much, it produces an unstable whistle. The solution high-end headphones use is the hybrid: two microphones, one external and one internal, combining the best of both.

The Nyquist-Shannon theorem, the pillar of digital audio, states that to reproduce a frequency you need to sample it at least at twice that frequency. The 48,000 samples per second of an ANC headphone are more than enough to handle the noise of a subway motor, around 120 hertz, or the roar of an aircraft. What ANC cannot do well is cancel unpredictable noise: a nearby conversation or a sharp impact. The human voice is broadband and erratic, hard to anticipate. And even though the mechanism could cope, nobody wants the headphones to erase the voice of the person talking to them.

Filters that tune themselves

The mathematical heart of ANC is a finite impulse response (FIR) filter. In essence, a FIR keeps the last N samples of the noise, multiplies them by some coefficients, the weights, and sums the result to produce the output. It is the same operation an equalizer performs, but computed at audio speed and in reverse: instead of shaping the sound you want to hear, it builds the one you want to cancel.

Who decides those coefficients? An adaptive algorithm. The classic one is least mean squares (LMS): it compares the filter’s prediction with what the internal microphone picks up and adjusts the weights by a microscopic step in the direction that reduces the error. Repeated thousands of times per second, the filter learns the noise of your environment in the first few seconds and keeps readjusting if the rumble changes, like when the subway brakes and the hum drops in pitch.

The same idea, other scenarios

The anti-wave trick does not live only in your ears. Pilots use it in their headsets, shielded from the cabin roar but with the air traffic controller’s voice intact. The same principle silences hotel bedrooms, the latest-generation vacuum cleaners and the interior of electric cars, where the motor no longer masks the wind. And do not confuse it with the noise suppression of your phone’s microphone: that one does not cancel the environment for you, it cleans the voice you send to the other person, using similar filters applied in reverse.

So the next time the subway goes quiet when you put on your headphones, you know what is inside: a microphone that listens, a processor that computes the inverted twin wave, and a speaker that fires it 48,000 times per second. Physics does not silence the world: what it does is build, at the last instant, the exact nothing that covers it.