I am building an LPC analysis tool for speech synthesis and did the following to generate my a0 through a10:

sum = 0
for (i = 0; i < N - order; i++) {
  sum += s[i + order] * s[i]

So, for an example sequence:

s[0]: -0.00036988587817177176
s[1]: -0.0005228677182458341
s[2]: -0.002549876691773534
s[3]: -0.005284426733851433
s[4]: 0.03419444337487221
s[5]: 0.06330401450395584
s[6]: 0.2461005449295044
s[7]: 0.36327624320983887
s[8]: 0.5022943019866943
s[9]: 0.7432577013969421
s[10]: 0.7451401948928833
s[11]: 0.9017787575721741
s[12]: 0.9144688248634338
s[13]: 0.8055802583694458
s[14]: 0.7247466444969177
s[15]: 0.5342929363250732

I get:

a0: 1.6765472891346052
a1: 1.5827508756328967
a2: 1.3697197839567066
a3: 1.0687599069050433
a4: 0.741864438363822
a5: 0.4665998816936655
a6: 0.2567268139253708
a7: 0.12122018661739875
a8: 0.04979388551368519
a9: 0.016472847413864372
a10: 0.003187118053062932

and then when I run that through my K conversion, I get:

k1: -0.9440538217385303
k2: 0.6826731774147582
k3: 0.27304617789929586
k4: -0.18255947440809286
k5: -0.48868909366775654
k6: 0.1881875661845312
k7: 0.3690787060329103
k8: -0.005584315353450492
k9: -0.3649987110269231
k10: -0.03950634100447886

I have another LPC analysis tool which shows totally different K values than what I am getting, so I am suspecting that my code to generate the a's has an error in it.

I've been looking online for something that can say, given this A, its K should be: X... But I have not been able to find any such thing.

Can anyone here verify that my As and Ks are correct, given this example sequence?


1 Answer 1


After applying a Hamming window to your data I get very similar autocorrelation values:

R = 

You can check your LPC filter coefficients (not the reflection coefficients) by computing the matrix-vector product $\mathbf{R}\mathbf{a}$ where $\mathbf{a}$ is the vector of LPC coefficients and $\mathbf{R}$ is a Toeplitz matrix with the autocorrelation values:

$$\mathbf{R}=\begin{bmatrix}R(0)&R(1)&\ldots && R(p)\\ R(1)&R(0)&R(1)&\ldots&R(p-1)\\ \vdots& & \ddots & &\vdots\\ R(p) & R(p-1) & \ldots && R(0)\end{bmatrix}$$

This product must result in a vector with the first element being non-zero, and all the other elements must be zero (up to numerical accuracy).

Using the Octave function [lpc,v,k]=levinson(R(1:11)); with the autocorrelation function given above, I get the following LPC filter coefficients:

lpc =


And these are the corresponding reflection coefficients:

k =


So we get very similar values from which you can conclude that your code for computing the reflection coefficients from the autocorrelation function is correct.

  • $\begingroup$ I am sorry-- I some how forgot to mention that I am applying a hamming window to the signal, and that's why the As are so different than what you show... If I turn off my hamming window then the a0 I get is: 4.666856304718674, and the a10 I get is: 0.051544872290064506... The a10 is still a little different than what you show, but very close. $\endgroup$
    – patrick
    Jan 16, 2015 at 18:05
  • $\begingroup$ @patrick: OK, with the Hamming window our values are very similar, so I guess your code is OK (see updated answer). $\endgroup$
    – Matt L.
    Jan 17, 2015 at 8:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.