

clear all
close all
load('voce.mat')
Fs=96000;
Nbit=24;
Ch=1;
T=5;
N=Fs*T;
t=(0:1/Fs:T-1/Fs);
%myVoice = audiorecorder(Fs,Nbit,Ch);

%disp('Return to start ...');
%pause
%disp('Start speaking.');
%recordblocking(myVoice, T);
%disp('End of recording.');


%disp('Return to display ...');
%pause

%G=input('Amplificazione? ')
G=15*10000/Fs;
figure(1)

%x = getaudiodata(myVoice);
plot(t,x)
xlabel('Time seconds')
title('Recorded Signal')

disp('Return to display FFT...');
pause
X=fft(x);
f=(-Fs/2:Fs/N:Fs/2-Fs/N);
figure(2)
plot(f,fftshift(abs(X)))
xlabel('Frequency Hz')
title('Fourier T. Abs Value')

disp('Return to playback ...');
pause

myVoice=audioplayer(x*G,Fs);
play(myVoice);
pause(T)


hPB=fir1(64,.03);
xPB=conv(x,hPB);

disp('Return to display LP signal...');
pause

figure(1)
hold on
plot(t,xPB(65:length(xPB)),'r')
xlabel('Time seconds')
title('Low Pass Filtered Signal')
hold off

figure(2)
hold on
disp('Return to display FFT Low Pass...');
pause
XPB=fft(xPB(65:length(xPB)));
plot(f,fftshift(abs(XPB)),'r')
xlabel('Frequency Hz')
title('Fourier T. Abs Value')
hold off

disp('Return to play LP version')
pause

myVoice=audioplayer(xPB*G*2,Fs);
play(myVoice)

disp('Return to play undersampled version')
pause
myVoice=audioplayer(x(1:64:length(x))*G*3,Fs/64);
play(myVoice);



