close all; clear all;
wordfile = input('Enter filename(WORD): ','s');
[word,fs] = wavread(wordfile);
[phoneme,fs] = wavread(input('Enter filename(PHONEME): ','s'));
graphtitle = input('Enter Graph Title: ','s');
ts = 1/fs;
wordaxis = 1:length(word);
wordaxis = wordaxis.*ts;
phonemeaxis = 1:length(phoneme);
phonemeaxis = phonemeaxis.*ts;
N=1024;
N1=round(4e-3*fs);
N2=round(16e-3*fs);
fourierphon=fft(phoneme,N);
fourierphon=fourierphon(1:N/2);
fftaxis=0:pi/(N/2):pi-2/N;
fftaxis=fftaxis.*fs./(2*pi);
smoothaxis=0:pi/(N/2):pi-1/N;
smoothaxis=smoothaxis.*fs./pi;
lpcorder=12;
[coefficients,gain]=lpc(phoneme, lpcorder);
smooth=freqz(gain, coefficients, smoothaxis, 2*fs);
smoothaxis=smoothaxis./2;
subplot(4,1,1); plot(wordaxis,word); axis
tight; grid on;
ylabel('Word Waveform'); xlabel('Time [sec]'); title(graphtitle);
subplot(4,1,2); specgram(word, 4*N1, fs, 4*N1, round(0.75*4*N1));
subplot(4,1,3); specgram(word, 4*N2, fs, 4*N2, round(0.75*4*N2));
subplot(4,2,7); plot(phonemeaxis, phoneme); axis tight; grid on;
ylabel('Phoneme Waveform'); xlabel('Time [sec]');
subplot(4,2,8); plot(fftaxis,
20*log10(abs(fourierphon/N))); grid on;
ylabel('Freq.Spectrum [dB]'); xlabel('Frequency [Hz]'); hold on;
plot(smoothaxis, 20*log10(abs(smooth/N)), 'k'); axis tight; grid on; hold off;