in Projects, Programming, Technology

Software Noise Cancellation

This is another old lazyweb.org request that I posted and had a lot of interest in. I post it again here because my old blog is now defunct. The end result of this one was “No, it can’t be done.” Basically, the analog to digital to analog conversion that your sound card (and software) would need to do to cancel out the signal can’t be done in real time. If you find something that can approximate this, please do post a comment!

“With a full duplex sound card (capable of playing and recording simultaneously), it seems to me it should be feasible to implement noise cancellation in software on a PC.

Bose has (expensive) headphones that do something like this, if I understand them correctly.

I would like to be able to listen to audio on my laptop and cancel out the sound of the truck parked outside my window. Screaming babies and car alarms would be good test cases as well.

Would that be a wicked Winamp plug-in or what?”

Write a Comment

Comment

11 Comments

  1. Ain’t gonna happen.

    The basic problem you have is one of timing. For active noise cancellation, you basically have to flip the wave 180 degrees out of phase. There is no way that you could digitize the sound, flip it, and send it back out fast enough MUCH LESS doing the even tougher job of syncing the wave forms.

    You certainly don’t have a prayer with PC hardware and Windows. On a Mac your odds would increase a few orders of magnitude… Problem is 100,000,000,000,000 to 1 is about the same as 1,000,000,000,000 to 1.

    NOW having said the above- If the card had a DSP that you could talk to natively, your odds go up dramatically. Heck, you might get to 1,000,000,000 to 1.

    Sorry

  2. Adam,

    I’m intersted in a domain you own and I located in the united states. I’ve sent several emails to the domain i’m interested in and like you to respond if you have time.

    Thanks for your time and attention.
    JR

  3. Look into other active-noise-cancelling headphones. Bose has expensive ones, but others do just as well for a lot less $$, according to tests that I can’t id specifically. Radio Shack and The Discovery Store are 2 places that carry them for less than $100.

  4. I’ve been thinking about this very idea for a while now, and though I still think it can be done and I still think it’d be great, I’m no closer to making it happen.

    I started with a project that I stumbled across on Code Guru [http://www.codeguru.com/Cpp/G-M/multimedia/comments.php/c1587/?thread=20114].

    OK, so we have realtime sound coming in, we have the wave and we can process it in real time. Great. It’s even already replaying the sound back out. It needs a slight speed boost and it needs to invert the wave form. This is where I fall down.

    I think if I could spend a solid week working on the problem I might get somewhere, but sound processing has nothing to do with my day job and the evenings are short enough already.

    Which is a shame, because I desperately want to block out the ambient noise in our office (not just the ambient noise, but also the chatter, the phones etc which is why I don’t just buy a pair of Sony headphones).

  5. Preset Noise Cancellation.

    What about using preset recorded noise samples that a user can select? This means that a user can play the noise cancellation file overlay with or without additional audio being played. I presume this can be done with a Winamp plugin or sorts?

  6. I’m fairly sure that unless the pre-recorded sound perfectly matches the current ambient soundwaves, it won’t work. I think you’d just end up with a bunch of annoying noise behind your music or whatever you’re listening to. Man I do whish was possible, but after reading this blog, it sounds like PC’s just don’t have the processing turnover speed when it comes to dealing with audio in real-time.

  7. This is for the first response…
    I already made a C program to Active Noise Cancelling…
    You don’t have any idea of what are you talking about!
    ASS HOLE!

  8. i agree with the theory that the analog to digital audio conversion would affect the “Realtime-ness” of the output sound.
    Isn’t there any way that one could do this with simple circuitry, like you would convert AC to DC with some diodes? i think it is totally possible if you could just get past the conversion and keep it analog all the way through.

  9. Just my iniaial thoughts, but….
    I think part of the problem with doing this using speakers over a large area such as an office is that the sound waves are going all over the place and it would be hard to get a large coverage area without lots of mics and lots of speakers with unique outputs.
    Not only are you dealing with speed of processing but speed of sound. The “cancelling” waves have to travel to get to the natural wave it’s trying to cancel, hence adding noise to the spaces in the room where it’s not being absorbed by a cancellation. Then taking into accound all of the other energy it encounters on the way… lots to think about.

    It’s easier with headphones because the area you’re trying to cover can me approximated pretty well with a single point per ear.

  10. Even the nicest Noise cancelling headphones do not cancel out outlier sounds such as babies screaming or trucks beeping as they back up. They DO however wipe out pink noise and constant hums, etc, such as on airplanes. The great thing about these annoying types of constant noise is exactly that. They are fairly uniform over time. This means the software/pc DOESN’T have to do it in realtime. Because the noise this second is almost exactly the same as the noise 1 second ago. Therefore it can digitized, flipped, phase matched with the unflipped signal and played out. under the assumption that by the time it gets to your ear the ambient noise will still be the same.

    Why does it need to be digitized at all? All you are doing is reversing the phase. Riddle me this: Mic -> Amp -> polarity reversal -> Speaker. No processing. Period.