Skip to content

Wiener Filter

The Wiener filter is a Estimator#Minimum Mean Square Error (MMSE) estimator. Applied to a noisy signal, it gives the MMSE optimal estimate for the clean signal, separating signal from noise. It can be derived that the MMSE is the mean of the posterior probability of the signal given observation.

Drawing 2024-06-20 13.37.40.excalidraw#^group=y0M0pJl3bt6B6m6ZnfQyo

The Wiener Filter is a function of the signal PSD \(\Phi_{SS}\) and noise PSD \(\Phi_{VV}\):

\[ G=\frac{\Phi_{SS}}{\Phi_{SS}+\Phi_{VV}}=\frac{\sigma_{S}^{2}}{\sigma_{S}^{2} + \sigma_{V}^{2}} \]

where \(\sigma_S^2\) is the variance of the true signal. Since we don't know the true signal, we have to estimate the true PSD by subtracting the noise PSD from the observed PSD:

\[ \Phi_{SS}=\Phi_{YY}-\Phi_{VV} \]

^50b851

Idea

Pasted image 20240620153628.png

The Wiener filter applies gain where the sample is likely to stem from the true signal and attenuates the signal when its likely just noise. The left graph shows the a single frame of observed speech signal and the noise from the environment. On the right, the Wiener filter was applied.

As can be seen, the peaks from the spectral harmonics of the speech are basically unchanged. For them, the variance observed signal is much larger than that of the noise, so the gain remains close to 1. For the values between the harmonics however, the observed variance is very similar to that of the noise, maybe even smaller. The gain factor then goes down to 0.5 or lower, attenuating the part of the signal that contains a lot of energy from the noise signal.

Basically, the Wiener filter attenuates parts of the signal with low SNR and emphasizes parts with a high SNR. It does so by comparing the variances of noise and true signal. Since we don't know the variance of the true signal, we have to estimate the true signal by taking our observations and subtracting the noise.

Background

Given a signal \(Y=S+N\), where the true signal \(S\) and the noise \(N\) are uncorrelated. We now want to solve for the MMSE estimator \(\hat{S}=\mathbb{E}_{S}(S|Y=y)\):

$$ \begin{align} \hat{S} &= \mathbb{E}{S}(S|Y=y) \ &= \int\limits(s|y)ds \ &= \frac{\int\limits_{-\infty}^{\infty}s{\space}p_{Y|S=s}(y|s){\space}p_{S}(s){\space}ds}{p_{Y}(y)}}^{\infty}s{\space}p_{S|Y=y

\end{align} $$

We now need to find models:

$$ \begin{align}

p_{S}(s) &= \frac{1}{\sqrt{2\pi \sigma_S2}}\exp\left(-\frac{S\right)\}}{2\sigma_{S}^{2}

p_{Y|S}(Y|S) &= \frac{1}{\sqrt{2\pi \sigma_{N}{2}}}\exp\left(-\frac{(Y-S)\right)\}}{2\sigma_{N}^{2}

p_{Y}(Y) &= \frac{1}{\sqrt{2\pi (\sigma_{S}{2}+\sigma_{N}\exp\left(-\frac{(Y-S)})}{2}}{2(\sigma_{S}\right)\} +\sigma_{N}^{2})

\end{align} $$

and can plug them in. After a lengthy derivation, this gives us the Wiener Filter:

\[ \hat{S}^{MMSE}=Y\frac{\sigma_{S}^{2}}{\sigma_{S}^{2} + \sigma_{N}^{2}} \]

This shows us that the estimator is a weighting of the observed samples:

  • If the variance of the true signal is large compared to the noise, the factor on the right will be close to one.
  • If the variance of the noise is comparatively large, the factor will be close to zero.

Therefore, the Wiener filter can be seen as a gain function and is the optimal estimation that minimizes the MMSE to the true signal.

Derive Wiener Filter

To derive the Wiener filter, we need to find the filter coefficients \(g\) that minimize the MSE:

\[ g = \text{arg}\min_{g}(\mathbb{E}((s(n)-\hat{s}(n))^2)) \]

1. Define MSE

We can use the definition of the estimator as a convolutional filter and plug it into the definition of a MMSE estimator:

Drawing 2024-06-20 13.37.40.excalidraw#^group=h6kXnMg5DV7OlJxs4L3_7

2. Find Minimum of MSE

We will now find the coefficients by finding the minimum of the MSE:

Drawing 2024-06-20 13.37.40.excalidraw#^group=fVTbP_xeuBz1JT1StihfX

3. Transform Cross-correlation into PSDs

We got the filter now, but the definition involves the power spectrum of the cross-correlation of the observation and the true signal. Assuming that noise and signal are uncorrelated, we can define the filter through the signal PSD \(\Phi_{SS}\) and the noise PSD \(\Phi_{VV}\):

Drawing 2024-06-20 13.37.40.excalidraw#^group=p_jk9Ogx_2-V6QrfbJ6vy

We no have derived the Wiener Filter as a function of the signal PSD \(\Phi_{SS}\) and \(\Phi_{VV}\)

\[ G=\frac{\Phi_{SS}}{\Phi_{SS}+\Phi_{VV}} \]

Derive Wiener Filter in STFT Domain

We define the Wiener Filter in the STFT domain as

\[ \hat{S}_k(l)=G_k(l)\space Y_k(l) \]

where \(k\) are the frequency bins and \(l\) are the frames.

1. Define MSE

We try to optimize the MSE independent of frame or frequency bin, so we can drop the indices:

Drawing 2024-06-20 14.43.43.excalidraw#^group=vm0t7ALxr7ysKOCb-pF5N

2. Optimize Phase

We optimize the phase by maximizing the only term in the sum that is dependent on the phase of our filter \(G\):

Drawing 2024-06-20 14.43.43.excalidraw#^group=rGJ7JMbgdG1QXU7H6Qnj7

3. Optimize Magnitude

We can now plug in the optimal phase into the the MSE. We now find the optimal magnitude by finding the extreme point of the derivative of the MSE:

Drawing 2024-06-20 14.43.43.excalidraw#^group=lxEAn6j0AsbLun60T1VFx

4. Combine Optimal Results

We can now combine our results for optimal phase and magnitude. Assuming an uncorrelated signal \(S\) and noise \(V\), we can again simplify the expression to derive the Wiener Filter as a function over the PSDs:

Drawing 2024-06-20 14.43.43.excalidraw#^group=cW2-jxfThvpbn5z1Vj-id

The last definition also gives us another interpretation:

\[ \frac{\mathbb{E}(|S|^2)}{\mathbb{E}(|S|^2)+\mathbb{E}(|V|^2)}=\frac{\sigma_{s}^{2}}{\sigma_{s}^{2} + \sigma_{N}^{2}} \]

giving us the definition of the Wiener Filter as the MMSE estimator shown in #Background.,