allpole — Allpole filter implementation using direct convolution.
kCoef[] -- all-pole filter coefficients (iord-size array)
asig -- audio input
ares -- audio output
This opcode is part of a suite of streaming linear prediction opcodes. It implements an allpole filter using coefficients passed to it via a k-rate array. The filter length is determined by the array size
The typical application is compute the coefficients via some method and then pass these to the opcode. The set of coefficients passed to allpole need to implement a stable filter, since this is an IIR filter and stability is not guaranteed by default.
The most common method of coefficient derivation is linear prediction analysis, produced for instance by lpcanal. Other methods may be employed, including direct calculation of coefficients from a known filter recipe (e.g. resonators etc).
Here is an example of the allpole opcode using an audio input signal as lpc source. It uses the file allpole.csd.
Example 53. Example of the allpole opcode.
See the sections Real-time Audio and Command Line Flags for more information on using command line flags.
<CsoundSynthesizer> <CsOptions> -odac -d </CsOptions> <CsInstruments> sr = 44100 ksmps = 64 nchnls = 1 0dbfs = 1 gifw ftgen 0,0,1024,20,2,1 instr 1 a1 diskin "fox.wav",1,0,1 kcfs[],krms,kerr,kcps lpcanal a1,1,128,1024,64,gifw if kcps > 180 then kcps = 180 endif a2 buzz 0dbfs, kcps, sr/(kcps*2), -1 a3 allpole a2*krms*kerr,kcfs a3 dcblock a3 out a3 endin </CsInstruments> <CsScore> i1 0 30 </CsScore> </CsoundSynthesizer>
Here is another example of the allpole opcode, now using a function table as lpc source. It uses the file allpole-2.csd.
Example 54. Another example of the allpole opcode.
See the sections Real-time Audio and Command Line Flags for more information on using command line flags.
<CsoundSynthesizer> <CsOptions> -odac -d </CsOptions> <CsInstruments> sr = 44100 ksmps = 64 nchnls = 1 0dbfs = 1 gifn ftgen 0,0,0,1,"fox.wav",0,0,1 gifw ftgen 0,0,1024,20,2,1 instr 1 k1 init 0 kts = p4 kcfs[],krms,kerr,kcps lpcanal k1,1,gifn,1024,ksmps,gifw if kcps > 180 then kcps = 180 endif a1 buzz 0dbfs, kcps, sr/(kcps*2), -1 a3 allpole a1*krms*kerr,kcfs k1 += ksmps*kts if k1 > ftlen(gifn) then k1 = 0 endif a3 dcblock a3 out a3 endin </CsInstruments> <CsScore> i1 0 10 1 i1 10 10 .75 i1 20 10 1.5 </CsScore> </CsoundSynthesizer>