I'm aware that the best option for noise cancelling is to buy myself a pair of noise cancelling headphones...
But is there any software available that would use the pc mic and headphones to block background noise?
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.Sign up to join this community
There are basically two methods for noise suppression
Based on my experiences with audio processing and various noise cancellation techniques, I would recommend some good sound-insulated headphones. Typically, these will result in better sound without the necessity of any signal processing tricks that won't work too well anyway.
Not possible for physical/hardware reasons.
Noise canceling headphones work by recording sound and playing a phase inverted sound to cancel it. With a laptop the mic first off sucks, and nicely in front of you this means sound coming from behind you will reach your ears first before it even hits the mic. Then it has to go through the computer onto the slow soundcard (likely a ping of .1 seconds or more) to the speakers where it'll play. This lag time will be too great to deal with.
So it comes down to mainly this:
You and the mic hear different things (in headphones they are in your ears).
Lag time from standard laptop sound cards is big, you often can't even get a guitar amp working well for this reason over your computer (near 0 in the headphones).
This would, no matter how optimized result in a horrible experience.
See this article : Noise Cancelling in Software?.
It's interesting, but has no solution.
It's not actually noise cancelling but Chatterblocker can help you mask/ignore external sounds.
Using MATLAB and this guide / sample code:
you could record the noise you are trying to cancel (to a wav) and build an audio output that would cancel it. You might also be able to modify the code to take the mic input as the noise and have it adaptively generate the output and play it out.
Keep in mind noise cancellation works best with low frequency "mechanical" type noises. High pitch (high frequency) noises are much more difficult to cancel.
It should be possible for a constant sound (eg: fan bearing whine), but as other pointed out, for regular variable sound background environments, it surely won't work well with common hardware and software.
I also strongly doubt the software would have any reliable way of measuring the lag with high precision (for calibration), which is crucial for sound cancelling waves. (Edit: except maybe for doing manual calibration of phase.)
Regular kernels not being real-time also means that the audio lag can vary a little, which will also throw off any working noise cancellation.
Although computers can record and play sound, they were never designed to have the precision and definition necessary to cancel sound waves.
Implementing such a system on PC software might result in something which might increases noise instead of reducing it, so is avoided.
It still remains one of these topics which lend themselves to research and experimentation, even if just for the pleasure of it :)
Also, high end microphones and professional sound hardware can make a lot of difference.
Source: self proclaimed expert in everything.
If the sound you need to cancel is consistent, for example inside an airplane or the hum of a factory, it seems like the computer's lag shouldn't matter, because the sound is the same no matter how late it arrives. The key would be to accurately phase shift the resulting sound in your headphones. For example, one might try adjustable phase shifting software such as on http://freemusicsoftware.org/category/free-vst-effects-2/phase-shifter
You could even record the background noise and then replay it. You would have to adjust the phase until it was the opposite of what your ears hear directly.
If the poor laptop mic was an issue, you could bring along a used SM58 with you cheaply enough.
Any feedback on this idea?