function f=a_to_lsf(a); % Syntax: f=a_to_lsf(a); % % Computes Line Spectrum Frenquencies from LPC coefficients. % a is the vector of LPC coefficients of dimension M+1. [1 a1 a2 ... aM] % f is the vector of M normalized frequencies (Fe=1) of significant zeros of % 2 following polynomes: % P(z)=A(z)-B(z) % Q(z)=A(z)+B(z), where B(z)=z^-(M+1) A(z^-1) (flippen and shifted A(z) ). % Significant means, that the zero at f=0 and f=1/2 are not taken into account. % a and f are COLUMN vectors M=length(a)-1; a=[a; 0]; p=a-a(M+2:-1:1); q=a+a(M+2:-1:1); rp=roots(p); rq=roots(q); lp=sort(angle(rp)); lq=sort(angle(rq)); if M/2 == floor(M/2), % M even - P has zero at f=0, Q has zero at f=1/2: lp=lp(M/2+2:M+1);% coupe les lp negatives et zero lq=lq(M/2+1:M); % coupe les lp negatives et pi else % M odd - P has zeros at f=0 and f=1/2 lp=lp((M+1)/2+1:M);% coupe les lp negatives, zero et 1/2 lq=lq((M+1)/2+1:M+1); % coupe les lp negatives end f=sort ([lp; lq]) / (2*pi);