T=1/Fs;
nBits = 16 ;
nChannels = 1 ;
ID = -1;
recObj = audiorecorder(Fs,nBits,nChannels,ID);
disp('Start speaking.')
recordblocking(recObj, recordingtime);
disp('End of Recording.')
data = getaudiodata(recObj);
filename = 'Sample.wav';
audiowrite(filename,data,Fs)
y= audioread('Sample.wav');
sound(data,Fs);
pause(recordingtime+1)
NFFT = length(y);
Y = fft(y);
F = ((0:1/NFFT:1-1/NFFT)*Fs).';
magnitudeY = abs(Y);
phaseY = unwrap(angle(Y));
figure;
subplot(3,1,1)
plot(F,magnitudeY)
title('Orignal signal')
xlabel('frequency')
ylabel('Amplitude response')
Ylp = Y;
Fn = Fs/2;
fc = 1500;
fcnm = fc/Fn;
n1=1:round(fc/Fs*NFFT);
n2=(1+NFFT)-round(fc/Fs*NFFT):NFFT;
Ylp(length(n1)+1:n2(1)+1)=0;