apoleparams

apoleparams — Extracts allpole filter parameters from coefficients.

Description

This opcode takes an array of allpole filter coefficients and produces an array of allpole filter parameters as frequency and bandwidth pairs.

Syntax

kPar[]apoleparams kCoef[] 
>

Performance

kCoef[] -- all-pole filter coefficients (iord-size array)

kPar[] - filter parameters in freq-bandwidth pairs.

This opcode is part of a suite of streaming linear prediction opcodes. It takes in an array of allpole filter parameters, converts these to filter poles, sorts these in ascending frequency order, and then outputs these as frequency-bandwidth pairs. Poles at 0Hz and Nyquist frequencies are excluded, and each pole conjugate pair is represented by a single pair of parameters. For a filter of order M, M coefficients are transformed into M/2 pairs of frequencies and bandwidths.

Examples

Here is an example of the apoleparams opcode using an audio input signal as lpc source. It uses the file apoleparams.csd.

Example 62. Example of the apoleparams 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
kper init sr
a1 diskin "flute.aiff",1,0,1
kcfs[],krms,kerr,kcps lpcanal a1,1,512,1024,10,gifw
kpar[] apoleparams kcfs
if kper >= sr then
kcnt = 0
kper = 0
endif
kper += ksmps
while kcnt < 5 do
  printf "t:%.1f filter %d freq: %.1f bw: %.1f\n", kcnt+1, times:k(), kcnt, kpar[kcnt], kpar[kcnt+1]
  kcnt += 1
od
out a1
endin

</CsInstruments>
<CsScore>
i1 0 20
</CsScore>
</CsoundSynthesizer>


See also

Streaming Linear Predictive Coding (SLPC) Resynthesis