I would like to do formants extraction using LPC. I made the necessary pre-emphasis before feeding the speech samples to the LPC function.

N = len(X)
w = np.hamming(N)
x1 = X * w
x1 = lfilter([1], [1., 0.63], x1)
ncoeff= int(2 + Fs/1000)

Solving the poles from the all-poles system-Transfer function for speech,

$$ H(z) = \frac{1}{1 - \sum_{i=1}^{p} a_i.z^{-i}} = \frac{1}{A(z)} $$

poles = np.roots(lpc)
poles = np.array([r for r in poles if np.imag(r) >= 0])
frequencies = np.arctan2(poles.imag, poles.real) * (Fs / (2 * np.pi))

Although the formants F1 and F2 (typical values expected for a given vowel) are indeed present in this array of frequencies, I get undesired low frequencies. Hence, I could not straightaway choose F1 and F2 as first two values. How to make the program choose F1 and F2?



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.