tvconv

tvconv — A time-varying convolution (FIR filter) opcode.

Description

An opcode that takes two incoming signals and interprets one of them as the coefficients of linear time-variable finite impulse response filter. This is implemented via direct convolution (for partition sizes of 1 sample) or DFT-based partitioned convolution. The signals can be 'frozen' (i.e. the filter coefficients are kept the same) at any point in time, at a-rate or k-rate.

Syntax

ares tvconv asig1, asig2, xfreez1,
    xfreez2, iparts, ifils

Initialization

iparts -- partition size, for sizes > 1, a DFT-based partitioned convolution process is used. Otherwise a time-domain delay line FIR is implemented. Partition sizes > 1 are rounded to the nearest power-of-two.

ifils -- filter size. For partition sizes > 1, filter sizes are rounded to the nearest power-of-two. With partition size = 1, since direct convolution is used, filters can be of any size.

Performance

ares -- audio output.

asig1, asig2 -- audio inputs.

xfreez1 -- freeze switch for asig1. Coefficients are only updated (ie. the signal is passing into the convolution) if xfreez1 > 0. This input can take an audio or a k-rate signal, or a constant.

xfreez2 -- freeze switch for asig2, similar to xfreez1 in operation.

Examples

Here is an example of the tvconv opcode. Play tvconv.csd

Example 1135. Example of the tvconv opcode.

See the sections Real-time Audio and Command Line Flags for more information on using command line flags.

<CsoundSynthesizer>
<CsOptions>
-odac 
</CsOptions>
<CsInstruments>
sr = 44100
ksmps = 32
nchnls = 2
0dbfs = 1

instr 1

 asig diskin "fox.wav",1,0,1
 air diskin "beats.wav",1,0,1
 air buthp air/0dbfs,1000
 k1 linseg 0,p3/3,0,0,1,2*p3/3,1
 a1 oscili k1, 0.5, 1
 a2 oscili k1, 0.6, 1
 asig tvconv asig,air,1-a2,1-a1,256,1024
 asig clip asig,1,0dbfs
 outs asig, asig
   
endin

</CsInstruments>
<CsScore>
f1 0 1024 7 0 512 0 1 1 511 1
i1 0 30
e
</CsScore>
</CsoundSynthesizer>


See also

pconvolve, convolve, ftconv

Credits

Author: Victor Lazzarini
2017

New in version 6.09