%GET SOUND. 
%load GuitarSounds_8000; 
%[sound1,Fs,bps]=wavread('sor1.wav');
%[sound1,Fs,bps]=wavread('tz2.wav');
%[sound1,Fs,bps]=wavread('trumpet.wav');
[sound1,Fs,bps]=wavread('violin3x.wav');
range=1000
start=round(length(sound1)/2)-round(range/2)
%start=17400
%x     = sound1(start:start+range); 
x     = sound1(start:start+range); 
%Ts    = 1/8000; 
Ts    = Fs;
  
%CEPSTRUM. 
Y     = fft(x.*hamming(length(x))); 
%Y     = fft(x); %when no hamming window is added you will se a very high freq component
C     = fft(log(abs(Y)+eps)); 
  
%PLOT. 
f_cep = Ts*(1:length(C));  %fdft=Ts 
figure(1)
clf
subplot(3,1,1)
plot(x); 

subplot(3,1,2)
plot(f_cep,abs(C));   

subplot(3,1,3)
plot(f_cep,abs(fft(abs(C))));   
sound (sound1,Fs)
sound(abs(fft(abs(C))),Fs)



