# Filtering signal with added noise (frequencies known)

I have been assigned a project to take a given noisy sound file, with added broadband and narrowband noise. The goal is to reach a certain mean-squared error between the filtered signal and the original, non-noisy signal.

Here is my code for calculating the mean squared error (in MATLAB)

%  let x be the original signal, xn be the noisy signal, and xnf be the filtered
%   noisy signal. Let the prefix 'G' indicate a power spectral density,
%   a lowercase 'x' indicate time domain, and uppercase 'X' indicate FFT.
%   Compute the cross correlation between the original signal and the
%   filtered noisy signal
Rxxnf = N*real(ifft(ifftshift(Gxxnf))) ;
%   Find the number of samples of delay, I, for peak cross correlation
[Rmax,I] = max(Rxxnf) ;
%   Circularly shift the original signal by I samples to make it have a
%   maximum correlation to the filtered noisy signal.  Call the shifted
%   signal "xs"
xs = [x(end-I:end);x(1:end-I-1)] ;
%   Compute the mean squared error between the original signal (delayed)
%   and the filtered noisy signal.  Compute only for the samples that occur
%   after the delay.
mse = mean((xnf(I:end)-xs(I:end)).^2) ;


The sound clip is about 10 seconds long, and is of a man speaking.

The locations of the narrowband noise are specified as ranges from

967.884 Hz to 1069.95 Hz
715.365 Hz to 810.994 Hz


Looking at the FFT of the original signal (left) and the noisy signal (right), we can see that there is indeed a significant amount of broadband noise. To inspect this further, I look at the power spectral density. I can confirm that the broadband noise is the outermost section of the noisy PSD and that narrowband noise has indeed been added at the indicated frequencies.

I have applied a lowpass filter (6th order butterworth, $f_c=700\textrm{ Hz}$ (the broadband noise is actually introduced closer to $1000\textrm{ Hz}$, but $700\textrm{ Hz}$ gives the best mean-squared error), and 2 bandstops at the given frequency ranges (chebyshev type II, both second order, one with a passband ripple of $3\textrm{ dB}$ (low ripple gives best MSE), and one with a passband ripple of 18 (best MSE).

As of right now, my MSE is not as low as my professor's claimed MSE for this particular signal (he indicates a mean-squared error of .00143, I have only achieved .0023)

My questions are:

• are there any other filter types I should be using rather than butterworth/chebyshev?
• Should I place any other filters anywhere to perhaps mitigate ripple effects?

I very much appreciate the help.

• PSD for original signal (left) and filtered noisy signal (right): image Apr 27 '17 at 3:09

You want a Wiener filter here. Basically your frequency response at frequency $f$ should be $\frac{E |S|^2}{E |S|^2 + E |N|^2}$ where $S$ is the Fourier transform of the signal and $N$ of the noise (all dependent on $f$ of course). So your filters should not aim for a stop band of zero but rather a stop band that will admit an amount of signal based on the expected SNR at that frequency.