But de TP : Ce TP a pour but de caractériser le signal vocal enregistré en utilisant une analyse
formantique.
«
function [F] = spFormantsLpc(a, fs)
r = roots(a);
r = r(imag(r)>0.01);
F = sort(atan2(imag(r),real(r))*fs/(2*pi));
save spFormantsLpc F;
end
»
«
function [a P e est_x] = spLpc(x,fs, ncoef)
[a P] = lpc(x, ncoef);
«
function [F, T, FF] = spFormantsTrackLpc(x, fs, ncoef, frame_length,
frame_overlap, window, show)
x=wavread('bo_s_14');
fs=22050;
frame_length = 10;
frame_overlap = 5;
window = 'hamming';
ncoef=24;
N = length(x);
pos = 1; t = 1;
FF= [];
F = []; % formants
T = []; % time (s) at the frame
mid = round(nsample/2);
while (pos+nsample <= N)
frame = x(pos:pos+nsample-1);
frame = frame - mean(frame);
a = spLpc(frame, fs, ncoef);
fm = spFormantsLpc(a, fs);
fm=fm(1:4);
FF=[FF fm];
end
t=(0:N-1)/fs;
subplot(2,1,1);
plot(t,x);
legend('Waveform');
xlabel('Time (s)');
ylabel('Amplitude');
xlim([t(1) t(end)]);