pvsbufread2

pvsbufread2 — This opcode reads a circular buffer of f-signals (streaming PV signals), with binwise additional delays.

Description

This opcode reads from a circular buffer of length ilen (secs), taking a handle for the buffer and a time pointer, which holds the current read position (also in seconds). It is used in conjunction with a pvsbuffer opocde. Reading is circular, wrapping around at the end of the buffer. Extra delay times are taken from a function table, with each point on it defining a delay time in seconds affecting the corresponding bin.

Syntax

fsig pvsbufread2  ktime, khandle, ift1, ift2 

Initialization

ift1 -- function table with at least fftisze/2+1 points where delays (in secs) for bin amplitudes are set (function table positions are equivalent to bin numbers)

ift2 -- function table with at least fftisze/2+1 points where delays (in secs) for bin frequencies are set (function table positions are equivalent to bin numbers)

Performance

fsig -- output pv stream

ktime -- time position of reading pointer (in secs).

khandle -- handle identifying the buffer to be read. When using k-rate handles, it is important to initialise the k-rate variable to a given existing handle. When changing buffers, fsig buffers need to be compatible (same fsig format).

With this opcode and pvsbuffer, it is possible to, among other things:

  • time-stretch/compress a fsig stream, by reading it at different rates
  • delay a fsig or portions of it.
  • 'brassage' two or more fsigs by switching buffers, since the reading handles are k-rate. Note that, when using k-rate handles, it is important to initialise the k-rate variable to a given handle (so that the fsig initialisation can take place) and it is only possible to switch handles between compatible fsig buffers (with the same fftsize and overlap).

[Note] Note

It is important that the handle value passed to pvsbufread2 is valid and was created by pvsbuffer. Csound will crash with invalid handles.

Examples

Here is an example of the pvsbufread2 opcode. It uses the file pvsbufread2.csd.

Example 659. Example of the pvsbufread2 opcode.

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

<CsoundSynthesizer>
<CsOptions>

</CsOptions>
<CsInstruments>
ksmps  = 64
0dbfs  = 1
nchnls = 2

instr 1
kcnt     init         0
ifftsize =            2048
ihop     =            ifftsize/4

a1       diskin2      "beats.wav", 1, 0, 1
a1       =            a1*0.5
fsig1    pvsanal      a1, ifftsize, ihop, ifftsize, 1
ih, kt   pvsbuffer    fsig1, 10

fsig2    pvsbufread2  kt, ih, 1, 1
fsig3    pvsbufread2  kt, ih, 2, 2

a2       pvsynth      fsig3
a3       pvsynth      fsig2

         outs         a2, a3
endin
</CsInstruments>
<CsScore>
f1 0 2048 -7 0 128 1.1 128 0.5  256 1.8 512 1.1 1024 0.1
f2 0 2048 -7 1 128 0.2 128 0.05 256 0.5 512 0.9 1024 0.1

i1 0 60
</CsScore>
</CsoundSynthesizer>


See Also

pvsanal, pvsynth, pvsbuffer, pvsadsyn

Credits

Author: Victor Lazzarini
July 2011