DSPRelated.com
Forums

Ideas about removing noise/hum

Started by noodle22 April 16, 2009
This question gets asked all the time and I have read many of the answers
and tried a number of things but I am unable to get satisfactory results. 
The issue is that I am recording an audio signal and processing it,
however, when I use a different mic, I get a different background spectrum.
 One of my mics pics up a really strong 60hz signal.  Another one seems to
miss the low frequency signal but pick up some higher ones pretty
consistently.

Method 1: IIR Notch Filter
The most recent method I've tried was a notch IIR filter from dsp guid
(http://www.dspguide.com/ch19/3.htm).  With one mic, it seemed to remove
the 60Hz hum but with the other mic, it removed all the low frequency
signals.  Just some details one the numbers I was using

Fs = 22050
f = 60/22050
I tired BW = 5/22050 but it made no difference until my DB > 0.05.  I
seemed to get the best results with mic 1 when BW=0.5

Method 2: FFT Spectrum subtraction
Anyway, I'm not sure that a notch filter is really the way to go.  I also
tried using FFT to take a sample of the background spectrum and then
subtract it from each new incoming signal.  The problem is that my buffer
size is only 1024 and that is too small to get a good FFT (at least as far
as I can tell).

Should I be looking into another method?  I have heard people mention
Kalman filter and linear-quadratic regulator but I really don't know
anything about these concepts.

Thanks for any assistence
On Apr 16, 10:21&#4294967295;pm, "noodle22" <jw970...@yahoo.com> wrote:
> This question gets asked all the time and I have read many of the answers > and tried a number of things but I am unable to get satisfactory results. > The issue is that I am recording an audio signal and processing it, > however, when I use a different mic, I get a different background spectrum. > &#4294967295;One of my mics pics up a really strong 60hz signal. &#4294967295;Another one seems to > miss the low frequency signal but pick up some higher ones pretty > consistently. > > Method 1: IIR Notch Filter > The most recent method I've tried was a notch IIR filter from dsp guid > (http://www.dspguide.com/ch19/3.htm). &#4294967295;With one mic, it seemed to remove > the 60Hz hum but with the other mic, it removed all the low frequency > signals. &#4294967295;Just some details one the numbers I was using > > Fs = 22050 > f = 60/22050 > I tired BW = 5/22050 but it made no difference until my DB > 0.05. &#4294967295;I > seemed to get the best results with mic 1 when BW=0.5 > > Method 2: FFT Spectrum subtraction > Anyway, I'm not sure that a notch filter is really the way to go. &#4294967295;I also > tried using FFT to take a sample of the background spectrum and then > subtract it from each new incoming signal. &#4294967295;The problem is that my buffer > size is only 1024 and that is too small to get a good FFT (at least as far > as I can tell). > > Should I be looking into another method? &#4294967295;I have heard people mention > Kalman filter and linear-quadratic regulator but I really don't know > anything about these concepts. > > Thanks for any assistence
Adaptive filter. Dirk
On 17 Apr, 04:21, "noodle22" <jw970...@yahoo.com> wrote:
> This question gets asked all the time and I have read many of the answers > and tried a number of things but I am unable to get satisfactory results. > The issue is that I am recording an audio signal and processing it, > however, when I use a different mic, I get a different background spectrum. > &#4294967295;One of my mics pics up a really strong 60hz signal. &#4294967295;Another one seems to > miss the low frequency signal but pick up some higher ones pretty > consistently.
Individual differences in hardware instrumenst can be a nuisance. In an ideal world, you might try and find out why the mic picks up th 60 Hz (sound like poor shielding to me). The other mic (different brand or make?) seems to have a different frequency response. Check out the different mic's data sheets, if you have them. Maybe these differences in frequency bands are documented.
> Method 1: IIR Notch Filter > The most recent method I've tried was a notch IIR filter from dsp guid > (http://www.dspguide.com/ch19/3.htm). &#4294967295;With one mic, it seemed to remove > the 60Hz hum but with the other mic, it removed all the low frequency > signals. &#4294967295;Just some details one the numbers I was using > > Fs = 22050 > f = 60/22050 > I tired BW = 5/22050 but it made no difference until my DB > 0.05. &#4294967295;I > seemed to get the best results with mic 1 when BW=0.5
Depends on how accurately you estimated the frequency of the hum, the numerical accuracy of your computations (can be 'poor' if you use e.g. 16 bit ixed-point data) and the abtual bandwidth of the 60Hz hum. Can't see why you would want to use this filter with mic 2, though, if it doesn't pick up the hum.
> Method 2: FFT Spectrum subtraction > Anyway, I'm not sure that a notch filter is really the way to go. &#4294967295;I also > tried using FFT to take a sample of the background spectrum and then > subtract it from each new incoming signal. &#4294967295;The problem is that my buffer > size is only 1024 and that is too small to get a good FFT (at least as far > as I can tell).
This is a bad method. Random noise gives a spectrum with random phase. So your reference spectrum will have a different phase than the noise spectrum you try to remove. Not a good thing!
> Should I be looking into another method?
Yes.
>&#4294967295;I have heard people mention > Kalman filter and linear-quadratic regulator but I really don't know > anything about these concepts.
There are standard methods for these sorts of things. Adaptive filters, as somebody already suggested, ought to be a good place to start. Rune
Thank you both very much.  I really appreciate it as I did not really know
where to go next.  I will look into adaptive filters. 

Cheers
Joel 
noodle22 wrote:
> Thank you both very much. I really appreciate it as I did not really know > where to go next. I will look into adaptive filters.
Look first into preventing the noise from entering the system. "An ounce of prevention is worth a pound of cure." 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;
On Apr 17, 2:21&#4294967295;pm, "noodle22" <jw970...@yahoo.com> wrote:
> This question gets asked all the time and I have read many of the answers > and tried a number of things but I am unable to get satisfactory results. > The issue is that I am recording an audio signal and processing it, > however, when I use a different mic, I get a different background spectrum. > &#4294967295;One of my mics pics up a really strong 60hz signal. &#4294967295;Another one seems to > miss the low frequency signal but pick up some higher ones pretty > consistently. > > Method 1: IIR Notch Filter > The most recent method I've tried was a notch IIR filter from dsp guid > (http://www.dspguide.com/ch19/3.htm). &#4294967295;With one mic, it seemed to remove > the 60Hz hum but with the other mic, it removed all the low frequency > signals. &#4294967295;Just some details one the numbers I was using > > Fs = 22050 > f = 60/22050 > I tired BW = 5/22050 but it made no difference until my DB > 0.05. &#4294967295;I > seemed to get the best results with mic 1 when BW=0.5 > > Method 2: FFT Spectrum subtraction > Anyway, I'm not sure that a notch filter is really the way to go. &#4294967295;I also > tried using FFT to take a sample of the background spectrum and then > subtract it from each new incoming signal. &#4294967295;The problem is that my buffer > size is only 1024 and that is too small to get a good FFT (at least as far > as I can tell). > > Should I be looking into another method? &#4294967295;I have heard people mention > Kalman filter and linear-quadratic regulator but I really don't know > anything about these concepts. > > Thanks for any assistence
Best to remove the hum before any recording using good earthing techniques. Watch out for earth loops. Hardy
On Apr 17, 5:45&#4294967295;pm, HardySpicer <gyansor...@gmail.com> wrote:
> On Apr 17, 2:21&#4294967295;pm, "noodle22" <jw970...@yahoo.com> wrote: > > > > > > > This question gets asked all the time and I have read many of the answers > > and tried a number of things but I am unable to get satisfactory results. > > The issue is that I am recording an audio signal and processing it, > > however, when I use a different mic, I get a different background spectrum. > > &#4294967295;One of my mics pics up a really strong 60hz signal. &#4294967295;Another one seems to > > miss the low frequency signal but pick up some higher ones pretty > > consistently. > > > Method 1: IIR Notch Filter > > The most recent method I've tried was a notch IIR filter from dsp guid > > (http://www.dspguide.com/ch19/3.htm). &#4294967295;With one mic, it seemed to remove > > the 60Hz hum but with the other mic, it removed all the low frequency > > signals. &#4294967295;Just some details one the numbers I was using > > > Fs = 22050 > > f = 60/22050 > > I tired BW = 5/22050 but it made no difference until my DB > 0.05. &#4294967295;I > > seemed to get the best results with mic 1 when BW=0.5 > > > Method 2: FFT Spectrum subtraction > > Anyway, I'm not sure that a notch filter is really the way to go. &#4294967295;I also > > tried using FFT to take a sample of the background spectrum and then > > subtract it from each new incoming signal. &#4294967295;The problem is that my buffer > > size is only 1024 and that is too small to get a good FFT (at least as far > > as I can tell). > > > Should I be looking into another method? &#4294967295;I have heard people mention > > Kalman filter and linear-quadratic regulator but I really don't know > > anything about these concepts. > > > Thanks for any assistence > > Best to remove the hum before any recording using good earthing > techniques. Watch out for earth loops. > > Hardy- Hide quoted text - > > - Show quoted text -
I have played around with this in the past, and you need to be careful about time/frequency tradeoffs. If you make a 60Hz notch filter narrow enough to remove the hum without removing too much low-frequency spectrum, then you have a filter with a very long impulse response, and the ringing of this very can be very audible on transients. One interesting thing to think about is to use a direct 60Hz reference signal from the wall, and use an adaptive filter to dynamically adjust it's amplitude/phase to cancel the hum on the mic output. Because this cancellation is not really a signal-path filter, it will not have the ringing problem outlined above. But one problem you will then have is that the adaptive algorithm will be affected by other frequencies in the mic signal, and you might get an effect similar to ringing becasue when the music stops, the amplitude and phase of the 60 Hz cancellation signal are slightly wrong, and you would hear the hum briefly before the filter adapts and kills it again. There are various tricks to avoid this; probably the easiest one is to only adapt the filter when the mic input is below some threshold, and freeze the adaptation otherwise (if a bit of hum gets through during music it will likely be masked anyway). There will always be some pathological cases, for example when the bass player hits a 60Hz note with an amplitude similar to the hum amplitude. And we all know that bass players tend to be pathological. Bob
I have no control over the input (when deployed) and therefore cannot try
fixing the problem at the source.  With the adaptive filter, I am a little
confused.  Do I need to have constantly have two inputs with it (ie just
the noise reference and then one of the combined signal noise)?  If this is
the case, then it might not be possible since I only have one signal to
work with (basically, a wav file from one mic).  I could take some samples
at the beginning of just the background without any signal to use as a
reference but I imagine this would run into phase issues.
Robert Adams wrote:

   ...

> I have played around with this in the past, and you need to be careful > about time/frequency tradeoffs. If you make a 60Hz notch filter narrow > enough to remove the hum without removing too much low-frequency > spectrum, then you have a filter with a very long impulse response, > and the ringing of this very can be very audible on transients. > > One interesting thing to think about is to use a direct 60Hz reference > signal from the wall, and use an adaptive filter to dynamically adjust > it's amplitude/phase to cancel the hum on the mic output. Because this > cancellation is not really a signal-path filter, it will not have the > ringing problem outlined above. > > > But one problem you will then have is that the adaptive algorithm > will be affected by other frequencies in the mic signal, and you might > get an effect similar to ringing becasue when the music stops, the > amplitude and phase of the 60 Hz cancellation signal are slightly > wrong, and you would hear the hum briefly before the filter adapts and > kills it again. > > There are various tricks to avoid this; probably the easiest one is to > only adapt the filter when the mic input is below some threshold, and > freeze the adaptation otherwise (if a bit of hum gets through during > music it will likely be masked anyway). > > There will always be some pathological cases, for example when the > bass player hits a 60Hz note with an amplitude similar to the hum > amplitude. And we all know that bass players tend to be pathological.
Could you compare the care needed to do what you describe to that needed to avoid the hum in the first place? We are each attracted to techniques we know best. I, for one, would rather eliminate hum with the well known methods used in recording studios than try to remove it further down the signal chain. 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;
noodle22 wrote:
> I have no control over the input (when deployed) and therefore cannot try > fixing the problem at the source. With the adaptive filter, I am a little > confused. Do I need to have constantly have two inputs with it (ie just > the noise reference and then one of the combined signal noise)? If this is > the case, then it might not be possible since I only have one signal to > work with (basically, a wav file from one mic). I could take some samples > at the beginning of just the background without any signal to use as a > reference but I imagine this would run into phase issues.
It seems that the sloppy work of your colleagues has saddled you with a nasty problem. I hope you appropriately "thank" them. 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;