lpanal utility performs linear predictive coding (LPC) analysis on sound files. LPC models the vocal tract as an all-pole filter and is particularly effective for analyzing and resynthesizing speech and vocal sounds.
Syntax
Arguments
infilename- Input sound file to analyzeoutfilename- Output LPC analysis file
Options
File and time selection
| Option | Description | Default |
|---|---|---|
-s <srate> | Input sample rate | From header or 44100 |
-c <chnlreq> | Channel to analyze | 1 |
-b <begin> | Start time in seconds | 0.0 |
-d <duration> | Duration to analyze in seconds | To EOF |
Analysis parameters
| Option | Description | Default |
|---|---|---|
-p <npoles> | Number of poles for analysis | 34 |
-h <hopsize> | Hop size between frames in samples | 200 |
Pitch tracking
| Option | Description | Default |
|---|---|---|
-P <mincps> | Lower limit for pitch search in Hz (0 disables pitch tracking) | 70 |
-Q <maxcps> | Upper limit for pitch search in Hz | 200 |
Additional options
| Option | Description |
|---|---|
-C <string> | Comment field for LP header |
-v <verblevel> | Verbosity level (0=none, 1=verbose, 2=debug) |
-g | Enable graphical display of results |
-a | Use alternate (pole) file storage format |
-n | Use Durbin method for linear prediction |
-- <fname> | Log output to file |
Examples
Basic LPC analysis
Analysis with custom pole count
Speech analysis with pitch tracking
High time resolution analysis
Analysis without pitch tracking
Analyze specific time segment
Verbose analysis with comment
Output file format
The LPC file contains for each analysis frame:- Filter coefficients: Predictor coefficients modeling the spectral envelope
- Gain: Overall energy/gain for the frame
- Pitch: Fundamental frequency (if pitch tracking enabled)
- RMS: Root mean square amplitude
Choosing analysis parameters
Number of poles
The pole count determines the filter order:- 20-30 poles: Minimal formant resolution, fast analysis
- 34 poles (default): Good balance for speech, captures 16-17 formants
- 40-50 poles: Higher spectral detail, better for singing voice
- 50+ poles: Maximum detail but may overfit
samplerate / 1000 poles for speech.
Hop size
Controls time resolution:- 50-100 samples: Very fine time detail, more data
- 200 samples (default): Good balance (4.5ms at 44.1kHz)
- 400-500 samples: Coarser time resolution, smaller files
2 × hopsize.
Pitch tracking range
- Male speech: 80-250 Hz
- Female speech: 150-400 Hz
- Singing voice: 60-1000 Hz (or wider)
- Musical instruments: Disable with
-P 0
Technical details
Linear prediction methods
Autocorrelation method (default):- Stable, always produces minimum-phase filters
- Guaranteed to find a solution
- Standard method used in speech coding
-n flag):
- Alternative recursive algorithm
- Computationally efficient
- May give different results for some signals
Frame analysis
For each frame, lpanal:- Extracts a windowed segment of audio
- Computes autocorrelation function
- Solves linear prediction equations
- Extracts filter coefficients and gain
- Optionally performs pitch detection
Using LPC files in Csound
LPC analysis files can be used with Csound opcodes:lpread- Read LPC data from analysis filelpreson- Resynthesise using LPC filterlpfreson- LPC resonator with frequency controllpslot- Store LPC data in slotslpinterp- Interpolate between LPC frames