Noise Cancellation Apps?
December 12, 2016 11:29 PM   Subscribe

Why are there no decent noise cancellation apps available? Lots of white noise apps, but not much in the way of noise cancellation. Shouldnt it be possible to take advantage of the powerful processors of modern cellphones and perhaps pair with a pair of headphones and compete with the specialty headphones or ear buds?
posted by dougiedd to Technology (9 answers total) 5 users marked this as a favorite
I would guess that the latency of the microphone and the audio output is way too much to make this a workable solution. Noise-cancelling headphones are designed with microphones and processors that get the data there right away.

For a similar reason, trying to edit on Logic Pro with bluetooth headphones is a non-starter, because the delay added by the interface is huge (in playing terms).
posted by tillsbury at 11:41 PM on December 12, 2016 [2 favorites]

Because nobody wants to wear their cellphone on their head. Joking aside, noise cancellation requires the generation of a sound wave with an identical amplitude and a phase difference of 180° of the unwanted sound. In practice this requires locating a closely paired microphone and speaker in proximity to the source of the unwanted sound or in proximity to where sound attenuation is wanted (i.e. your ear).
posted by RichardP at 11:46 PM on December 12, 2016 [2 favorites]

The biggest problem here is latency. Active noise cancelling headphones have to take in audio through microphones, process it, and output a carefully timed stream of audio with reverse phase to cancel out some of the noise. If you mess up the timing, you'll really just wind up making some frequencies louder, which defeats the point of the exercise.

A google search on "noise cancellation latency" turns up a number of resources on this, including some older variations on this question. You could see, for instance, the math in this old slashdot comment. Above the lowest frequencies, you need pretty darn fast signal processing to get the job done. Even the ~8ms latency on an iPhone isn't going to cut it, let alone the 25+ms latency on many Android devices.

See, for example, this electronics design article: "An ANC headset must minimize latency to work with non-uniform noise. The typical distance between the microphone and the speaker is 0.7 cm, equating to a 20-μs sound-propagation delay. For a digital implementation, there is only a 20-μs interval for analog-to-digital conversion, signal processing, and digital-to-analog conversion." Or this one for a design with 10μs latency. That's achievable with custom hardware, but way too slow for a cell phone's normal audio chain.

Beyond the latency issues, my understanding is that a constant distance between the microphone(s) and the headphones/earbuds is important to make this work as well. Cell phones move around and can be a variable distance from your ears, which is something your signal processing wouldn't be able to correct for, and everything will go wrong if you suddenly turn the phone the other way.
posted by zachlipton at 11:54 PM on December 12, 2016 [4 favorites]

As noted by others, the two big problems here are 1) latency and 2) variable distance. Actually at the risk of disagreeing slightly with the other answers here, the real killer problem is 2) the variable distance, not point 1 (20 us is an eternity to a modern processor, and probably not even that big a deal to something like bluetooth).

If you know your speaker is exactly 1m away from your ears (say), it is easy to generate a waveform that will nullify the sound at that point. The problem is that 1/2 a wavelength away from that targeted point, the waves will constructively interfere, instead of the desired destructive interference.

The problem is that while you can target one point for silence, you only can choose ONE point. You'll actually be making the noise worse at the other points. If you don't know where your ears are with respect to your speaker (because as RichardP notes no one wants their phone glued to their face), well... you're kinda out of luck.

Even if you do use headphones and assume a reasonable speaker/ear constant distance, your microphone is going to be an unknown distance from your ear and you basically have the same problem. This is why headsets with active noise cancelling actually have both a mic and a speaker for each ear.
posted by Arandia at 1:33 AM on December 13, 2016 [6 favorites]

It's actually really easy to know where the speaker is in relation to the mic, though if you want good cancellation, it's not just raw distance, it's the whole nearby acoustic environment with reflections, etc. But again, that's easy enough to sense by correlating the mic and speaker streams. The problem is that you need the mic at your ear (since your filter is solving for mic=0) and also the speaker at your ear (to minimize delay).

I should point out that if you have TWO phones, one for each ear, you can get decent sound cancellation today, just using the built-in functionality. So if you have a second old iphone kicking around, give it a try.

(press one phone hard against each ear, phones do not need to be on)
posted by ryanrs at 3:02 AM on December 13, 2016 [7 favorites]

My Etymotic ear buds came with an app that promised to do this. But in practice it wasn't very effective and they discontinued support, perhaps for the good reasons already explained.

Looks like you can still get it, though.
posted by rd45 at 4:48 AM on December 13, 2016

This was actually the topic of a research project I worked on for a very long time. One thing to know about noise cancellation is that sound moving through the air represents a flow of (acoustic) power. You can't just make that power vanish, since doing so would violate a few fundamental physical laws that we feel very strongly about (eg conservation of energy and a couple laws of thermodynamics). Even though the signals add to zero near your ears, noise cancelling headphones paradoxically accomplish this by *adding* power.

So since they can't actually kill it, most noise cancellation systems have the net effect of moving that acoustic power in space - specifically, to a point in space that's not your ears. This is (relatively) easy in headphones because you're only trying to control a small volume of air.

But when the volume of space you're dealing with gets larger (like, say, near the wavelength of the sound your dealing with, on the order of 10-30 inches) you have a much harder problem to solve, because you can make it it quiet somewhere in your volume but only at the cost of making it twice as loud somewhere else in that same volume. This is before you get to the other problems, which are that there's a lot more acoustic energy in that larger volume and the speakers on your phone can't possibly compete; that the space is unbounded; that you don't know where your ears are (though you do know that they're about 10" apart from each other, which makes it super hard for a single source to target both of them); etc, etc.

Anyway: capital-H Hard controls problem, probably unsolvable in all but the most carefully constrained walled-garden scenarios (eg, imagine a scenario where your head always had to be in the same position, like you're a fighter jet pilot or are strapped into an MRI).

(in our research project we took the hopelessness of this proposition as a given and were working on sneaky structural acoustic tricks to try to prevent the sound from enter getting into our airplane-sized volume in the first place)
posted by range at 6:05 AM on December 13, 2016 [5 favorites]

If you could somehow predict a constant noise source would continue, or couple it to a machine-speed sensor, and give it some kind of feedback self-calibration, you might be able to factor out latency to dull some components of the noise a noticeable amount, but not completely. Any changes to the noise would throw it out of whack until it recalibrated itself. And the distance between the primary noise source and your new noise source might introduce some unwanted directional/positional effects in observed noise levels.

* and perhaps range and I are familiar with the same airplane-sized volume? For very large values of "airplane-sized." Airplane-shaped, maybe.
posted by ctmf at 1:00 PM on December 13, 2016

Ctmf, human sound perception is logarithmic. So even a 30 dB reduction (which you'd perceive as pretty shit cancellation performance), would need an extremely accurate prediction. No way would something like a machine speed sensor be sufficient. Even small head movements or nearby objects are enough to ruin cancellation performance. You really do need a mic at the ear to provide continuous feedback to the system.
posted by ryanrs at 3:20 PM on December 13, 2016

« Older Easy family friendly last minute trip?   |   is this book cover a pastiche of another, older... Newer »
This thread is closed to new comments.