% simplistic LPC synthesizer % must enter pitch and three formant frequencies % don't expect such a simplistic model to sound natural function LPCsyn % let's always use 8000Hz sampling frequency Fs=8000; % pitch should be between 100 and 200 Hz p=200; % three formants (Hz) %f1=650; f2=850; f3=2500; % AH %f1=550; f2=1800; f3=2700; % EH %f1=300; f2=2900; f3=3500; % EE %f1=450; f2=800; f3=2800; % O %f1=370; f2=950; f3=2650; % OO %f1=300; f2=2300; f3=3200; % IH %f1=500; f2=650; f3=2800; % UH % convert to digital form pitch=round(Fs/p); formant1=f1/Fs; formant2=f2/Fs; formant3=f3/Fs; % place poles according to formant frequencies p11=0.95*exp(2*pi*i*formant1); p12=0.95*exp(-2*pi*i*formant1); p21=0.9*exp(2*pi*i*formant2); p22=0.9*exp(-2*pi*i*formant2); p31=0.8*exp(2*pi*i*formant3); p32=0.8*exp(-2*pi*i*formant3); % create LPC synthesis filter [num,den] = zp2tf([],[p11 p12 p21 p22 p31 p32],1); % create excitation signal ( 1 0 0 0 0 1 0 0 0 0 ...) excitation=[]; for cnt=[1:200], excitation=[excitation 1 zeros(1,pitch-1)]; end % filter the excitation with the LPC synthesis filter sig=filter(num,den,excitation); % remove transient, remove DC and normalize sig=sig(1000:end); sig=sig-mean(sig); sig=sig*(1/max(abs(sig))); % play it sound(sig,Fs);