1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
| clc;clear all;close all;
[x,Fs]=audioread('Project_ve2.wav');
audioinfo('Project_ve2.wav')
info= audioinfo('Project_ve2.wav');
Nbits=info.BitsPerSample;
p=audioplayer(x,Fs);
%p.play;
L=length(x);
N = 2^nextpow2(L);
%Plot the spectrum
df = Fs / N;
w = (-(N/2):(N/2)-1)*df;
y = fft(x,N)/N;
y2 = fftshift(y);
figure;
%plot(w,abs(y2))
plot(w,20*log10(abs(y2)))
xlabel('Frequency (Hz)');
ylabel('Magnitude (dB)');
title ('Magnitude spectrum of the signal in decibel');
grid on;
grid minor;
%waitforbuttonpress;
l=[0.05 0.15]; %region ou se trouve le premier pic
h=[0.25 0.30]; %region ou se trouve le second pic
figure;
b = fir1(5000,[l h],'DC-1');
freqz(b,1);
grid on;
grid minor;
title ('Frequency response of the filter');
fOut = conv (x,b);
figure;
plot (w,20*log10(abs(fftshift(fft(fOut,N)))));
grid on;
grid minor;
p = audioplayer(fOut, Fs);
p.play; |
Partager