DSPRelated.com
Forums

Noise Subtraction

Started by Unknown August 11, 2005
My boss showed me a feature on some commercial software he wants me to
incorporate into our system.

Basically, you show the software a patch of noise (samples w/o the
signal).  Later, the program lets you subtracts that noise from a
signal contaminated by that same noise.  IOW, subtract the fan noise
from the voice acquired from a microphone sitting next to a fan.

I'm not sure how this is done.  But I think I can (re)create the system
by taking the batch of noise acquire and putting it in the form of the
"Weiner-Hopf" equation.

C_k[x]**xy = Sigma(h_j * C_k-j ** xx, j = 0..M)

where C**xy is the cross-correlation between x&y, and C**xx is the
autocorrelation of x.

Then inverting the matix by the "Levinson-Durbin" method and using the
results to construct an FIR filter.  But I'm also a little fuzzy about
the FIR filter part.  I keep reading about the "reflection
coefficients" which is really confusing me.  Is the output of the LD
method (h_j) just the constants of the an FIR filter?

Also, I'm not sure if that is the correct method to use.  I've been
reading a lot about LPC (linear predictive coding), MEM (maximum
entropy method), and also something else call spectra subtraction.
Could either of these method be a better way to remove the noise from
my signal?

Anyway, could somebody give me some hints about the correct way to
remove such identified noise from a signal contaminate by that noise?

Thanks in advance,
Jeff Stout

<jstout@ncon.com> wrote in message 
news:1123776508.188773.199810@f14g2000cwb.googlegroups.com...
> My boss showed me a feature on some commercial software he wants me to > incorporate into our system. > > Basically, you show the software a patch of noise (samples w/o the > signal). Later, the program lets you subtracts that noise from a > signal contaminated by that same noise. IOW, subtract the fan noise > from the voice acquired from a microphone sitting next to a fan. > > I'm not sure how this is done. But I think I can (re)create the system > by taking the batch of noise acquire and putting it in the form of the > "Weiner-Hopf" equation. > > C_k[x]**xy = Sigma(h_j * C_k-j ** xx, j = 0..M) > > where C**xy is the cross-correlation between x&y, and C**xx is the > autocorrelation of x. > > Then inverting the matix by the "Levinson-Durbin" method and using the > results to construct an FIR filter. But I'm also a little fuzzy about > the FIR filter part. I keep reading about the "reflection > coefficients" which is really confusing me. Is the output of the LD > method (h_j) just the constants of the an FIR filter? > > Also, I'm not sure if that is the correct method to use. I've been > reading a lot about LPC (linear predictive coding), MEM (maximum > entropy method), and also something else call spectra subtraction. > Could either of these method be a better way to remove the noise from > my signal? > > Anyway, could somebody give me some hints about the correct way to > remove such identified noise from a signal contaminate by that noise? >
This suggestion very much reflects *my* attitude and may not resonate with everyone: First, forget about the fancy names of methods and get down to the basics. There is no method that will remove broadband noise unless the noise in the desired signal is identically the same as the noise to be subtracted. This is pretty hard to do with broadband / random noise because any relative time delays in the two noises causes them to add and not subtract. Noise cancelling headphones work because they use a sensor that is very close to the output (thus insignificant delay). Noise that is mostly periodic can be subtracted as long as it's relatively stable and if you have a reference signal for the noise alone. So, if the fan's noise is mostly machinery noise and periodic then you can do something. This is because relative delay won't so easily destroy the quality of the "replica" you create for subtraction. An accelerometer on the fan could provide the reference signal. input--------->------------------------------->(+)----+----> e[n] ^ | . ^ | . | | . | | noise ->----------------------->[LMS]------------+ | ^ | | | +--------------------+ Adaptive line-cancelling filter LMS adaptive filter adjusts to minimize e[n] which cancels noise in the signal by subtracting filtered version of noise. The LMS filter adjusts the amplitude and phase of its periodic input components to cancel the periodic noise component in the signal. If the desired signal is mostly periodic and the noise is broadband, then you can filter out all the other frequencies and reduce the random noise in the signal. +--------------------+ | | | | | | input------+---------------------|------------>(+)----+----> e[n] | | ^ | | | | +-----------+ v | +---| Delay |-->[LMS]------------+----------> o[n] +-----------+ Adaptive enhancer LMS adaptive filter adjusts to minimize e[n] which cancels signal o[n] ideally contains only signal Once you have these fundamentals well in mind then you can decide how to best implement including whatever is in the block labeled LMS Fred
[snip]

>If the desired signal is mostly periodic and the noise is broadband, then >you can filter out all the other frequencies and reduce the random noise in >the signal. > > > +--------------------+ > | | > | | > | | > input------+------------------=AD---|------------>(+)----+----> e[n] > | | ^ > | | | > | +-----------+ v | > +---| Delay |-->[LMS]------------+--------=AD--> o[n] > +-----------+ > > > Adaptive enhancer > > > LMS adaptive filter adjusts to minimize e[n] which cancels signal > > > o[n] ideally contains only signal > > >Once you have these fundamentals well in mind then you can decide how to >best implement including whatever is in the block labeled LMS > > >Fred
I know a little about adaptive LMS filters. In fact one of the process in our product will use an LMS filter for equilization. The problem is my boss saw a batch trained filter in some other software and wants that feature for our product. He wants to be able to grab a few seconds of noise then tell the software, block noise that looks like that. At this point it doesn't matter if it works well or not; he just wants that feature. The users of our system will get to decide if it works or not. Jeff Stout
jstout@ncon.com wrote:
> [snip] > > >>If the desired signal is mostly periodic and the noise is broadband, then >>you can filter out all the other frequencies and reduce the random noise in >>the signal. >> >> >> +--------------------+ >> | | >> | | >> | | >> input------+------------------&#4294967295;---|------------>(+)----+----> e[n] >> | | ^ >> | | | >> | +-----------+ v | >> +---| Delay |-->[LMS]------------+--------&#4294967295;--> o[n] >> +-----------+ >> >> >> Adaptive enhancer >> >> >> LMS adaptive filter adjusts to minimize e[n] which cancels signal >> >> >> o[n] ideally contains only signal >> >> >>Once you have these fundamentals well in mind then you can decide how to >>best implement including whatever is in the block labeled LMS >> >> >>Fred > > > I know a little about adaptive LMS filters. In fact one of the process > in our product will use an LMS filter for equilization. The problem is > my boss saw a batch trained filter in some other software and wants > that feature for our product. He wants to be able to grab a few > seconds of noise then tell the software, block noise that looks like > that. At this point it doesn't matter if it works well or not; he just > wants that feature. > > The users of our system will get to decide if it works or not.
For a first cut, determine the amplitude spectrum of the noise (A=sqrt(Re^2+Im^2) ignoring phase, Replace the magnitude of each component with the difference between it and the largest one, and do a real-valued IFFT. Use the resulting samples as the coefficients of an FIR. It will attenuate most where the noise is strongest, and least where the noise is weak. There are some signals it won't mess up too badly. Is a consultant in order? Jerry -- Engineering is the art of making what you want from things you can get. &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;
"Fred Marshall" <fmarshallx@remove_the_x.acm.org> wrote in message 
news:sNidnezpEIdsAWbfRVn-ow@centurytel.net...
> > <jstout@ncon.com> wrote in message > news:1123776508.188773.199810@f14g2000cwb.googlegroups.com... >> My boss showed me a feature on some commercial software he wants me to >> incorporate into our system. >> > > This suggestion very much reflects *my* attitude and may not resonate with > everyone: > > There is no method that will remove broadband noise unless the noise in the > desired signal is identically the same as the noise to be subtracted. This is > pretty hard to do with broadband / random noise because any relative time > delays in the two noises causes them to add and not subtract.
I would tend to disagree with this. Using frequency domain techniques, noise, even broadband "random" noise, can be removed to the signal within reason. There are often some artifacts that result, especially if the original SNR is low and you try to remove a lot of the noise. But within reason, this technique works quite well.
<jstout@ncon.com> wrote in message 
news:1123776508.188773.199810@f14g2000cwb.googlegroups.com...
> My boss showed me a feature on some commercial software he wants me to > incorporate into our system. > > Basically, you show the software a patch of noise (samples w/o the > signal). Later, the program lets you subtracts that noise from a > signal contaminated by that same noise. IOW, subtract the fan noise > from the voice acquired from a microphone sitting next to a fan. > > I'm not sure how this is done. But I think I can (re)create the system > by taking the batch of noise acquire and putting it in the form of the > "Weiner-Hopf" equation. > > C_k[x]**xy = Sigma(h_j * C_k-j ** xx, j = 0..M) > > where C**xy is the cross-correlation between x&y, and C**xx is the > autocorrelation of x. > > Then inverting the matix by the "Levinson-Durbin" method and using the > results to construct an FIR filter. But I'm also a little fuzzy about > the FIR filter part. I keep reading about the "reflection > coefficients" which is really confusing me. Is the output of the LD > method (h_j) just the constants of the an FIR filter? > > Also, I'm not sure if that is the correct method to use. I've been > reading a lot about LPC (linear predictive coding), MEM (maximum > entropy method), and also something else call spectra subtraction. > Could either of these method be a better way to remove the noise from > my signal? > > Anyway, could somebody give me some hints about the correct way to > remove such identified noise from a signal contaminate by that noise?
If you are interested in a "buy" instead of "build" approach, you might consider http://www.dspalgorithms.com/products/nr.html.
<jstout@ncon.com> wrote in message 
news:1123776508.188773.199810@f14g2000cwb.googlegroups.com...
> Anyway, could somebody give me some hints about the correct way to > remove such identified noise from a signal contaminate by that noise?
Sure -- the magic Google words are "spectral subtraction". Basically, you just reduce the magnitude of frequency components in windowed blocks of the signal, to subtract the estimated noise spectrum. The longer your blocks are, the better it works. -- Matt
On 11 Aug 2005 09:08:28 -0700, jstout@ncon.com wrote:

>My boss showed me a feature on some commercial software he wants me to >incorporate into our system. > >Basically, you show the software a patch of noise (samples w/o the >signal). Later, the program lets you subtracts that noise from a >signal contaminated by that same noise. IOW, subtract the fan noise >from the voice acquired from a microphone sitting next to a fan.
This feature is in most (all?) audio/.wav file editor programs, from earlier Goldwave and Cool Edit versions to the present. The open-source editor Audacity has it (there are limitations on how you can use the source code, read the licenses and whatnot): http://audacity.sourceforge.net/about/features The second line under "Effects" says "Remove static, hiss, hum, or other constant background noises." The keyword for good results is constant. Noise that varies in volume is much harder than a constant noise, hum or buzz. Specifically, a fan produces noise that varies enough in volume from moment to moment that it's rather diffucult to undo. Electronic noise from a mic preamp (or zener diode) and tape hiss are both very 'good', constant sources of noise, and this method does remarkably well with substantially reducing them. Furthermore, any recording that has gone through compression or automatic volume/level control after the noise is added will be very diffucult, because now the noise level is always changing. If you can 'undo' the compression, the noise reduction then might work better, but undoing compression is rather diffucult.
>Also, I'm not sure if that is the correct method to use. I've been >reading a lot about LPC (linear predictive coding), MEM (maximum >entropy method), and also something else call spectra subtraction. >Could either of these method be a better way to remove the noise from >my signal?
Spectral subtraction is the method universally used for constant noise. There are also other methods specifically for for other kinds of noises, such as the pops and clicks from vinyl LP's, or the constant 'bacon frying' crackles of earlier 78RPM records. These are two separate things, and are called declicking and decrackling, respectively.
>Anyway, could somebody give me some hints about the correct way to >remove such identified noise from a signal contaminate by that noise?
Take a section of the recording with just the noise, and take an FFT of this. Each FFT bin tells how much noise is in that frequency range. Then you take a sliding FFT over the whole recording: FFT a short section of the recording, then subtract the bin values of the noise-only FFT, then do an IFFT to recreate the time values with the noise removed. Get an audio editor and play around with it. You'll be able to create and hear all the artifacts related to this effect. At full reduction and on a signal with a lot of noise there's a strong 'underwater' sound or swishing effect added to the denoised sound, similar to badly-encoded or low bitrate mp3's (it's the diddling with the spectrum with FFT's that causes it). So it's actually a tradeoff between doing less noise reduction and creating these artifacts.
> >Thanks in advance, >Jeff Stout
----- http://www.mindspring.com/~benbradley
<jstout@ncon.com> wrote in message 
news:1123791303.274063.317290@g49g2000cwa.googlegroups.com...
[snip]

I know a little about adaptive LMS filters.  In fact one of the process
in our product will use an LMS filter for equilization.  The problem is
my boss saw a batch trained filter in some other software and wants
that feature for our product.  He wants to be able to grab a few
seconds of noise then tell the software, block noise that looks like
that. At this point it doesn't matter if it works well or not; he just
wants that feature.

The users of our system will get to decide if it works or not.

Jeff Stout

Jeff,

You can probably do that.  It would only work for periodic noises.

Fred


"Jon Harris" <jon99_harris7@hotmail.com> wrote in message 
news:8ZTKe.28995$7d.6899@trnddc08...
> "Fred Marshall" <fmarshallx@remove_the_x.acm.org> wrote in message > news:sNidnezpEIdsAWbfRVn-ow@centurytel.net... >> >> <jstout@ncon.com> wrote in message >> news:1123776508.188773.199810@f14g2000cwb.googlegroups.com... >>> My boss showed me a feature on some commercial software he wants me to >>> incorporate into our system. >>> >> >> This suggestion very much reflects *my* attitude and may not resonate >> with everyone: >> >> There is no method that will remove broadband noise unless the noise in >> the desired signal is identically the same as the noise to be subtracted. >> This is pretty hard to do with broadband / random noise because any >> relative time delays in the two noises causes them to add and not >> subtract. > > I would tend to disagree with this. Using frequency domain techniques, > noise, even broadband "random" noise, can be removed to the signal within > reason. There are often some artifacts that result, especially if the > original SNR is low and you try to remove a lot of the noise. But within > reason, this technique works quite well.
Jon, Sorry if I wasn't clear. I meant in context: I didn't mean "filter", I meant "subtract". In order to subtract broadband noise you have to have a real time reference. I think I said that can be done. So, yes a "frequency domain" method called bandstop filtering will work if the signal is periodic and thus amenable to bandpass filtering to remove noise. This is the classical case. In this case, a reference signal for the noise isn't needed. Fred