# Matching LPC frequency response to raw sample data frequency response

### Background:

The intention is feature/formant extraction from speech input.

I have used an FFT on raw samples in the past and have done simple peak picking from a weighted average of frequencies over time. That gave results that approximated a voiced non-nasal utterance's location in the vowel quadrilateral, but it was not consistent. I heard that LPC would give a smoother response curve and much greater accuracy in feature extraction. The residual is another desired side-effect which will hopefully allow for analysis of other features as well.

### Issue:

I have a large disparity in the peak frequencies between an FFT on the raw samples and an FFT on the derived LP coefficients.

I find that the response curves are wildly different in shape and peak frequency locations. Often FFT_LPC (see definitions below) will show large peaks in the 3000/4000Hz range for simple voiced vowel utterances. Perhaps these are pops - maybe I should perform IFFT and play back the output to check. FFT_Raw peaks precisely where I would expect given the source samples.

### Process:

Here is my current method:

• Obtain samples at 22050Hz.
• From the raw sample frame, window with Hamming and perform FFT. Call this FFT_Raw.
• In parallel, extract LP coefficients from the raw samples, do NOT window, and perform FFT directly on the LP coefficients padded with zeroes. In effect, every frame would lead with these coefficients. Call this FFT_LPC.
• Take RMS of raw samples and apply an (admittedly arbitrary) multiplier to bring FFT_LPC to comparable magnitude compared with FFT_Raw.
• Display both frequency response curves with one overlaid on top of the other.

I have tried anywhere from 8 to 32 coefficients with similar results.

### Questions:

• Is using the coefficients directly as input to the FFT the right approach? The assumption on my end is that leading with the coefficients would approximate a unit impulse. However is there any intermediate processing that I should be doing (such as somehow shifting the starting point of each set of coefficient data to match the fundamental frequency)?
• Should the LPC data be windowed prior to FFT? I would think that my current approach of leading with the coefficients every frame means that windowing would reduce the amplitude of the first set of coefficients and FFT would produce different frequencies. However maybe if I window the raw samples and THEN use that as input to the LPC data then I will obtain more accurate results.

I have not used MATLAB or any other third party applications - the desire is to build this myself using Xcode and its accompanying libraries alone. I can display this code but it is lengthy and spans several classes (including adapter classes between data types and math/FFT operations). Ideally I would seek input on a language-agnostic conceptual level.

The computed LPC coefficients are the weights $a_i$, which predict a future signal value based on $p$ previous samples of the input signal: $$\hat{x}[n] = \sum_{i=1}^{p} a_i x[n-i],$$ where $\hat{x}[n]$ is the predicted value. The coefficients $a_i$, with $i \in [1,p]$, are typically found by minimizing the error $$e[n] = ||x[n] - \hat{x}[n]||_{2}^{2}.$$ Thus, taking the DFT directly of the coefficients $a_i$ does not give you an estimate of the spectral envelope of the original signal. Instead, the estimate is given by the frequency response of the all-pole filter: $$H(z) = \frac{||e[n]||_{2}}{1+\sum_{i=1}^{p}a_{i}z^{-i}},$$ where $||e[n]||_{2}$ is the RMS-value of the prediction error. So instead, you should be taking the DFT of the impulse response of the all-pole filter above, and plot that with the original signal spectrum. Scaling the filter magnitude by the prediction error ensures that the magnitude of the spectral envelope corresponds to that of the original signal.