<?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>pvsbufread2</title> <link rel="stylesheet" type="text/css" href="csound.css" /> <meta name="generator" content="DocBook XSL Stylesheets V1.76.1" /> <link rel="home" href="index.html" title="The Canonical Csound Reference Manual" /> <link rel="up" href="OpcodesTop.html" title="Orchestra Opcodes and Operators" /> <link rel="prev" href="pvsbufread.html" title="pvsbufread" /> <link rel="next" href="pvscale.html" title="pvscale" /> </head> <body> <div class="navheader"> <table width="100%" summary="Navigation header"> <tr> <th colspan="3" align="center">pvsbufread2</th> </tr> <tr> <td width="20%" align="left"><a accesskey="p" href="pvsbufread.html">Prev</a> </td> <th width="60%" align="center">Orchestra Opcodes and Operators</th> <td width="20%" align="right"> <a accesskey="n" href="pvscale.html">Next</a></td> </tr> </table> <hr /> </div> <div class="refentry" title="pvsbufread2"> <a id="pvsbufread2"></a> <div class="titlepage"></div> <a id="Indexpvsbufread2" class="indexterm"></a> <div class="refnamediv"> <h2> <span class="refentrytitle">pvsbufread2</span> </h2> <p>pvsbufread2 — This opcode reads a circular buffer of f-signals (streaming PV signals), with binwise additional delays. </p> </div> <div class="refsect1" title="Description"> <a id="idp38369312"></a> <h2>Description</h2> <p> 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 <span class="emphasis"><em>pvsbuffer</em></span> 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. </p> </div> <div class="refsect1" title="Syntax"> <a id="idp38429608"></a> <h2>Syntax</h2> <pre class="synopsis">fsig <span class="command"><strong>pvsbufread2</strong></span> ktime, khandle, ift1, ift2 </pre> </div> <div class="refsect1" title="Initialization"> <a id="idp38430720"></a> <h2>Initialization</h2> <p> <span class="emphasis"><em>ift1</em></span> -- 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) </p> <p> <span class="emphasis"><em>ift2</em></span> -- 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) </p> </div> <div class="refsect1" title="Performance"> <a id="idp38432280"></a> <h2>Performance</h2> <p> <span class="emphasis"><em>fsig</em></span> -- output pv stream </p> <p> <span class="emphasis"><em>ktime</em></span> -- time position of reading pointer (in secs). </p> <p> <span class="emphasis"><em>khandle</em></span> -- 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). </p> <p> With this opcode and <a class="link" href="pvsbuffer.html" title="pvsbuffer"><em class="citetitle">pvsbuffer</em></a>, it is possible to, among other things: </p> <div class="itemizedlist"> <ul class="itemizedlist" type="disc"> <li class="listitem">time-stretch/compress a fsig stream, by reading it at different rates</li> <li class="listitem">delay a fsig or portions of it.</li> <li class="listitem">'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).</li> </ul> </div> <p> </p> <div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"> <table border="0" summary="Note"> <tr> <td rowspan="2" align="center" valign="top" width="25"> <img alt="[Note]" src="images/note.png" /> </td> <th align="left">Note</th> </tr> <tr> <td align="left" valign="top"> <p> It is important that the handle value passed to <span class="emphasis"><em>pvsbufread2</em></span> is valid and was created by <a class="link" href="pvsbuffer.html" title="pvsbuffer"><em class="citetitle">pvsbuffer</em></a>. Csound will crash with invalid handles. </p> </td> </tr> </table> </div> </div> <div class="refsect1" title="Examples"> <a id="idp38437688"></a> <h2>Examples</h2> <p> Here is an example of the pvsbufread2 opcode. It uses the file <a class="ulink" href="examples/pvsbufread2.csd" target="_top"><em class="citetitle">pvsbufread2.csd</em></a>. </p> <div class="example"> <a id="idp38438680"></a> <p class="title"> <strong>Example 644. Example of the pvsbufread2 opcode.</strong> </p> <div class="example-contents"> <p>See the sections <a class="link" href="UsingRealTime.html" title="Real-Time Audio"><em class="citetitle">Real-time Audio</em></a> and <a class="link" href="CommandFlags.html" title="Csound command line"><em class="citetitle">Command Line Flags</em></a> for more information on using command line flags.</p> <pre class="programlisting"> <span class="csdtag"><CsoundSynthesizer></span> <span class="csdtag"><CsOptions></span> <span class="csdtag"></CsOptions></span> <span class="csdtag"><CsInstruments></span> <span class="ohdr">ksmps</span> <span class="op">=</span> 64 <span class="ohdr">0dbfs</span> <span class="op">=</span> 1 <span class="ohdr">nchnls</span> <span class="op">=</span> 2 <span class="oblock">instr</span> 1 kcnt <span class="opc">init</span> 0 ifftsize <span class="op">=</span> 2048 ihop <span class="op">=</span> ifftsize<span class="op">/</span>4 a1 <span class="opc">diskin2</span> "beats.wav", 1, 0, 1 a1 <span class="op">=</span> a1<span class="op">*</span>0.5 fsig1 <span class="opc">pvsanal</span> a1, ifftsize, ihop, ifftsize, 1 ih, kt <span class="opc">pvsbuffer</span> fsig1, 10 fsig2 <span class="opc">pvsbufread2</span> kt, ih, 1, 1 fsig3 <span class="opc">pvsbufread2</span> kt, ih, 2, 2 a2 <span class="opc">pvsynth</span> fsig3 a3 <span class="opc">pvsynth</span> fsig2 <span class="opc">outs</span> a2, a3 <span class="oblock">endin</span> <span class="csdtag"></CsInstruments></span> <span class="csdtag"><CsScore></span> <span class="stamnt">f</span>1 0 2048 -7 0 128 1.1 128 0.5 256 1.8 512 1.1 1024 0.1 <span class="stamnt">f</span>2 0 2048 -7 1 128 0.2 128 0.05 256 0.5 512 0.9 1024 0.1 <span class="stamnt">i</span>1 0 60 <span class="csdtag"></CsScore></span> <span class="csdtag"></CsoundSynthesizer></span> </pre> </div> </div> <p><br class="example-break" /> </p> </div> <div class="refsect1" title="See Also"> <a id="idp38440960"></a> <h2>See Also</h2> <p> <a class="link" href="pvsanal.html" title="pvsanal"><em class="citetitle">pvsanal</em></a>, <a class="link" href="pvsynth.html" title="pvsynth"><em class="citetitle">pvsynth</em></a>, <a class="link" href="pvsbuffer.html" title="pvsbuffer"><em class="citetitle">pvsbuffer</em></a>, <a class="link" href="pvsadsyn.html" title="pvsadsyn"><em class="citetitle">pvsadsyn</em></a> </p> </div> <div class="refsect1" title="Credits"> <a id="idp38443416"></a> <h2>Credits</h2> <p> </p> <table border="0" summary="Simple list" class="simplelist"> <tr> <td>Author: Victor Lazzarini</td> </tr> <tr> <td>July 2011</td> </tr> </table> <p> </p> </div> </div> <div class="navfooter"> <hr /> <table width="100%" summary="Navigation footer"> <tr> <td width="40%" align="left"><a accesskey="p" href="pvsbufread.html">Prev</a> </td> <td width="20%" align="center"> <a accesskey="u" href="OpcodesTop.html">Up</a> </td> <td width="40%" align="right"> <a accesskey="n" href="pvscale.html">Next</a></td> </tr> <tr> <td width="40%" align="left" valign="top">pvsbufread </td> <td width="20%" align="center"> <a accesskey="h" href="index.html">Home</a> </td> <td width="40%" align="right" valign="top"> pvscale</td> </tr> </table> </div> </body> </html>