Kyma Forum
  Kyma Sound Exchange
  Wiener Filtering

Post New Topic  Post A Reply
profile | register | preferences | faq | search

next newest topic | next oldest topic
Author Topic:   Wiener Filtering
David McClain
Member
posted 25 July 2001 02:01         Edit/Delete Message   Reply w/Quote

wienerfiltering.kym

 
Attached is a Kyma Sound that performs Wiener Filtering. Wiener filtering (named for Norbert Wiener) is a least-mean-squares (LMS) optimal filtering technique for extracting signal from noise.

It operates in the frequency domain by estimating the total signal+noise power, and by attempting to estimate the noise power alone from a long term exponential average of the input signal in each frequency component.

As provided it is a very simple filter and takes only 4 DSP's with FFT sizes of 512 and less. It is also one of the most impressive at removing strong white noise (or nearly any other kind as well...).

In Wiener filtering we need to compute the quotient of squared amplitudes for each frequency component. The Kyma doesn't have a Divide Sound, so once again, I approximated it using an ArcTangent. The quotients should normally range over the lower half of the first quadrant. In this range the arctangent is almost (but not quite) the same as the quotient itself. You could add a straightener wavetable if you really wanted to but it isn't necessary here. (the straightener should implement the Tangent function over the first octant.)

The artifacts produced by the non-linearity of the artangent-as-quotient are of the same order of magnitude as those produced by my assumptions regarding power and noise estimates. Linear prediction theory shows that errors in these estimates are second order, so even a fairly crude set of estimates works well here.

For your information, the optimal signal recovery filter has the transfer function

H(f) = Abs(S(f))^2/(Abs(S(f))^2 + Abs(N(f))^2)

where S(f) is the Fourier transform of the signal of interest, and N(f) is the Fourier transform of the (uncorrelated) Noise.

We want to obtain S(f) and then inverse transform that back to the time domain to give us the signal of interest.

So how do we make the filter if you have to know the signal before you can create the filter, and the signal is entirely unknown to us in advance?

The Kyma block diagram shows how I did it...

First of all the quantity in the denominator is an estimate of the total power in the signal+noise at each frequency. But that quantity is just the square of the RMS Fourier amplitude at any frequency.

To obtain an estimate of S(f), I subtract the estimated noise from a long-term exponential average of the input signal+noise from the instantaneous RMS squared amplitudes. My assumption is that over a long enough period of time, the signal+noise is mostly noise and the little bit of signal will get averaged to near zero over this duration. (not accurate for music, but okay for speech).

Hence the Kyma actually implements the approximation to

H(f) = 1 - Abs(N(f))^2/P(f)

where P(f) is the total signal+noise power. This gain must be restricted to values between zero and 1. That second term is the quotient approximated by the Kyma ArcTangent function. After that I use a 4x gain adjustment because the arctangent has value 0.25 when the quotient is unity. Then this quotient is sent into a (1-Input) block, and the output of that block is used as a gain multiplier on the signal+noise spectral components.

The operation of a Wiener filter is really quite simple in principle. It merely says that when signal is greater than noise you can optimally extract the signal by using the gain based on the ratio of signal power to signal+noise power. Elsewhere, when the signal drops below the noise floor then gain drops to zero... when you have no information about the signal just report nothing...

This sound has "breundelten" as well, but these can be mitigated by smoothing the application of these computed gains at each frequency. Noise spikes will attempt to poke above the noise estimate and sound like granular synthesis of water sloshing about. Try lowering the NSmooth fader to 1 and you'll see strong breundelten.

But by insisting on low-pass filtering these gain changes, only correlated signals like speech which has duration of many FFT cycles gets the chance to push the gain open significantly in comparison to the noise spikes. Hence the more FFT cycles of smoothing you apply to the gain changes the quieter the background "breundelten" become. You need to increase the postgain to compensate for the stinginess of the Wiener gains under these circumstances.

Wiener Filtering is in fact a form of deconvolution, but one which refuses to synthesize fiction when the signal is absent. It is a linear filtering operation and hence it is limited (yet impressive). Other more powerful deconvolution techniques exist, e.g., maximum entropy, but these all synthesize information where none exists. Whether that synthetic reconstruction is accurate or not who can say?

Wiener Filtering is a favorite for image restoration (image deconvolution) as well, and I have used it in the past for enhancing X-ray images for angiography (looking for clogged arteries near the heart). It is provably the "optimum filter", but all uses of it use mere estimates of the needed quantities. So its use can only approach true optimum filtering -- but the results are quite impressive nonetheless...

(I just got 4 more DSP's in my Capy and I had to celebrate! So here I am sharing my joy! Kyma is a grown-up's mechano kit!!)

- DM


IP: Logged

Dave Booth
Member
posted 25 July 2001 11:09         Edit/Delete Message   Reply w/Quote
This is very interesting... I'll be keen to download the sound when I get back home. One thing that strikes me - you point out that this isn't ideal for denoising a musical signal:

To obtain an estimate of S(f), I subtract the estimated noise from a long-term exponential average of the input signal+noise from the instantaneous RMS squared amplitudes. My assumption is that over a long enough period of time, the signal+noise is mostly noise and the little bit of signal will get averaged to near zero over this duration. (not accurate for music, but okay for speech).

For dehissing old tapes, would it be feasible/effective to take a noise sample from a nominally silent part of the tape and then use it instead of the long term average input signal+noise?
Work those DSP's!

Dave

IP: Logged

David McClain
Member
posted 25 July 2001 18:13         Edit/Delete Message   Reply w/Quote
Hi Dave!

I haven't tried that but it seems like an ideal way to obtain the N(f) used above.

I would play a captured section into an FFT and then record the squared RMS value of its Fourier coefficients. You might try averaging several or many FFT periods, and then save in a wave table using a Memory writer or something like that.

Let me know if this works for you. If so, then you will have one heck of a deNoiser. You can't do much better than Wiener filtering!

- DM

IP: Logged

All times are CT (US)

next newest topic | next oldest topic

Administrative Options: Close Topic | Archive/Move | Delete Topic
Post New Topic  Post A Reply

Contact Us | Symbolic Sound Home

This forum is provided solely for the support and edification of the customers of Symbolic Sound Corporation.


Ultimate Bulletin Board 5.45c