LPCAna:
Filter:
JoshMisc/Classes (extension) | Libraries > JoshUGens | UGens > Analysis:Synthesis

LPCAna
ExtensionExtension

Create an LPC analysis file

Description

Adapted and expanded from R. Moore's LPC analysis code from Computer Music.

Class Methods

.new

Arguments:

path

The path for a mono sound file to analyze.

Instance Methods

.ana

Arguments:

nPoles

the number of poles for the all-pole filter (default: 35, must be less the 200)

frameSize

the number of samples to use for each from of analysis (default: 400)

hop

a percentage of the frameSize to skip for the next window (default: 0.5)

channel

the channel to analyze if the file at 'path' is multi-channel (default: 0)

minFreq

a minFreq to search for in pitch tracking (defautl: 70)

maxFreq

a maxFreq to search for in pitch tracking (default: 200)

check

Attempts to check poles for stability.

WARNING: Somewhere in this code, I've made a terrible mistake. It actually CAUSES instabilities rather then getting rid of them... but I can't, for the life of me, see where the error is. Don't use it. Moore's basic algorithm is pretty good, and the filters seems fairly stable. If you have problems, try increasing the number of poles (default: 0).
conditionSignal

Default: 0, 1 works well, choose 2 if you want exploding filters that might (?) be interesting.

  • 0: does nothing,
  • 1: applies a simple low pass filter to each window before doing the analysis (which helps avoid instabilities)
  • 2: apply a DRASTIC low pass filter to the signal that I saw in some of CSounds LPC code. This REALLY smoothes out the signal, and usually causes some pretty crazy instabilities because the output of the filter is SO resonant.
completion

A function to evaluate when the analysis is finished. Handy for bulk analyzing files, and auto saving them.

.lperr

low pass the error signal numTurns times

Arguments:

numTurns

.lprms

low pass the overall rms signal numTurns times

Arguments:

numTurns

.lppch

Low pass the pchcps signal numTurns times

Arguments:

numTurns

.saveToLPCFile

save file to an LPC file usable by LPCFile, LPCSynth and LPCVals.

Arguments:

path

.saveToFiles

Save file to an LPC file usable by LPCFile, LPCSynth and LPCVals, as well as a floating point .aif data file for use in NRT.

Arguments:

path

.calcLaguerre

Arguments:

a
m
x
eps
p

.checkRoots

Arguments:

theseCoefs
check

.findRoots

Arguments:

a

.getpch

.clock

.data

.resrms

.sr

.hop

.channel

.initLPCAna

.analyzeWindow

Arguments:

check
conditionSignal

.path

.frames

.nPoles

.initAna

Arguments:

argNPoles
argFrameSize
argHop
argChannel
argMinFreq
argMaxFreq

.pchcps

.coefs

.anaBuf

.frameSize

.hopSamps

.origrms

.inc

.tmpBuf

.err

.sf

.calcOrigRMS

Examples