Software Noise Cancellation?
DangerTenor asks: "As I flew around the world, lusting after my coworker's $300 BOSE Quiet Comfort Noise-cancelling headphones, I looked down at my laptop computer and noticed the built-in microphone. Has anyone written or considered writing software to run noise-cancellation based on the built-in mic?"
Here is how noise-dampening works:
A quick overview of sound; all sounds are comprised of varying frequency, and amplitude pressure waves. A sound dampener 'listens' to a sound, and emits it 180 degrees out of phase. This means the crests and troughs of the 2 waves are overlapped, negating one another.
The main issue to be overcome is direction and such that shifts the pitch of sounds coming from a computer. Unless you are using a very high quality, wide pickup mic (which are rather expensive), you are probably not going to be able to get enough sound precision to be able to get the damper working effectively. Also, positioning the mic would take a while to get the best location for maximal damping effect for overall sound. This is still work checking out though cause it may yield greater results than I think it will. However, most computer users do not have high quality mics in the first place (and a $20 mic wont cut it). The more mics used, the more effective this would be due to wider sound coverage.
"What can a thoughtful man hope for mankind on Earth, given the experience of the past million years? Nothing." -Bokonon
Although previous posters were correct in saying that it's impossible to have the speakers cancel sound on the fly, because the delay would cause the inverse wave to be out of sync, I could definitely see writing some software that would cancel constant or regular, repetitive sounds. My only isse is that the built-in mics are generally very low-quality.
Has anyone considered writing software to filter a computer's fan? That would be really cool, and probably pretty easy to do...some little tray program that constantly runs the inverse sound over your speakers...hmmm.
But there is another kind of evil that we must fear most... and that is the indifference of good men.
Mod me offtopic - those damn headphones are worth it.
quis fimum scribit?
NoiseBuster Headset. Spent $40 or so on these a year and half ago. Great for the server room.
m l for some software. That was a 3 second google search for "noise cancellation software". Never used it, but it seems based on the same principles. Not for live listening though.
http://www.spiritcorp.com/noise_cancellation.ht
I am, and always will be, an idiot. Karma: Coma (mostly effected by
You'd be lucky to be able to cancel the sound already coming in on those built-in mics. They pick up lots of vibrations from the computer itself.
except you'd need a really nice microphone, thus nullifying the effort saved on not buying expensive headphones. But it is possible, unlike what some other naysayers claim. I assume you want to cancel generic PC noise, not everything outside EXCEPT what you want to hear (that is almost impossible to begin without over-ear gadgetry or a fixed-head requirement... get big sweaty headphones instead).
What some other people here forget is that by-and-large, the noise created by a PC's fans are stationary signals. A second of training to the ambient noise in the room via an omnidirectional mic will allow you to build a frequency profile. Then, you filter the data against this profile to compensate for the ambience. Of course, you keep updating the profile, as noise levels in the room are constantly changing. One problem is that you have to deal with processing the sound in the frequency domain to compensate, so you have to transfer to and from the time domain in chunks. This all has to be accopmlished in realtime (it's not light on the CPU) and it will introduce a short delay, but the shorter that delay, the less effective it will be.
I think a better solution would be to place the crappy desktop mic (if you aren't using it for telephony) into the case of the PC, where it will work better. Then you could work on reducing the apparent machine noise (including 60Hz hum!)
THIS THING CAN TURN ON A DIME, MACROSSZERO STYLE ALSO FUCK BETA, ~NYORON
i swear to god, thats the smartest thing i have ever heard,......and i watch dateline!
Communication within a circuit is at the speed of light in copper. Transistors take time to flip, but ultimately there's no reason you can't outrace the sound on its one-inch journey through your thick headphones.
Okay, the reason it won't work isn't that the microphone is shitty, which it probably is. It's not that the computer isn't fast enough (which it probably is).
The problem is that the microphone is not near your ear.
In order for noise cancelling speakers to work, they need to maintain a constant and known spatial relationship with your ears relative to the sound source. The only practical way to do this is to locate them at the ear (that's how noise cancelling headphones work).
Thus unless the laptop's microphone is at the loci of both your ears, you're not going to do any better than just add to the racket.
Trees can't go dancing
So do them a big favor
Pretend dancing stinks!
Great Ghu save us from people who think they know more than they actually do!
Indeed.
You are evidently unaware that PC audio processing takes place on chunks of audio as it passes through the sound card's buffers. This is where the latency comes from. And since it would require two buffer trips (read buffer -> phase shift -> write buffer) the latency will be doubled.
Furthermore, the environmental noise sample would need to be taken as close as possible to the point in space where the "dead zone" is to be simulated. This means we'll need to attach two mics to the ears of the listener. It follows then that we'll need to process two independent signals, so double the effective size of your buffers and figure on devoting a few more CPU cycles to the "phase shift" step in the scenario above.
All things considered, with a fast CPU and extremely small buffers you might be able to reduce latency to fifty or sixty milliseconds, but this simply won't suffice for the requested application.
Face it, PC sound cards were designed for making asynchronous beep-beep game noises, not for realtime signal processing. Laptop sound "cards" are even worse.
If you have a Pentium IV or Athlon, you can probably use your computer to make toast too, but it's so impractical, you just wouldn't want to try. Leave it to the specialized devices.
(unrelated, but interesting) A few years ago, I read about a maker in Europe, maybe Airbus, who was developing a jet with lots of microphones and speakers, so that the entire cabin could have noise-cancellation.
Donate background CPU time to fight cancer.
Using ASIO drivers with my SB Audigy I can get ~3ms latency on a full 32 channel audio setup, single mono channel I might be able to do 1ms or less, so at least in theory if you could write an efficient enough filter you could easily do noise canceling. Especially since the thing you most want to cancel are low frequency noise which are rather long in pulse length.
There are 4 boxes to use in the defense of liberty: soap, ballot, jury, ammo. Use in that order. Starting now.
I didn't want to start spouting off signal analysis lingo. But apparently around here it gets you karma.
...all at once.
Okay, you bring up a number of interesting points.
Record some and run it through your favorite MP3 player, with a reasonably sized FFT filter going in realtime.
Not a good idea, MP3 encoding tends to filter out some of the noise...
Watch the FFT display jerk spasmodically. Even the wiggling isn't as regular as you think; if you could do an FFT of the FFT, you'd see that. It's noise, it really is, and even if it sounds to your ear like it's "the same" noise, your computer hears it as anything but.
But what ultimately matters is what that noise sounds like to the ear, and while we can't eliminate the PC noise entirely, we can compensate for an approximation so that it is all that more pleasing to the human listener. While the traces may "jump around" a lot (which an FFT of an FFT won't indicate clearly), what we want is to have a time-decayed sum of the power spectrum. This averages out (over a few frames) energy drift across bands, and emphasizes the stationary energy that is most annoying. We will probably doing this with overlapping windows, up to, lets say, 50ms long(which more than covers 60Hz hum), and window intervals at 4 times that rate (12.5 ms updating).
Noise is really, really dynamic, and you can't predict what it is going to do next.
Exactly. It doesn't autocorrelate, by definition. But then there's the stuff that does...
Oh, and there's no such thing as noise cancellation, by the way, only cancelling certain sounds at certain isolated locations. That's why you need two headphones, one dedicated to each ear, to cancel noise. A single microphone cannot cancel noise for two ears across a set of frequencies, period, especially if it doesn't know where those ears are.
Duh. I never said that my idea could lead to noise elimination, just that it could help.
Again, don't take my word for it, draw it. Draw equally-spaced concentric circles emanating from a point... blah blah blah
Look, the stuff that we're most interested falls below 200Hz, at this point the sound is fairly omnidirectional. So any intelligent compensation will not be in vain. You don't even care about preserving phase. What you're trying to do just a little compensation, allowing the fan noise to fill out frequencies you attentuate in the signal. (During the processing, you don't touch the complex components of the transformed signal, also make sure to window it the same way you windowed the microphone samples for attenuation). Also, there will be issue with expected trip delay, because you might want to be able to do a dry run and see how much contribution (if any) the sound output has on the input to the mic, and what the system delay is. You might want to purposefully filter the filtering information using a delayed copy of the previously outputed sound. And if you're doing that, you'll have to pay attention to clock phase drift between the input and output sections of whatever sound hardware you have (phase unwrapping... ooh fun).
Please try these things before trying to pick them apart; human intuition and wave phenomena are notoriously poor bedfellows.
?! I've been involved in projects recently doing things like this in relation to positional tracking using PSKs. I'm not offering a magic bullet or anything. But everyone here has such a bad attitude. Give me a break.
Now as to whether this could become a product marketable to audiophiles... forget it. As to whether it's worth someone's time to write this software because his PC is too noisy... she'd be better off buying quieter fans.
But it's interesting... not a waste of time if you dig that sort of thing. Just thinking about the response is getting me more excited about it.
THIS THING CAN TURN ON A DIME, MACROSSZERO STYLE ALSO FUCK BETA, ~NYORON
It won't work unless you put a speaker right next to the fan, OR you can guarantee an exact distance to both ears from the fan.
See, not only is the inverse waveform important, but the PHASE as well. Shift ear position 180 degrees out of phase (at 13392 in/s, a 3000 Hz signal will be 180 out of phase by moving 2.232 inches) and the speaker will actually double the sound pressure.
That's why the noise-cancelling headphones work. They are guaranteed a distance from the sensing microphone to the ear. Also, noise-cancelling devices on machinery work because they are very close to the origination point of the noise, so the inverse waveform is nearly on top of the noise waveform.
...