clear all;
close all;
[xw, fpw] = audioread('mbi04jeden.wav');
xv = decimate(xw, 4);
fpv = fpw / 4;
tv = 0 : 1/fpv : (length(xv)-1)/fpv;
title('nagranie');
xlabel('czas [s]');
%_________________________________
Nfv = 2 ^ nextpow2( (length(xv)) ); 
frv = fft(xv,Nfv);

fv = linspace(0,fpv,Nfv);
wv = abs(frv);

Nfv21 = Nfv / 2 + 1;
% fv = linspace(0,fpv/2,Nfv21);



figure(1)
hold on;
grid on;
plot(fv(1:Nfv21),wv(1:Nfv21));
title('widmo amplitudowe nagrania');
xlabel('czestotliwość [Hz]');

fgr = 1200;
fgrN = fgr / (fpv/2);

M = 3001;
h = fir1(M-1, fgrN, 'high');

%1

yv = filter(h,1,xv);
fryv = fft(yv,Nfv);
wyv = abs(fryv);

plot(fv(1:Nfv21),wyv(1:Nfv21));
title('widmo amplitudowe po filtracji');
xlabel('czestotliwość [Hz]');