LPC spectra estimate 
LPC spectra estimate 
Feb 6 2009, 03:26
Post
#1


Group: Members Posts: 99 Joined: 2August 07 From: Shanghai,China Member No.: 45817 
LPC spectra should correspond with the envelope of DFT spectra.
I plot LPC spectra with matlab. The LPC spectra keep the same shape with the envelope of DFT spectra. But it is larger with a offset than the DFT envelope. Why? Where it go wrong? Here is the matlab script which illustrate it. N = 2560; [x,fs] = wavread('lpc.wav',N); % any speech signal can be used p=12; a = lpc(x,p); X =fft(x); X = X(1:N/2+1)'; X = 10*log10(abs(X).^2); Z = fft(a,N); Z = 1./Z(1:N/2+1); Z = 10*log10(abs(Z).^2); figure; plot(X'); hold on; plot(Z,'r'); grid; offset = 10; figure; plot(X+offset); hold on; plot(Z,'r'); grid; 


Feb 7 2009, 15:51
Post
#2


Group: Members Posts: 99 Joined: 2August 07 From: Shanghai,China Member No.: 45817 
LPC spectra should correspond with the envelope of DFT spectra. I plot LPC spectra with matlab. The LPC spectra keep the same shape with the envelope of DFT spectra. But it is larger with a offset than the DFT envelope. Why? Where it go wrong? What you call "LPC spectra" (by which you probably mean the LPC synthesis filter response) is independent of the input signal's level. If I remember correctly Matlab's LPC function can return more than the set of filter coefficients  one of those return values gives you a hint about the scaling of the input. Cheers! SG Thank you. Great job. It must be here that lpc coefficients were scaled. I would confirm it soon. LPC function in matlab return LPC coefficients and prediction error variance sigma^2. And LPC coefficients lost important signal energy information. But I still do not get the exact scale factor from returned value of lpc function. Cheers 


Feb 7 2009, 16:54
Post
#3


Group: Developer Posts: 1318 Joined: 20March 04 From: Göttingen (DE) Member No.: 12875 
What you call "LPC spectra" (by which you probably mean the LPC synthesis filter response) is independent of the input signal's level. If I remember correctly Matlab's LPC function can return more than the set of filter coefficients  one of those return values gives you a hint about the scaling of the input. LPC function in matlab return LPC coefficients and prediction error variance sigma^2. Bingo! Guess what happens to this sigma^2 if you scale your input by factor two... Cheers! SG 


Feb 8 2009, 02:58
Post
#4


Group: Members Posts: 99 Joined: 2August 07 From: Shanghai,China Member No.: 45817 
What you call "LPC spectra" (by which you probably mean the LPC synthesis filter response) is independent of the input signal's level. If I remember correctly Matlab's LPC function can return more than the set of filter coefficients  one of those return values gives you a hint about the scaling of the input. LPC function in matlab return LPC coefficients and prediction error variance sigma^2. Bingo! Guess what happens to this sigma^2 if you scale your input by factor two... Cheers! SG Thank you. It cause sigma^2 to rise 4 times by scaling the input by factor two preceding lpc computation,. but I still can not get the corresponding input signal power from prediction error variance sigma^2. N = 25600; [x,fs] = wavread('origsign.wav',N); % any speech signal can be used y = 2*x; p=20; [a,ae] = lpc(x,p); [b,be] = lpc(y,p); be/ae This post has been edited by hyeewang: Feb 9 2009, 06:53 


Feb 10 2009, 09:44
Post
#5


Group: Developer Posts: 1318 Joined: 20March 04 From: Göttingen (DE) Member No.: 12875 
but I still can not get the corresponding input signal power from prediction error variance sigma^2. If you still havn't figured out the details try Z = fft(a,N); Z = sqrt(e*N) ./ Z(1:N/2+1); % < changed Z = 10*log10(abs(Z).^2); instead  where 'e' is this sigma^2. Cheers! SG 


Feb 11 2009, 04:17
Post
#6


Group: Members Posts: 99 Joined: 2August 07 From: Shanghai,China Member No.: 45817 
but I still can not get the corresponding input signal power from prediction error variance sigma^2. If you still havn't figured out the details try Z = fft(a,N); Z = sqrt(e*N) ./ Z(1:N/2+1); % < changed Z = 10*log10(abs(Z).^2); instead  where 'e' is this sigma^2. Cheers! SG Thank you. I follow u and it work well. But I did not get the principle,. why the multiplication factor is energy,not variance? According to LPC theory,synthesis filter H = G./[1sum(ai.*Z.(i))], E(n) = s(n)  sp(n) = G*e(n); here,E(n) refer to as lpc pediction error, and e(n) refer to as excitation. s(n) is the input speech,sp(n) is the estimated signal. Assume the variance of e(n) to be 1. sum( E(n)*E(n)) = G.^2*sum( e(n)*e(n)) = G.^2* N; then G^2 = [sum( E(n)*E(n) ) ] ./ N. It should be variance(power),not energy. Why? Thank for your teaching. This post has been edited by hyeewang: Feb 11 2009, 14:11 


Feb 11 2009, 10:30
Post
#7


Group: Developer Posts: 1318 Joined: 20March 04 From: Göttingen (DE) Member No.: 12875 
Z = fft(a,N); Z = sqrt(e*N) ./ Z(1:N/2+1); % < changed Z = 10*log10(abs(Z).^2); instead  where 'e' is this sigma^2. I follow u and it work well. But I did not get the principle 'a' and 'e' don't depend on the length of your signal (assuming its characteristics don't change over time). But you wanted both curves to match which is why I included 'N' in the scaling. Also, are you confusing power with energy? Cheers! SG This post has been edited by SebastianG: Feb 11 2009, 10:31 


Feb 11 2009, 14:25
Post
#8


Group: Members Posts: 99 Joined: 2August 07 From: Shanghai,China Member No.: 45817 
Z = fft(a,N); Z = sqrt(e*N) ./ Z(1:N/2+1); % < changed Z = 10*log10(abs(Z).^2); instead  where 'e' is this sigma^2. I follow u and it work well. But I did not get the principle 'a' and 'e' don't depend on the length of your signal (assuming its characteristics don't change over time). But you wanted both curves to match which is why I included 'N' in the scaling. Also, are you confusing power with energy? Cheers! SG Thank you. Hehe,I used the term power and energy by mistake. shame. Indeed, Both a and e do not depend on the length of signal. But You use e*N,and e*N is the speech signal's energy. And You still did not explain why you use N to multiply the varince e. Just use the cause of curves matching reason is weak. 


Feb 11 2009, 17:05
Post
#9


Group: Developer Posts: 1318 Joined: 20March 04 From: Göttingen (DE) Member No.: 12875 
Indeed, Both a and e do not depend on the length of signal. But You use e*N,and e*N is the speech signal's energy. Not exactly. It's the energy of the prediction residual. And You still did not explain why you use N to multiply the varince e. Just use the cause of curves matching reason is weak. How about telling us why this isn't obvious to you? What else do you expect? You know, I really don't like writing big articles about this just so you can understand the topic. I value my sparetime. It's not my job to teach you in my sparetime. I'm just giving hints & pointers that are intended to make you think for yourself. This post has been edited by SebastianG: Feb 11 2009, 17:12 


Feb 12 2009, 02:45
Post
#10


Group: Members Posts: 99 Joined: 2August 07 From: Shanghai,China Member No.: 45817 
Indeed, Both a and e do not depend on the length of signal. But You use e*N,and e*N is the speech signal's energy. Not exactly. It's the energy of the prediction residual. And You still did not explain why you use N to multiply the varince e. Just use the cause of curves matching reason is weak. How about telling us why this isn't obvious to you? What else do you expect? You know, I really don't like writing big articles about this just so you can understand the topic. I value my sparetime. It's not my job to teach you in my sparetime. I'm just giving hints & pointers that are intended to make you think for yourself. Sorry for my remark about e, it is the variance of prediction error ,not that of the original speech signal. Also Sorry for my annoying and continuous inquiring. Actually,a few days ago,someone have told me about the true multiplication factor,which is N*e,not e. And explian it to use "LPC spectrum is, actually, amplitude characteristics of LPC impulse response ...". But I still do not get it fully. Thus, why use N*e,not use e, is my focuse on, also it is the essence of this topic. Sorry to disturb you. I appreciate your help,but I also know it is not your job and responsibility.  Reward the water of sea just for the tiny dripping.  A Chinese old proverb. Thank you anyway. This post has been edited by hyeewang: Feb 12 2009, 02:49 


Feb 12 2009, 13:41
Post
#11


Group: Developer Posts: 1318 Joined: 20March 04 From: Göttingen (DE) Member No.: 12875 
But I still do not get it fully. 'a' is independent from your signal's level and length. 'e' corresponds to the residual's power. This means that if you take white noise with variance 1, multiply it with sqrt(e) and filter it with the LPC synthesis filter you'll get a signal with roughly the same power spectral density. But you are actually comparing a single impulse response with a whole signal of length N. That's why you need the 'N' in "e*N" for the power scaling to make both curves match. This post has been edited by SebastianG: Feb 12 2009, 13:42 


LoFi Version  Time is now: 15th September 2014  11:21 