N = 30;
F = [0 0.4 0.5 1];
A = [1 1 0 0];
B = firpm(N,F,A);

NF = 512;
[H,W] = freqz(B,1,NF);

subplot(2,1,1);
plot(B,'-*');
legend('Impulse Response');
xlabel('Time in Samples');
ylabel('Amplitude');
subplot(2,1,2);
plot(W/pi,20*log10(abs(H)));
legend('Frequency Response');
xlabel('Normalized Frequency');
ylabel('Log Amplitude (dB)');

% filter 16kHz waveforms
[x1, fs, nbits] = wavread('00000005_16kHz.wav');
y1 = filter(B,1,x1);
wavwrite(y1,fs,'00000005_l6kHz_fir.wav');
