Learn R Programming

phonTools (version 0.2-2.2)

lpc: Linear Predictive Coding

Description

Predict autoregressive filter coefficients.

Usage

lpc (sound, order = round(fs/1000)+3, fs = 10000, show = FALSE, 
add = FALSE, preemph = TRUE)

Value

A vector containing the LPC coefficients is returned.

Arguments

sound

Either a numeric vector representing a sequence of samples taken from a sound wave or a sound object created with the loadsound() or makesound() functions.

order

The number of LPC coefficients to be estimated. By default there is 2 per kHz below the Nyquist frequency plus 3 extra coefficients.

fs

The sampling frequency in Hz. If a sound object is passed this does not need to be specificed.

show

If TRUE, the frequency response of the estimated filter is plotted.

add

If TRUE, the frequency response plot is added to an existing plot.

preemph

If TRUE, preemphasis of 3 dB per octave is applied to the sound before analysis.

Author

Santiago Barreda <sbarreda@ucdavis.edu>

Details

LPC coefficients are estimated using the autocorrelation method. The signal is windowed with a Hanning window prior to analysis.

Examples

Run this code
## make a synthetic vowel with a known set of formant frequencies
#sound = vowelsynth (ffs = c(500,1500,2500,3500,4500), 
#fbw = c(30, 80, 150, 200, 220),f0 = 100, dur = 250)

## let the LPC function estimate the filter used to generate the vowel
#coeffs = lpc (sound, show = TRUE)

Run the code above in your browser using DataLab