f



Exercise on Filtering an Audio File

Hello, 
I have an excrercise in the signals course which requires me to filter noise from an audio file using Fourier Transformation. I would like you to check the code I wrote and tell me what mistakes or propblems I have.
         I read the audio which contains the noise file using matlab, plotted the file in time domain (this plot was strange and different from the ones I usually get from the audio files, maybe because of the noise?), converted the matrix of samples to freqeuncy domain using fft, plotted the file in frequency domain, used a for loop to reduce the magnitudes of the frequencies that are above other values (as recommended by our instructor), converted the file back to time domain, plotted it and played it. 
         The problems I have is that the final file, which is filtered, does not produce any sound. I checked its plot and I found that the magnitudes of the samples are very small. I will leave the code below, the link which I used to apply the fft, and a dropbox link with the figures I got and the sound file we are asked to filter. Please help. 
Thanks in advance. 


Code: 
[y,fs]= wavread('sound.wav');
figure;
plot(y);
title('plot of the sound file in time domain');

N=length(y);
f=fs/N.*(0:N-1);
Y=fft(y,N);
Y = abs( Y(1:N) ) ./ (N/2);

figure;
plot(f,Y);
title('plot of the sound file in frequency domain');

for i=1 :N
    if Y(i) >0.01
        Y(i)=0;
    end
    i=i+1;
end

figure
plot(Y,'r');
title('plot of the sound file in frequency domain after filtering the frequncies');

y_n=ifft(Y,N);
figure;
plot(y_n);
title('plot of the new sound file samples in time domain');

https://www.mathworks.com/matlabcentral/newsreader/view_thread/164978?requestedDomain=www.mathworks.com

https://www.dropbox.com/sh/186n8xxgxiqqnsp/AAAzzWoNuPsOHltDj9yUl3hoa?dl=0
0
Moaath
12/18/2016 6:08:03 PM
comp.soft-sys.matlab 211264 articles. 26 followers. lunamoonmoon (257) is leader. Post Follow

0 Replies
497 Views

Similar Articles

[PageSpeed] 27

Reply: