I created an interesting noise reducer for my ChucK Show microphone/guitar controller program. It works by taking the FFT of the input signal, averaging each harmonic individually, and then taking the IFFT of that averaged spectrum. It works pretty well as you can hear in the attached sample. I'm sure it's not a new technique, but anyway I like it.

I have found that an alpha value of 0.5 works fairly well. Lower and you get more noise, higher and you get more artifacts. I'm told that this method is used in an audio file editing program, I forget which one. Try it, it works!

Les_________________"Let's make noise for peace." - KijjazLast edited by Inventor on Fri Jul 10, 2009 5:21 am; edited 2 times in total

I don't get that code at all. Did you make sure to uncheck html?
I have serious doubts about that "for" loop, for a start....

What are you averaging? Averaging in time? In frequency?

Yes, I forgot to disable HTML - I fixed it. The less than sign in a for loop looks like HTML to the forum software, as I'm sure you've noticed. I am averaging in time. It's just a low-pass filter done with complex vector addition. You take a fraction of the running average, add in one minus that fraction of the new sample, and then add them and put them into the running average. This is done for each bin of the FFT. I seem to recall that you previously mentioned familiarity with this type of averaging, Kassen, you told me it's a low-pass filter before IIRC.

That's no low-pass filter, at least not a normal one (in the time domain). I think that if you feed it a pure sine wave of any frequency, it will come out identical (in the long run, not in the first iterations of the process, let's say the first second or so). This thing is a low-pass filter for changes in the amplitude of each frequency band.

Say you have a sine wave at 440Hz plus some noise, then the spectrum will show an almost constant amplitude at 440Hz but a varying one at all other frequencies (in particular the higher ones), e.g. 0.01, -0.004, 0.007, -0.009, etc. Then these values get low-pass filtered, so you end up with your original sine wave, but less noise.

Doesn't work for all signals, though. This thing needs several iterations of constant amplitudes to adapt, so if you feed it drums, it will take soften the attack.

I think you are right, TGV, it's a bit like a filter on the analysis signal. We could even have higher order fiters on that, even highpass filters that would only let through the difference in signal, that might give some very unusual effects, I should experiment with it._________________Kassen

Les used this filter on his ChucK show yesterday, or at least that's what I understood. A recording of the show is to be found here, so you can listen to what it does (and for comparison, shows before that don't have the filter)._________________Jan

That's no low-pass filter, at least not a normal one (in the time domain). I think that if you feed it a pure sine wave of any frequency, it will come out identical (in the long run, not in the first iterations of the process, let's say the first second or so). This thing is a low-pass filter for changes in the amplitude of each frequency band.

Yes, averaging a series of numbers is a low pass filter. I think that's what Inventor said. He didn't say this was a low pass in the time domain, he said it is an adaptive noise reducer, which it is. Quite a good idea, IMHO._________________--Howard
my music and other stuff

I listened to the noise reduced ChucK Show. Great show, Les. Anyway, the noise reducer really removes a lot of noise and the voices sound much better than on previous shows.

Still, there is some whine caused I think from some power main harmonics. Your adaptive filter won't get rid of those constant signals because they are seen as valid inputs signals.

You could get rid of the whine with a fixed equalizer, but an adaptive one would be more fun and useful. What happens if you differentiate the frequency domain coefficients as well?_________________--Howard
my music and other stuff

What Howard says is even more true than might be apparent. That's because two weeks ago I switched microphones from the Emac's mic which is good for a computer mic to a homemade mic / guitar amp in a little black box, and boy is that mic noisy! All the noise was disguised somewhat last week by the hippy trippy vocoder, so last night's show was really the first clean-channel broadcast with the new mic and the noise reducer.

What I mean to say by this is that not only is the new setup quieter, it's also working with an even noisier input than we've had in the past. So yes to what Howard says, only even more so.

The whine is there at an averaging constant of 0.5, and gets noticeably louder at higher values. The mic is running off of a 9V battery, so I wonder if the whine is actually from the eMac's cooling fan which is near the mic physically, or if it is actually some kind of mathematical artifact. I just don't know really.

Truth be told, I invent or reinvent things like this all the time but I often lack the theoretical knowledge to fully understand how things work. I guess that's why I was speaking kind of analogously when I called it a low pass filter. To be precise it's a low pass filter applied in the frequency domain, which is a rather strange thing to do - but hey it works!

Anyway thanks for the comments all, I appreciate the observations. This kind of stuff is part of what makes my music hobby so much fun!

Here, attached is a complete self-contained noise reducer test program for anyoone who wishes to experiment with this technique. It adds noise to the microphone input and then alternates every five seconds between "adc + noise => dac" and "adc + noise => NR => dac". The difference is quite noticeable.

There are three parameters at the top of the file that you can adjust to test things out, and you can increase the order of the "filter" by duplicating the filter averaging line inside the for loop.

I'm now thinking about the differentiation comments that Kassen and mosc made. If there is some whine that is constant, like power supply harmonics, then a differentiator should remove them because they are not changing in time. So it might be good to do both - first reduce the noise with averaging, then reduce the constant terms with some sort of differentiation. I wonder if simply subtracting the new samples would do this?_________________"Let's make noise for peace." - Kijjaz

You could use the same technique other noise cancellers use: finger printing. Take a piece of audio without meaningful signal, and subtract its spectrum from your recording. It's not quite as simple as I describe (you need the two signals to be in phase), but that will take care of some noise and the whine, hum, etc. Here is a description how CEDAR's (rather expensive) software does it: http://www.cedaraudio.com/intro/dehiss_intro.html

Finger printing is a rather static technique. There is a training sequence of some sort, either silence or a know signal. As the channel changes you have to retrain. This technique is used in modems and other analog telecommunication circuits. Inventor's technique is. on the other hand, truly adaptive._________________--Howard
my music and other stuff

Under normal circumstances, noise, whine, and hum are "static": it's the circuitry and microphones that generate it, and they don't change (at least not perceptibly). The adaptive technique has an advantage: you don't need a finger print, but it has problems with transients (feed it a snare or kick and you'll see) and it cannot take out whine and hum, since their harmonic amplitudes are almost constant over time. That's why I suggested it.

Anyway, there is no reason to use just one of them. You could use the finger-print technique on the end signal, and adaptive filtering on the mike, or something like that.

Still, there is some whine caused I think from some power main harmonics. Your adaptive filter won't get rid of those constant signals because they are seen as valid inputs signals.

You could get rid of the whine with a fixed equalizer, but an adaptive one would be more fun and useful. What happens if you differentiate the frequency domain coefficients as well?

Call me lazy but in that case I'd first try sorting out the ground/mains situation before breaking out the DSP. Typically that takes less time and you save on headroom and sound quality._________________Kassen

In this case, as a listener, to me it seems that the airconditioner and a computer fan are the main sources of noise ... which would be something in favor of an adaptive technique. I must say that I dont quite understand what happens in the code, but it does filter noise and it doesn't give too many artifacts ... so not bad at all I'd say._________________Jan

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot vote in polls in this forumYou cannot attach files in this forumYou can download files in this forum

Please support our site. If you click through and buy from our affiliate partners, we earn a small commission.