Noise Cancelling in Software?
doc_verma wonders: "There are directions to build noise-cancelling devices in hardware, but what would it take to create noise cancelling in software? Since computers have a speaker-of-sorts and can possibly have a microphone, why not take the input from the mic, reverse-phase it via software, and output it through the speaker? A noise-cancelling feature would be great to run on servers in a rack. It would also be a great app to run on your laptop when you are on a plane."
You'd only get noise cancellation at the rough area around the microphone is, assuming you'd account for the speaker-microphone distance. You have to cancel phase _everywhere_ for it to work for a room, and you can't do that, really, without a huge array of speakers, or speakers exactly co-located with noise sources.
So you could do it in software for headphones, since you just need to cancel noise right at the headphones, which is fine. But it's no good for speakers, unless you have very specific configurations of noise sources that lend themselves to simple cancellation. In general, no way.
Do you sit in the exact same relative position to the speakers (within a quarter of a wavelength or so) at all times? If not, that idea's dead.
I've had this sig for three days.
I think it would be cheaper (and better in the long run) in a rack-mount environment to buy quiet, high-quality fans rather than trying to build a device to counter the noise (not that the high-frequency noises caused by most fans would be easy to cancel anyway).
Don't waste your time implementing this in software. You're not going to be able to get low enough latency to make it work.
After all, I am strangely colored.
Your computer's sound input and output are buffered in both software and hardware. This means that there will be a minimum latency measured in tens or hundreds of milliseconds between reading input from the microphone and being able to send corresponding output to the speakers. You can make this latency smaller and more predictable with well-designed hardware, drivers, and applications software, but you'll never be able to do the same "real-time" processing that you can do with dedicated hardware.
Software would generally be too slow. A DSP-based sound card could potentially be programmed to do phase-inversion and time-slew (to account for distance) but an ordinary desktop machine would generally need to be very fast and incorporate real time extensions in the kernel. This is the reason you generally find hardware-only solutions (and in headphones for the reasons mentioned in a peer post). Of course I could be way off....
why not take the input from the mic, reverse-phase it via software, and output it through the speaker? well, i suppose the howling, squealing feedback would make you forget about the server fans for a few seconds, but i suspect it would just end up giving you a bigger headache in the long run.
I tried using them in planes, but always got an irate flight attendant demanding me to turn them off. Those people are very suspicious of any non-conventional electronic equipment. Stupid, because those analog phones were certainly less dangerous to flight equimpent than the digital hardware, including notebook computers, that they allow on board. If I worked aboard an airplane, my darwinian instincts would make me study enough electronics to know which kind of equipment should be turned off...
... on a road trip across the West. Eight solid hours of a four year old pontificating. I searched the car high and low for the travel headphones so I could get a break with my MP3 player. Couldn't find them and the only stores for thousands of miles in any direction sold only alcohol, Mormon cookbooks, and knives.
This is a cool idea.
The Luddites were ahead of their time.
With present computing technology, the latency involved in running anything through software will be way too high to implement a noise cancellation scheme.
I dont know how to noise cancel, but I know how to create a ton! cat /dev/urandom > /dev/dsp :)
Your poor child. I hope you have money saved for the therapist.
Now that is an odd combination. Where on earth were you driving? It is pretty hard to go for eight hours (even out west) and not find a place that will sell headphones. Even places as obscure as Cokeville, WY have them at truckstops.
Lasers Controlled Games!
Who the hell is green-lighting these moronic questions lately?!
(hint: search around a bit on noise cancelling technology before posting dumb-ass questions)
You want one of these
If I was seeing those repeatedly, and a talkative kid, I might get culinary ideas.
The biggest issue is to only have one specific sound source you're trying to muffle. You have to place the microphone as near to the sound source as possible, and the location of your speaker will depend on how long it takes to process the signal. It will also be highly directional unless you rig something up with multiple speakers all aimed in different directions. You will also need to be a certain distance away to allow the reverse-phase sounds to merge and cancel each other out.
The other issue is that it will only work on low pitched sounds, the lower the better. The slower the frequency, the more time you have to do the math and output your opposite signal. High frequency sounds you can pretty much forget about being able to process.
One use for this might be to muffle a single exhaust pipe from a loud motor, but you won't be able to get it to work for general noise. The reason it works in Noise-cancelling headsets is that the microphone is located at the destination of the sound (your ear), rather than at the source. The closer you can get it either end, the better it will work. It's not really worth doing it in Software
One interesting thought about quieting individual fans or motors is to use an Adaptive algorithm. Because most of these devices make a consistent repeating sound, it would be interesting to be able to anticipate the sound source over time and broadcast an estimated calculation before the current sound is even processed and use the processed result to tweak the future estimation. This would work on only reasonably consistent sources and there would be issues with feedback and unexpected noise changes.
Your poor child. I hope you have money saved for the therapist.
Yeah, for me. He got that from his mother.
The Luddites were ahead of their time.
I'm from the American West and have literally driven all over it. The combination of roads we took in Idaho, Utah, Colorado and Wyoming produced a bizarre combination of social sights and incredible natural beauty. One convenience store carried knives, Mormon cookbooks, and beer. No headphones.
The Luddites were ahead of their time.
the only stores for thousands of miles in any direction sold only alcohol, Mormon cookbooks, and knives.
Sounds like a bad day for the Mormons if you're hungry.
Stop the world; I need to get off.
If you want to model an amplifier in software, here it is:
:)
output = input * gain;
If gain is negative, the output will be inverted (or alternatively you could just swap the connections to your headphones or microphones.)
As for software emulation of glueing microphones on a pair of headphones and fitting energy efficient electronics in a tiny box, I don't think it will work
send + more == money?
The system could slew phase until the desired cancelation is achieved at some arbitrarily high frequency.
It is the rate of change of the parameters of the system (whether in time or frequency space) to which it must adapt that ultimately governs its abilities.
Fan noise is fairly stationary... so.
However there are all sorts of other issues which can not be easily solved (microphone/speaker placement, limited affected area, etc.).
THIS THING CAN TURN ON A DIME, MACROSSZERO STYLE ALSO FUCK BETA, ~NYORON
This isn't Slashdot worthy material, but I'll answer it with some information anyways.
The key to noise cancelling is direction. The inversed noise has to be travelling in the same direction the noise otherwise would, and it has to be inverted and spat out at almost the exact same time.
While the speed issue isn't a problem, the microphone and speakers aren't good for the directionalness. It works well in headphones, because with headphones you have a very specific direction: in to your ear. The microphone can pick up things relatively directional (depending on the type of mic.) but the speakers are made to spread sound, not to aim it.
That and they would have to be in roughly the same location (within a few cm.) for it to work properly.
What I want, is a noise cancelling dome, so two people can go under it, talk, and have no one outside hear anything, that'd be cool.
I'm sure that would be fine. It's your audio capture device, the pipelines on the card, DMA transfers, bus speed/contention, and system schedulers that are the problem. Oh yeah. All *that* stuff.... And then you need to get back through the bus, card pipelines and out through the DAC to generate output. Phew!
s ystemi ng5 4
Dedicated, you'd probably be fine at 100Mhz or less with the right [embedded : most likely hand coded assembly] software. Most modern desktops have so much crap running all the time however that those precious CPU cycles dissapear very quickly. Even if you could do it, there'd probably be gaps or delays without some nicely written double or triple buffering techniques. These things take time and then therefore kill what you set out to do.....
Actually - If the microphone was placed very close to the source, you may be able to generate some anti-sound "down range" (ie. Your desk) and the latency could be compensated for in that regard. It would take some fine tuning - in fact another microphone at the place where you need the quiet could be used for the system to tune itself. (This of course is assuming there are no walls in the room for the sound to bounce off of so that you aren't trying to defeat 17 "sources" simultaneously).
I'm not claiming any authority on this or saying it can't be done, just stating that it's probably quite a bit more complicated than it may look at first glance. Real time work is not something most "normal" OSes are setup to do. It can be done, but for things to be faster than sound you've got to get your latency WAY WAY WAY down.
http://en.wikipedia.org/wiki/Real_time
http://en.wikipedia.org/wiki/Real-time_computing
http://en.wikipedia.org/wiki/Real-time_operating_
http://en.wikipedia.org/wiki/Audio_signal_process
http://en.wikipedia.org/wiki/Noise_cancellation
http://slashdot.org/article.pl?sid=04/05/27/16412
Enough alcohol would suffice. Not good for your driving skills, but works decently as noise cancellation. At least until the next morning.
Anagram("United States of America") == "Dine out, taste a Mac, fries"
the only stores for thousands of miles in any direction sold only alcohol, Mormon cookbooks, and knives.
Sounds like a bad day for the Mormons if you're hungry.
Recipe from the Mormon Cookbook:
Mormon Flambé
- 1 Cup 80 Proof Liquor (Cognac is a good choice)
- 3 Slices Mormon Bacon, Diced
- 2 8-Ounce Mormon Steaks
1. Fry Bacon until fat renders out
2. Cook Mormon steaks 4-5 minutes on each side, on Medium heat
3. Remove pan from heat
4. Add in warm Liquor (heated in a small saucepan until bubble start to form)
5. Using a long match, ignite Liquor
6. Serve immediately after flames die down.
Yum!
I am also from the "American West" as you call it. I have driven to many out of the way places and find it hard to imagine that you couldn't easily find headphones. I do believe that you could find many stores that don't carry them.
Lasers Controlled Games!
I am also from the "American West" as you call it. I have driven to many out of the way places and find it hard to imagine that you couldn't easily find headphones. I do believe that you could find many stores that don't carry them.
Wow, I think this is the second person to have questioned that. Trust me ... I drove the 600 miles that day. There were headphones available in our town of departure and in the town we arrived in, but nothing in between.
The southwestern corner of Wyoming, where one can drive in Idaho, Wyoming, Utah and Colorado in one day, had few stops. None had headphones. And this was four years ago, there may now be stores that do sell headphones. But the route chosen was off the beaten path, on highways were some stretches hadn't been resurfaced in years. Granted, I did not stop at every whistle stop along the route.
The Luddites were ahead of their time.
Tales from the White Hart, almost a must read. I have a very old printing that was my father's favorite childhood book, and a copy of the most recent reprinting.
5 430727/qid=1129651213/sr=8-1/ref=sr_8_xs_ap_i1_xgl 14/104-2949821-4630339?v=glance&s=books&n=507846
http://www.amazon.com/exec/obidos/tg/detail/-/034
The dinky town I mentioned is in souwthwestern Wyoming... I guess you might have a hard time finding anything in say, Randolph or Woodruff, but you really have to be trying to avoid towns with truck stops.
Lasers Controlled Games!
Yeah, on that particular trip we intentionally avoided interstates and drove the 'thin blue lines' on the maps.
The Luddites were ahead of their time.
I'm not an expert nor have I tried this, but a server will likely be making very predictable and repetitive noise, mostly from its fans.
Given that the sound will be predictable and repeated, can't the noise cancelling software make the same waveform, output it with an adjusted phase?
It may not be necessary to have low-latency from input sampling to output, if there is enough predictability.
If you have problems with latency, it's just a matter of slowing down the noise, or slowing down the noise source. That way you'll have time for your DSP to process the signals. The coding is left as an excercise to the reader. Basic physics meet ask slashdot!
please excuse my apathy
Would that be Alferd Packer's recipe?
Terrorists can attack freedom, but only Congress can destroy it.
The problem is that sometimes the music might make a sound that sounds like the word "pause" as well, thus pausing itself.
Why not simply cancel out "what you hear" coming out of the speakers, from "what is spoken" going into the microphone? Then the voice-recognition software could focus solely on my voice, instead of my voice mixed in with the winamp music....
The possibilities are great.
-Clio
Karma: Bad (mostly from not giving a fuck)
Blog: http://clintjcl.wordpress.com
As the other posters said, noice cancelling is really hard, and even when it works, only works to a degree.
Depending on your motivation, other fun technical solutions may apply. Recently I've been running into situations where wireless headsets would've been really useful; for example, in any noisy environment, or situations where the speakers get separated out of earshot. I would love to have some while shopping or hiking with company. Anyone have any recommendations?
Tsunami -- You can't bring a good wave down!
Could any of these techniques be used to cancel a specific type of noise?
I live very near a Master Navy Jet Base and the jet noise can be deafening. Many times there are several planes per minute for hours flying just over the treetops while practicing touch and go landings. I've often wondered if it would be possible to do just what the original poster was asking in order to mitigate the ear piercing noise.
They work better than the Ryckebush hardware posted in the original article (I would know, I wasted probably $50-100 in building the hardware and trying to tweak it to get it to work well). The Philips HN100s and HN110s (same thing except different style as far as I can tell) are only $15 INCLUDING shipping on eBay if you look hard enough.
Far better battery life than the Ryckebush design (40ish hours on a single AAA instead of 2-3 hours AT BEST on a pair of expensive 9vs), somewhat better cancellation, and far more compact and better looking (important when going through airline security, my homebuilts basically became useless to me after 9/11).
There are too many challenges involved in doing it in PC hardware when it can be done so cheaply with off-the-shelf headphones. In THEORY, PC hardware could deliver incredibly good cancellation using some adaptive noise cancellation techniques, but 99%+ of PC sound cards are not of sufficient quality for this to work. Having sample-accurate synchronization between input and output is critical, but apparently most sound cards just don't do this. (I've looked into doing acoustic echo cancellation for audio conferencing, which has similar hardware requirements. Most PC sound cards just aren't up to the task.)
retrorocket.o not found, launch anyway?
I sell noise cancellation material and noise cancellation material accessories. See, a lot of the noise you hear is not primary-source noise, it is 2ndary, meaning that you hear mostly reverberations. The primary waves bounce around (becoming 2ndary) and interfere with new primary waves, creating exessive noise. My material is extremely effective at cancelling 2ndary noise and somewhat effective at cancelling primary noise. Even with primary noise uncancelled, cancelling the 2ndary noise has a profound effect on your perception of the primary noise.
The effective pitch range of the material is frommidrange to high frequency. Low frequency (bass) is not as blocked, but dending in the install, it can do a substantial job of deadening the bass.
I sell this material by the yard in 12' wide rolls. It comes in many colors and patterns and is availible in berber and shag textures
Slashdot's rate-of-post filter: Preventing you from posting too many great ideas at once.