.TH LPC 1carl CARL
.SH NAME
lpc - linear predictive coding of a signal spectrum with an allpole filter
.SH SYNOPSIS
.B lpc
[
.B flags
] < floatsams [ > floatsams ]
.sp
.nf
flags:	(defaults in parenthesis)
	-RN	set input sample rate to N (usually read from stdin)
	-bN	begin at time N (0)
	-wN	set window size to N seconds (1024S) 
	-lM	M pole linear prediction estimate via autocorrelation method
	-kM	M pole linear prediction estimate via covariance method

	 if filter_file is not specified the file tmp.flt will be created

	 (the optional output is the impulse response of the filter as
	  a stream of -wN floatsams to stdout)
.br
.SH DESCRIPTION
.PP
This program 
designs an IIR (all pole) filter which matches the spectrum of
the input signal spectrum as closely as it can.  Typically, the
goal is to capture the broad resonances in the spectrum (e.g., the
formants in speech) without including the individual peaks of each
harmonic.  The resulting filter can be used with the
.I filter
program to impose the linear prediction spectrum on some completely
different signal.  For example, the 
.I lpc
program can be used to obtain a filter which matches the spectrum
of a vowel sound.  But note that this program produces only a single
filter;  "talking orchestra" effects can be obtained only with
time-varying linear prediction.
.PP
Unfortunately, the inner workings of this program are rather tricky.
Linear predictive coding is done on the basis that the spectrum
matching filter is the inverse of the optimum linear predictor for
the data.  Another way of looking at this is that the program calculates
the M weighting coefficients which allow the M'th input sample to be best
estimated from the previous M values.  However, this procedure
is sensitive both to the value of M, to the value of N, and to the
particular input samples available.  For example, too large a value
of M may result in the fine structure of the spectrum (i.e., individual
harmonic peaks) being incorporated into the IIR filter.  But this
effect can be eliminated if N is exactly one period of the input.
A general rule of thumb is that the order of the filter should be specified
to be at least twice the number of major resonances present in the input
spectrum.
.PP
There are two variations of \fIlpc\fR available. The covariance method is
usually more accurate, especially for short data samples, because it
does not force prediction of zeros outside the finite data sample.
The autocorrelation method is equivalent for very long data samples
and is faster than the covariance method.
.PP
To see the frequency response of the filter, type
.IP
sndin file | lpc [flags]
| spect -f
.LP
or
.IP
impulse 1024 | filter
filter_file | spect -f
.LP
A more detailed explanation and examples of typical usage are given in
the helpfile for this program.
.SH FILES
.SH AUTHOR
Mark Dolson
.SH SEE ALSO
fir(1carl), impulse(1carl), libieee(1carl), filter(1carl)
.SH BUGS
Certain input specifications or input signals can cause either impossible
filters to be specified, or may cause numerical difficulties.
Either of these cases can be quite irritating.

