pvsbuffer — This opcode creates and writes to a circular buffer for streaming PV signals.
This opcode sets up and writes to a circular buffer of length ilen (secs), giving a handle for the buffer and a time pointer, which holds the current write position (also in seconds). It can be used with one or more pvsbufread opcodes. Writing is circular, wrapping around at the end of the buffer.
ihandle -- handle identifying this particular buffer, which should be passed to a reader opcode.
ilen -- buffer length in seconds.
fsig -- an input pv stream
ktime -- the current time of writing in the buffer
Here is an example of the pvsbuffer opcode.
Example 351. Example of the pvsbuffer opcode
With this opcode and pvsbufread, it is possible to, among other things: 1) time-stretch/compress a fsig stream, by reading it at different rates 2) delay a fsig or portions of it. 3) '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), eg.
See the sections Real-time Audio and Command Line Flags for more information on using command line flags.
fsig1 pvsanal asig1,1024,256,1024,1 fsig2 pvsanal asig2,1024,256,1024,1 ibuf1,kt1 pvsbuffer fsig1, 10 ; 10-sec buf with fsig1 ibuf2,kt2 pvsbuffer fsig2, 7 ; 7-sec buf with fsig2 khan init ibuf1 ; initialise handle to buf1 if ktrig > 0 then ; switch buffers according to trigger khan = ibuf2 else khan = ibuf1 endif fsb pvsbufread kt1, khan ; read buffer