how can i get the complete formant frequencies rather than the average (F1, F2..). I have to plot formants graph for F1, F2, F3 ..
3 views (last 30 days)
Show older comments
[y,fs]=audioread('signal_path');
t=linspace(0,length(y)/fs,length(y));
subplot(311);
plot(t,y);
segmentlen=100;
noverlap=90;
NFFT=128;
subplot(312)
spectrogram(y,segmentlen,noverlap,NFFT,fs,'yaxis')
title('Signal Spectrogram')
dt=1/fs;
I0 = round(0.001/dt);
Iend = round(0.06/dt);
x = y(I0:Iend);
x1 = x.*hamming(length(x));
preemph = [1 0.63];
x1 = filter(1,preemph,x1);
A = lpc(x1,16);
rts = roots(A);
rts = rts(imag(rts)>=0);
angz = atan2(imag(rts),real(rts));
[frqs,indices] = sort(angz.*(fs/(2*pi)));
bw = -1/2*(fs/(2*pi))*log(abs(rts(indices)));
nn = 1;
for kk = 1:length(frqs)
if (frqs(kk) > 90 && bw(kk) <400)
formants(nn) = frqs(kk);
nn = nn+1;
end
end
formants
3 Comments
Answers (0)
See Also
Categories
Find more on 2-D and 3-D Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!