Skip to main content

Module linear_predictive_coding

Module linear_predictive_coding 

Source
Expand description

Linear predictive coding (LPC).

LPC models a signal as the output of an all-pole filter driven by a white excitation: each sample is predicted from the previous order samples, x̂[n] = -Σ_{k=1}^{p} a[k] x[n-k], and the coefficients minimise the prediction error power. Writing A(z) = 1 + a[1] z^-1 + … + a[p] z^-p, the analysis filter A(z) whitens the signal into the residual, and the synthesis filter 1 / A(z) rebuilds the signal from it. The all-pole spectrum σ² / |A(e^{jω})|² is a smooth estimate of the signal’s spectral envelope, which is why LPC underlies speech coding.

The coefficients here come from the autocorrelation method: the autocorrelation sequence is computed (implicitly windowing the signal with zeros outside the record) and the resulting Toeplitz normal equations are solved with the Levinson-Durbin recursion, which also yields the reflection (PARCOR) coefficients. The autocorrelation method always gives a stable synthesis filter (all reflection coefficients have magnitude below one).

See the book entry Parametric spectra: linear prediction, Burg and MUSIC.

Structs§

LpcResult
The result of an LPC analysis.

Functions§

autocorrelation
Biased autocorrelation estimate r[k] = Σ_n x[n] x[n+k] for lags 0..=max_lag.
levinson_durbin
Solves the Toeplitz normal equations for an autocorrelation sequence r[0..=order] with the Levinson-Durbin recursion.
linear_predictive_coding
LPC analysis of x by the autocorrelation method.
lpc_residual
The prediction residual e = A(z) x (the analysis filter), same length as x, assuming zero initial conditions.
lpc_synthesize
Runs an excitation through the synthesis filter 1 / A(z), the inverse of lpc_residual.
lpc_to_reflection
Converts A(z) coefficients to reflection coefficients (the step-down recursion). Fails if a stage has |k| >= 1 (an unstable or degenerate filter).
reflection_to_lpc
Converts reflection coefficients to A(z) coefficients (the step-up recursion).