# Filtering voice signal from randomly added frequencies

I have this assignment that I can't figure how to solve.

I have a sound.wav human-voice file, and use matlab add-random-noise (monotonic)

Goal: to remove the noise from the sound (and the sound from the noise)

What I've done so far is to read the file and then add the noise. I then do an fft. Now I need to analyze the frequency spectrum, but I'm not sure how to do it. And finally do an ifft to recover the sound back.

I've used many kinds of filters: low pass, high pass, band pass, moving average.

The problems were:

1. I've managed to filter the sound without the noise BUT the sound always got worse as well.

2. It worked only for specific cases of random noise but not for any random noise that function might produce.

### Any help would be appriciated. Thanks!

add_random_noise.m
n=[0:length(y)-1]';
r=rand();
%%rr=1+rand();
%%rrr=2+2*rand();
c=cos(2*pi*440*r*n/Fs);%%+cos(2*pi*440*rr*n/Fs)+cos(2*pi*440*rrr*n/Fs);
yn=y+c/17;
yn=yn/max(yn);
end


EDIT:

I have changed the add "noise" to return only one sinusoid noise. I run the same noise with my original wav and with zeros and watched the noise in the peak in the range of the lower frequency

now im having truble to make the filter: matlab How to design lpf\bpf\hpf without builtin functions

• Your noise is the sum of 3 sinusoids with random frequencies, right? This is a very specific situation. Haven't you treated some relevant methods in the course where the assignment is taken from? Do you need to remove the noise for one specific outcome of the random generator, or for all possible outcomes? This basically boils down to the question if the frequencies of the sinusoids can be viewed as fixed and known or not. May 20 '13 at 11:38
• Matt. up till now I just thought to use the original voice and compare it with the noisy one. I'm not sure how can I benefit from this specific sinusoids noise equation. the noise is unknown and I need to handle with all possible outcomes. but before I can do that, help me to figure a simple one and I'll try my best for all the other random noises.
– jico
May 20 '13 at 20:31
• To begin with, go back to your teacher and insist that the sin waves can neither be considered random, nor can be termed noise. A better name for this function would be add_random_frequencies. May 21 '13 at 21:32
• Then I assume that all you need to do is FFT the signal to identify frequencies whose average does not vary over time. Once found, just notch (filter) them out. May 21 '13 at 21:34
• "whose average does not vary over time" what do you mean? I did compared between the original sound(X) to the noisy sound(XN) on the frequency domain (dif=XN-X). then I took the mean from dif, and then notch NX. the result is a white noise and lower volume of the original sound. avg = mean(abs(dif).^2) for i = 1:length(dif) if abs(dif(i)).^2 > avg XN(i) = 0; end end`
– jico
May 22 '13 at 14:37