Estimate formants using LPC in Python

孤者浪人 提交于 2019-12-03 13:52:13

The problem had to do with the order being passed to the lpc function. 2 + fs / 1000 where fs is the sampling frequency is the rule of thumb according to:

http://www.phon.ucl.ac.uk/courses/spsci/matlab/lect10.html

Lukeclh

I have not been able to get the results you expect, but I do notice two things which might cause some differences:

  1. Your code uses [1, -0.63] where the MATLAB code from the link you provided has [1 0.63].
  2. Your processing is being applied to the entire x vector at once instead of smaller segments of it (see where the MATLAB code does this: x = mtlb(I0:Iend); ).

Hope that helps.

There are at least two problems:

  • According to the link, the "pre-emphasis filter is a highpass all-pole (AR(1)) filter". The signs of the coefficients given there are correct: [1, 0.63]. If you use [1, -0.63], you get a lowpass filter.

  • You have the first two arguments to scipy.signal.lfilter reversed.

So, try changing this:

x1 = lfilter([1., -0.63], 1, x1)

to this:

x1 = lfilter([1.], [1., 0.63], x1)

I haven't tried running your code yet, so I don't know if those are the only problems.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!