I have to remove the noise from a wav music file with matlab.
I know that I have to use the ellipord
and ellip
functions. First I read the wav file:[x,Fs]=wavread('file.wav');
Then I do a spectrogram:
spectrogram(x,512,400,512,Fs,'yaxis');
Now, I can't understand some things:
Your noise looks like high frequency hiss at 15000 Hz. I think the best way to remove this noise is a bandstop filter, though it is hard to say without listening, maybe a lowpass filter will fit your requirements better. I'd try other filter types as well
Fs = 44100;
%what frequencies do you want to pass
wp = [12000 18000] / (Fs/2);
%what frequencies you don't want to pass
ws = [14000 16000] / (Fs/2);
%ellipsoid filter characteristics must be smooth
%so you have to select how many decibels
%you allow to lose at passband (i.e. 12000 and 18000 hz)
rp = 3;
%stopband (minus decibels at 14000 and 16000 hz)
rs = 60;
[n,Wp] = ellipord(wp,ws,rp,rs)
[b,a] = ellip(n,rp,rs,wp,'stop');
freqz(b,a,Fs,Fs);