# Sir i have to find the lpc coefficient for an audio. I tried a code now i am getting 20x1 coefficients. But i need 209x20 lpc coefficients. Because i have to find the coefficients for each frame.

5 views (last 30 days)
Suchithra K S on 9 May 2019
How i do that ? I tried one code and it is given below,
startIndex=round(56000);
time=(1:length(y))/fs;
frameSize=floor(44*fs/1000);
endIndex=startIndex+frameSize-1;
frame = y(startIndex:endIndex);
frameSize=length(frame);
v=hamming(length(frame));
frame2=frame.*v;
spectral=20*log10(abs(fft(frame2)));
len=length(spectral);
ncoeff=20;
a=lpc(frame2,ncoeff);
[h,f]=freqz(1,a,512,fs);
subplot(3,1,1);
plot(time,y); title(y); axis tight
ylim=get(gca, 'ylim');
line([time(startIndex), time(startIndex)], ylim, 'color', 'r');
line([time(endIndex), time(endIndex)], ylim, 'color', 'r');
axis xy
% xlabel('s');
% ylabel('
subplot(3,1,2);
xj=(1:len/2)*fs/len;
plot(xj,spectral(1:len/2));
axis xy
% xlabel('frequency/Hz');
% ylabel('magnitude/dB');
subplot(3,1,3);
plot(f,20*log10(abs(h)+eps));
legend('LPC');
% xlabel('frequency(Hz)');
% ylabel(magnitude(dB)');
r=roots(a);
r=r(imag(r)>0.001);
ffreq=sort(atan2(imag(r),real(r))*fs/(2*pi));
ff=ffreq';
for i=1:length(ffreq)
fprintf('Formant %dFrequency%. 1f\n',i,ffreq(i));
end
figure;
plot(a);