Noise Cancelling in Software? 84
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."
Uh, no. (Score:5, Informative)
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.
Re:Uh, no. (Score:2, Informative)
Re:Uh, no. (Score:2)
If I recall a Science News article from a few articles, some people were working on systems to cancel noise at specific places in an area, for example at the operator station for a piece of noisy machinery. As you say, you can't do it everywhere, but I don't think it would have to be at the microphone.
I'd imagine in some applications, depending on the shape of the "silent
Re:Uh, no. (Score:4, Informative)
Parent is exactly right. There are two ways to handle noise cancellation. #1 is source cancellation (very hard unless the source is confined). #2 is receiver cancellation (very easy). However, don't expect either method to work at high frequencies.
Sound is a complex beast. Literally. Imagine you could have enough samples to make a 3D spectrum analysis of the sound. What would it look like? You'd see high frequencies "beaming" off of reflective surfaces. You'd see low frequencies "wrapping around" small objects.
To do source cancellation, you have to find a way to negate all of the sound energy before it reaches *any* receiver. Put your computer in a box with a long, narrow air take. Carefully design the intake/exhaust to minimize "port noise". Add noise cancellation *inside* the box. Walk around. You shouldn't hear anything coming out of the box.
If you can't control the source, you have to resort to receiver cancellation. "Why?," you ask. Because if you mess up on the phase, you can/will end up contributing 3dB to the noise source at various frequencies/locations. That's not acceptable.
Receiver cancellation works just like source cancellation, except you put the box around the receiver. In our case, the "box" is headphones. Put a high quality microphone on one side. Feed a phase-inverted signal into the output speakers.
Earlier I mentioned that noise cancellation doesn't work well at high frequencies. Why is that? Delay. At low frequency, the signal changes very slowly. If I'm "off" by 1 microsecond, it won't make any difference to a signal that oscillates at 60Hz. Here's a little exercise for the reader: In this example, we're considering only one frequency and one point in space. Let f = 60Hz. Let d vary from 0 to 16ms. Observe the results. What happened at 2.79 ms? At 8.33 ms? Nasty, eh? But we're pretty confident our system can handle those latencies without any trouble, so we'll crank this thought experiment up to 4kHz.
Let's do some envelope calculations: our latency has to be under 42 microseconds to do *any* good (i.e. avoid adding to the noise), under 21 microseconds to get a 3dB attenuation, under 4.2 microseconds to get -10dB, and under 0.4 microseconds to get -20dB. No sweat, right?
I'm going to be a bit facetious here and start by examing the CPU aspects. Ok you've got a 3GHz cpu. Let's be "generous" and assume you get about 1.67 instructions/clock. That means you can execute about 5e9 instructions/second (0.2 microseconds/instruction). There's no way you could hope to get any meaningful work done in 2 instructions, so that rules out the possibility of getting -20dB. In fact, there's not much you could hope to do in ~20 instructions, so there goes -10dB. You *might* be able to write a dedicated driver that could handle -3dB. Whooptee freaking doo *twirls finger*. The padding on your headphones probably does a better job. Or just stick some cotton in your ears.
Even if you manage to get your digital hardware up to speed, you've got another problem: the analog hardware. That's right: between your $0.50 microphone and your $0.50 speaker, there's a pretty decent chance that they've got more than a few microseconds of slew error. Even if you bumped those up to $100.00 each, you're still not likely to get it right. In short: don't expect to do -20dB at 4kHz for under a few grand (*).
Last I heard, the $100 sony headphones do about -10dB at 100-400Hz. As far as I can tell, the hardware is only worth about $2, and you're paying $98 in salesman, middleman, marketing and engineer salaries.
(* No, this is not an offer. I wouldn't try building you a pair for less than a million in R&D funds, and even then I couldn't guarantee results.)
Philips HN100s (Score:2)
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
Re:Uh, no. (Score:2)
Unless your receiver is moving around.
What we have here (not from the parent but from the submitter of this article) is a failure to understand the technology. Any attempts at active noise cancellation are going to suck ass unless you know exactly where the
Re:Uh, no. (Score:2)
Sigh, it's not a straw man, as you certainly didn't give the issue proper emphasis. The listener not being at a fixed point is the fundamental reason why this guy's idea won't work.
Latency is a side-issue that only prohibits the canceling of certain types of noise, not all of it.
More nitpicking and bad assumptions on your part.
This is neither nitpicking, nor a bad assumption. It's a freakin big deal since it's
Re:Uh, no. (Score:1)
This only holds if you ignore the fact that the majority of audible sound does not come directly from the source, but from "re-radiated" sound waves emanating from the (metal) exterior of the case.
How is this significant?
Conduction of sound waves through metal is 10-20 times faster than through air( http://www.newton.dep.anl.gov/askasci/phy00/ph y00058.htm [anl.gov]), so positional phase variation can be ignored (it's scaled by the same factor). This vastly simplifies the w
Position dependence (Score:3, Informative)
Re:Position dependence (Score:3, Informative)
Re:Position dependence (Score:2)
There's going to be some variation. The technique will not be perfect, but it should be able to achieve rather significant cancellation for many noise sources.
Re:Position dependence (Score:2)
quiet fans aren't too expensive (Score:2)
Re:quiet fans aren't too expensive (Score:3, Informative)
I've got a 2u switch, with some 60mm fans in a small 6 foot rack in my basement. The fans aren't too loud in and of themselves, but they make a hell of a lot of wind noise and turbulence - because they run at 5000rpm. Now, since I can control the air temperature a little better in my situation than you might in a server room (by not having a crapload of equipment in the rack), I c
Re:quiet fans aren't too expensive (Score:2)
Re:quiet fans aren't too expensive (Score:2)
well, actually, i probably wouldn't: it has potential warranty impact etc and you don't want to go voiding maintenance contracts.
Re:quiet fans aren't too expensive (Score:2)
High-end servers can tolerate the loss of just about any part other than the CPU or mot
Re:quiet fans aren't too expensive (Score:2)
You get a passive backplane, add cards. Then you can associate CPU/Memory/Disk or groups of CPU/etc to a certain OS. If one processor fails? There's a spare board to pick up the slack. If a motherboard fails? No problem, spares in the chassis.
That's what I'd call high end! (Please note that some of this is heresay from people
Bad Idea (Score:1)
Real-time sound (Score:5, Informative)
Re:Real-time sound (Score:3, Informative)
Re:Real-time sound (Score:3, Informative)
>constant background noise,
> so you're canceling based on feedback
>from sound heard earlier.
> That's how the headphones work too.
But there's a big difference between trying to match the phase of a signal using analog parts with an intrinsic bandwidth of MHz and trying to match the phase of a signal when you're latency is several ms at best and varies wildly depending on what the computer is doing.
If the latency were constant to within a small fraction of t
Re:Real-time sound (Score:1, Insightful)
Re:Real-time sound (Score:3, Interesting)
But you'll be hard pressed to get there using a multi-tasking OS on a standard laptop.
It depends on the OS. Some allow you to change kernel code. That lets you do your
Re:Real-time sound (Score:2)
You're absolutely right. Still not the easiest way to do it, by any means, but perhaps not so daunting after all.
Re:Real-time sound (Score:2, Interesting)
> canceling based on feedback from sound heard earlier. That's how the headphones
> work too.
Actually, it isn't. You can cancel one-tone that way unless you constantly do a
windowed FFT.
> (You don't think they have instantanious electronics do you? Even anlog signals > have latency.)
Not instananeous, but orders of magnitude faster than digital. Most do in fact just invert the signal. Headphones make the sound directional enough so that it
Too slow (Score:3, Insightful)
Re:Too slow (Score:2)
A 40ms cycle equates to a 25Hz tone. You'd be able to cancel anything below 25Hz.
To cancel anything below 10kHz you would have to have less than 0.0001 seconds of latency.
Re:Too slow (Score:1)
I'm just reinforcing your point, it's possible to get two milliseconds in software, but anything below that is pushing it. Some of the really high end systems (Echo Layla for example) can get less
Re:Too slow (Score:2)
You forget also that there are hardware programmable DSPs in modern computers; Creative soundcards, for one thing, and all modern videocards.
I actually recall reading an article a while back on doing audio processing on videocards. This was part of the growing trend of using videocards as math co-processors or DSPs.
Assuming you could do the pr
So you think you're fast....... (Score:3, Interesting)
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 t
Re:Too slow (Score:2)
Re:Too slow (Score:3, Informative)
That's certainly fast enough to do "output = -input;". Your problem though is converting analogue voltage to "input", reading "input", writing "output" and converting "output" to analogue voltage.
The *best* soundcards currently available are 96kHz. Nyquist says that you can only reproduce a frequency of 0.5 x sample rate. But that's theoretical-only - to get a decent approximation takes you to more like 0.1 x sample rate. Which means you can accurately
why not... (Score:5, Funny)
Not in planes... (Score:2)
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, in
Re:Not in planes... (Score:2)
of course, all those in-flight catalogs selling noise-canceling headphones -- not to mention all the people i've seen using them on flight after flight after flight -- i dunno, it kind of makes me wonder if you're not just lying through your teeth.
Re:Not in planes... (Score:2)
No, we are just thinking about different times. I got the first noise-cancelling phones I ever saw, this was in 1999.
Of course, instead of blaming the electronics passengers carry on board, they should first try to reexamine maintenance procedures. Did you know that, when pilots report problems, in 50% of the cases, maintenance can't find the cause of the problem? [usynaptics.com] This means that one half of the airplanes that have potentially harmful p
Re:Not in planes... (Score:1, Interesting)
No it doesn't. It means that 50% of the time problems are reported by pilots, maintence can't find the problem.
Your factoid says nothing about: The harmfulness of the reported problems, the rate at which the problems are reported by pilots, and if pilots ever score false poisitves reporti
Re: (Score:1)
Re:Not in planes... (Score:1)
What country was this? I've worn mine accross North America and Europe with never a problem, me along with half the plane on some flights. Just don't whip them out in the first or last ten minutes, and no one should stress.
Re:Not in planes... (Score:2)
Riddle: Everyone has been there, but nobody can go there.
My child once talked for eight hours straight ... (Score:4, Funny)
... 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.
Re:My child once talked for eight hours straight . (Score:2)
Re:My child once talked for eight hours straight . (Score:3, Funny)
Your poor child. I hope you have money saved for the therapist.
Yeah, for me. He got that from his mother.
Re:My child once talked for eight hours straight . (Score:2)
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.
Re:My child once talked for eight hours straight . (Score:2)
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.
Re:My child once talked for eight hours straight . (Score:2)
Re:My child once talked for eight hours straight . (Score:2)
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 driv
Re:My child once talked for eight hours straight . (Score:2)
Re:My child once talked for eight hours straight . (Score:2)
Re:My child once talked for eight hours straight . (Score:5, Funny)
Sounds like a bad day for the Mormons if you're hungry.
Re:My child once talked for eight hours straight . (Score:2)
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
Re:My child once talked for eight hours straight . (Score:2)
Re:My child once talked for eight hours straight . (Score:2)
a hella fast computer (Score:2)
Loud Noise (Score:5, Funny)
Re:Loud Noise (Score:1)
"I bought this product and deployed it throughout my company. Now when my employees dump random data to their speakers, I don't hear a thing! Brilliant!"
Get your urandom-to-dsp noise canceler today! Only $59.95! Order now!
Fenton Silencer (Score:4, Funny)
Arthur C. Clarke (Score:1)
http://www.amazon.com/exec/obidos/tg/detail/-/0345 430727/qid=1129651213/sr=8-1/ref=sr_8_xs_ap_i1_xgl 14/104-2949821-4630339?v=glance&s=books&n=507846 [amazon.com]
This is possible with two specific caveats. (Score:4, Insightful)
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.
Re:This is possible with two specific caveats. (Score:1)
Re:This is possible with two specific caveats. (Score:2)
This is wrong. It's not the frequency of the sound that matters, but rather the rate of change in the spectrum. Imagine a constant, 15,000 hertz tone. Are you saying this cannot be cancelled? Of course it can. But a noise which has a rapidly and un
Re:This is possible with two specific caveats. (Score:2)
A system can self-tune over time. (Score:1)
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.).
Re:This is possible with two specific caveats. (Score:2)
Yes, but your point is? There are sound cancellation systems in service which operate over the entire audible range. So clearly this is possible. As you said, latency is not necessarily a problem. So the cancellation may occur within a specific volume, not everywhere, but that's fine as long as the destructive interference occurs near the listener's ear.
My point is that the spectral variations of certain types of sounds are predi
Why did this get approved? (Score:3, Informative)
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.
Re:Why did this get approved? (Score:3, Funny)
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.
You know, something like that should be possible to create, using a special new noise-cancelling material. I think they call it "concrete".
Re:Why did this get approved? (Score:2)
Re:Why did this get approved? (Score:2)
Fan-like noise might be cancellable (Score:1)
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.
LATENCY? (Score:2)
potential use in VOICE RECOGNITION SOFTWARE too (Score:1)
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....
T
Alternative solutions? (Score:2)
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?
What about cancelling jet noise? (Score:1)
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.
Advanced noise cancellation material (Score:2)