# how do noise cancelling headphones work so fast

21 views
0

So I understand the basic principles behind noise cancellation. You essentially use a microphone to record incoming sound waves and create an inverse wave that destructively interferes with the initial wave, thus, cancelling it out. But I don’t understand, practically, how this is done.

Let’s assume the sound wave makes contact with the microphone in the AirPod, which analyses the wave and shoots out an inverse wave, but by that point – the initial sound wave would surely have already reached my ears. The AirPod basically needs to cancel the sound wave before it moves roughly a centimetre or it’s too late.

The speed of sound (in a standard environment like air) is 343 meters per second or 34,300 centimetres per second; this means the AirPod has 1/34,300 seconds or ~0.03 miliseconds to do these operations to cancel the wave. That just seems absurd to me for such a tiny chip in the bloody AirPod.

In: 678

Computers are wicked fast. Especially custom processors that are purpose built for doing one thing really well.

They’re operating at the speed of electrical signals, pretty much the speed of light. Which is much faster than sound.

One way to quickly process the signal is to do an FFT, converting a time domain signal into a frequency domain representation of the signal.

The frequency domain of a consistent signal is pretty much static, meaning you don’t need to act that fast on time domain to be able to predict and generate the counter signal, you can pretty much just generate it constantly and it always work.

Of course noises have changing frequency domain characteristics, so the analysis is constantly being done and the anti-noise signal is constantly being generated using the latest analysis results.

30 microseconds is not a problem – even 1980s computers could perform several operations (additions/subtractions) in that time.

Modern cheap microcontrollers can perform about 20 operations in a single microsecond (the number taken from ATtiny, which is also quite small). So they can do 600 operations in the required time.

30 microseconds is a plenty of time.

something to remember is that when Singers perform live, the signal goes from the microphone, to a stack of equipment, sometimes even things like pitch correction or auto-tune, and then to the speakers. and they still sound in-time with the rest of the band. sounds take time to happen and are not instantaneous. 100ms is a short sound.