# How to decide filter order in Linear Prediction Coefficients ( LPC ) while calculating formant frequency features?

I am new in signal processing and trying to calculate formant frequency features for different .wav files.

For calcuating formant frequency, I need three parameters values :

• Linear Prediction Coefficients ( LPC )
• root
• angle

I am trying to calculate Linear Prediction Coefficients ( LPC ) using librosa.core.lpc in python. it takes two parameters:

librosa.core.lpc(y, order)


I have Y but I don't know how to calculate order, I have many .wav files and I have to set order to extract features from all the files. How to determine the order for all wav files to calculate LPC?

Next two things root and angle can be calculated easily like this :

 rts = numpy.roots(A)
rts = [r for r in rts if numpy.imag(r) >= 0]

angz = numpy.arctan2(numpy.imag(rts), numpy.real(rts))

# Get frequencies.
Fs = spf.getframerate()
frqs = sorted(angz * (Fs / (2 * math.pi)))


But I am already stuck in the first step.

You have to define the order based on your application, usually for speech you'll use and order of 10, this definws the order of your all pole filter and it's related with the amount of formants tha you will see in the impulse response of the filter.