Software Antinoise Creation?


Tobriand

Well-Known Member
Joined
Dec 27, 2002
Messages
4,071
Age
38
Location
Croydon (UK)
Website
Visit site
I'm sure at one stage or another you've come across noise-cancelling headphones - the ones that listen to the background noise, and add antinoise to the sound signal meaning you end up being much better able to hear what's going on, especially on trains and aeroplanes. Typically, of course, the difference in price between such headphones and regular ones is about £50-£60, unless you're lucky and find them on sale.

This morning something crossed my mind. Pandora has an onboard microphone. It also has a LOT of processing power. Maybe such equipment could do the job?

A brief search on Google on whether it were possible in software came up with one big problem: the microphone is located much further away from the user if it is in Pandora than it is if it's located in the earpieces themselves. However, it might still be worth trying just to see if it did make a difference - ambient sounds (i.e. engine noise) might well, I suspect, be sufficiently close at both locations to still be caught.

The other possible solution would be that suggested midway down this thread of making a set of headphones with microphones on the earpiece, and plug them into the microphone in socket. Obviously would work better but would also need said micoheadphones to be made first.

If this *were* practical - and latency and positioning didn't get in the way - I wonder how it would best be done? Two possibilities spring to mind: by a daemon running in the background and adding the antinoise, and in a library that could be used for sound in general. I imagine if the former would work, then that would be preferable, but I don't know whether it would work!

Anyway, it'd be interesting to hear people's thoughts on this, especially the devs (on whether it could be done, how costly it would be in CPU-cycles), and the audiophiles (on whether the effect would be worth the effort).
 
Awesome idea.... but so many factors that could make it fail....
-Audio processing Latency,
-CPU usage (noise cancelling phones likely use a specialised chip, not a general cpu),
-Microphone location (again adds to latency among other potential unknown factors),
-Type of headphones (different headphones are better for different frequencies so you might need to tweak for each set of headphones),
-That oncoming truck (assuming it actually works and you're walking along playing a game)......

Not that I have any technical experience in this area other than knowing a cheap pair big headphones that completely enclose the ear do wonders for sound quality and noise reduction over standard headphones. :p
 
noise cancellation (or phase cancellation) is a fairly simple algorithm, it simply inverts the phase of the audio signal, and mixes it with the original sound.
latency is the biggest problem with software solutions tho. the amount of time it takes the recorded signal to travel through the various hardware and software of the pandora, then out to the speaker would offset it by at least a few miliseconds. thus instead of a noise cancellation, you would get a flanging effect, and actually end up AMPLIFYING the sound at higher frequencies (tho, lower frequencies could be reduced).
the pandora's mic isnt going to be very good at picking up higher frequencies anyway, but this MIGHT be useful for cancelling lower frequency noises (the higher frequencies could be filtered out to prevent amplifying them)... but even then the distance of the mic from the headphones would be a big problem.

really tho, you would most likely get better results by using closed-back earmuff style headphones (note to zarneth: i have a pair that are open back earmuff, and they barely muffle any noise... amazing sound quality tho).
or, making your own noice cancelling box :)
 
It should be done at kernel level, in the alsa driver for minimum latency. All other solutions will fail, as software delays are huge.

Headphones with a mic already exist. The mic is close enough too, it doesn't need to be right in the earbud. Just keep it away from your mouth.

This might work though.
 
Noice cancellation needs microphones and speakers mounted on the outside of each ear, one for each. Otherwise nothing would happen.

Edit:

If you want less noise, just get earphones like the ones I made my headset out of. They work wonders.

2469308771_0d93e91251.jpg


old-school headphones and an Apple Microphone from 1990 superglued to the side :D
 
AFAIK nothing would happen (except possibly slight amplification) for non-ambient noises. Speech etc. would be too high to filter, or instance, and far too directional.

But engine noise - which I think would be the major target of such a project - might be pitched low enough, and be uniform enough regardless of where one is in the train, aeroplane, coach etc. to be partially eliminated.

Whilst I'm well aware there are other ways to do it - either with real noise cancellation headphones, or with the glue-a-microphone-onto-a-headset method - I'm most interested in whether it *could* work, at least partially, for your avergae £4.99 headphones (unmodded).

And *if* possible, and even remotely effecitve, it would be a potentially big selling point for those who know they'll use Pandora to watch things on as well as to play things on; the number of times I've had to stop watching something on the 2x due to background noise is probably about half the number of times I've ever tried to watch anything on it ever. Which is quite a number, really...
 
Tobriand said:
Whilst I'm well aware there are other ways to do it - either with real noise cancellation headphones, or with the glue-a-microphone-onto-a-headset method
1. I don't think it would work - if anything, it would make the noise louder due to phase differences.

2. This isn't for noise cancellation - the mic is for speech recognition and voice chat. The around-the-ear part of the headphones blocks out almost all the noise.
 
Last edited by a moderator:
Instead of just inverting the phase of the input and outputting that, you could analyse the input for high energy frequencies and then generate the phase inverted output based on that. If you took a decent sized sample window you'd avoid the noise cancellation doing anything to sudden, short sounds and just keep trundling along with prolonged engine sound.
 
Back
Top