%preemp.m
clc;
clear all;
close all;
%demonstration for improving the condition number using pre-emphasis.
[A,FS]=audioread('D:\GOPI\DIGITAL_SPEECH_PROCESSING_USING_MATLAB\data\train\s2.wav');
[res1,res2,speechsegment,utforste,ltforste,ltforzcr]=endpointdetection(A',FS);
S1=blkproc(speechsegment,[1 FS*30*10^(-3) ],'spe(x)');
S2=blkproc(speechsegment,[1 FS*30*10^(-3) ],'spepreemp(x)');
S3=blkproc(speechsegment,[1 FS*30*10^(-3) ],'spelpc(x)');
S4=blkproc(speechsegment,[1 FS*30*10^(-3) ],'spepreemplpc(x)');
col=[];
figure
for i=1:1:21
subplot(5,5,i)
plot(S1(1:1:188,i))
end
figure
for i=1:1:21
subplot(5,5,i)
plot(S2(1:1:188,i),'r')
end
figure
for i=1:1:21
subplot(5,5,i)
plot(abs(fft(S3(:,i),1024)))
end
figure
for i=1:1:21
subplot(5,5,i)
plot(abs(fft(S4(:,i),1024)),'r')
end
MA1=max(S1);
MI1=min(S1);
MA2=max(S2);
MI2=min(S2);
CONNUMBER1=MA1./MI1;
CONNUMBER2=MA2./MI2;
figure
stem(CONNUMBER1,'ro')
hold on
stem(CONNUMBER2,'b*')


