# scipy.signal.wiener for audio processing

Does some have an example of what a Wiener filter (that can be used directly with scipy.signal.wiener) can be useful for, in sound processing (it seems that such adaptive filters can be useful for noise reduction, etc.) ?

I tried with various (noisy + sinusoids) soundfiles (read into an array x) with the command

y = wiener(x)


But it doesn't give such great result... (Normal : I cannot expect something magical with just a simple function that doesn't take any parameter!)

I just wondered what this function could be useful for (sound processing).

The Wiener filter can be very useful for audio processing. With an estimate of noise or an interfering signal Wiener filtering can be used for audio source separation and denoising tasks.

The real power of the technique comes when it's applied to a Time-Frequency representation of the signal. I'm not familiar with Python but it looks to me like you are filtering the time domain representation of the signal. If you take a Short-Time Fourier Transform (STFT) first, you can then estimate noise at each time and frequency location and then selectively filter each location accordingly.

The Wiener filter is a simple deblurring filter for denoising images. This is not the Wiener filter commonly described in image reconstruction problems but instead it is a simple, local-mean filter. Let $x$ be the input signal, then the output is $$y = \left\{ \begin{array}{cl} \frac{\sigma^2}{\sigma_x^2} m_x + ( 1 - \frac{\sigma^2}{\sigma_x^2}) x & \sigma_x^2 \ge \sigma^2\\ m_x & \sigma_x^2 \lt \sigma^2 \end{array} \right.$$ where $m_{x}$ is the local estimate of the mean and $\sigma_{x}^{2}$ is the local estimate of the variance. The window for these estimates is an optional input parameter (default is $3\times3$ ). The parameter $\sigma^{2}$ is a threshold noise parameter. If $\sigma$ is not given then it is estimated as the average of the local variances.