pvslpc
Prev | Orchestra Opcodes and Operators | Next

## pvslpc

pvslpc — Streaming linear prediction analysis.

## Description

This opcode implements streaming linear prediction analysis from an input signal and outputs an fsig, which can be used with other pvs opcodes.

## Syntax

    fsig pvslpc asrc, idftsiz, ihop, iord[,iwin]

## Initialization

idftsiz -- size of lpc input frame in samples and fsig analysis frame. It needs to be a power-of-two.

iord -- linear predictor order.

ihop -- analysis hop size.

iwin -- window function table number (optional).

## Performance

fsig -- fsig output

asrc -- source signal for lpc analysis

This opcode is part of a suite of streaming linear prediction opcodes. It analyses an input signal and produces a set of LPC coefficients for an all-pole filter that models the signal's spectral envelope. The transfer function for this filter is then computed and its magnitude spectrum is output as a streaming phase vocoder signal.

The fundamental analysis parameters are input frame size and filter order. Longer input frames will produce a more accurate result in terms of frequency resolution, but will also involve more computation. This is due to the computation of the autocorrelation function, which is then used in the coefficient computation. This part is more efficient and depends only on the linear prediction order, which is also the number of coefficients computed. Typical lp orders may range from about 30 to 100 coefficients, but larger values can also be used.

The analyses are produced every hopsize samples. Once the signal is extracted from an audio input then it can be optionally windowed if a function table is provided. While this is optional, it is a recommended procedure (GEN20 can provide the most common windows). The signal is then analysed and coefficients produced. The fsig produced by this opcode is given in AMP-FREQ format. The amplitudes contain the spectral envelope of the input signal, and the frequencies are derived from a fundamental frequency estimation computed from the autocorrelation function. These do not represent the frequencies in the input signal to any level of accuracy; they are only placeholders.

## Examples

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

Example 811. Example of the pvslpc 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
    a2 diskin "beats.wav",1,0,1
    fenv pvslpc a1,1024,128,64,gifw
    fexc pvsanal a2,1024,128,1024,1
    fsig pvsfilter fexc,fenv, 1, 0.5
    a3 pvsynth fsig
    a3 dcblock a3
    out a3
    endin

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

## See Also

lpcfilter, allpole

Prev | Up | Next
pvslock | Home | pvsmaska