<?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>pvsadsyn</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="pvread.html" title="pvread" /> <link rel="next" href="pvsanal.html" title="pvsanal" /> </head> <body> <div class="navheader"> <table width="100%" summary="Navigation header"> <tr> <th colspan="3" align="center">pvsadsyn</th> </tr> <tr> <td width="20%" align="left"><a accesskey="p" href="pvread.html">Prev</a> </td> <th width="60%" align="center">Orchestra Opcodes and Operators</th> <td width="20%" align="right"> <a accesskey="n" href="pvsanal.html">Next</a></td> </tr> </table> <hr /> </div> <div class="refentry" title="pvsadsyn"> <a id="pvsadsyn"></a> <div class="titlepage"></div> <a id="IndexPvsadsyn" class="indexterm"></a> <div class="refnamediv"> <h2> <span class="refentrytitle">pvsadsyn</span> </h2> <p>pvsadsyn — Resynthesize using a fast oscillator-bank. </p> </div> <div class="refsect1" title="Description"> <a id="idp38062152"></a> <h2>Description</h2> <p> Resynthesize using a fast oscillator-bank. </p> </div> <div class="refsect1" title="Syntax"> <a id="idp38048928"></a> <h2>Syntax</h2> <pre class="synopsis">ares <span class="command"><strong>pvsadsyn</strong></span> fsrc, inoscs, kfmod [, ibinoffset] [, ibinincr] [, iinit]</pre> </div> <div class="refsect1" title="Initialization"> <a id="idp38050064"></a> <h2>Initialization</h2> <p> <span class="emphasis"><em>inoscs</em></span> -- The number of analysis bins to synthesise. Cannot be larger than the size of fsrc (see <a class="link" href="pvsinfo.html" title="pvsinfo"><em class="citetitle">pvsinfo</em></a>), e.g. as created by <a class="link" href="pvsanal.html" title="pvsanal"><em class="citetitle">pvsanal</em></a>. Processing time is directly proportional to inoscs. </p> <p> <span class="emphasis"><em>ibinoffset</em></span> (optional, default=0) -- The first (lowest) bin to resynthesise, counting from 0 (default = 0). </p> <p> <span class="emphasis"><em>ibinincr</em></span> (optional) -- Starting from bin ibinoffset, resynthesize bins ibinincr apart. </p> <p> <span class="emphasis"><em>iinit</em></span> (optional) -- Skip reinitialization. This is not currently implemented for any of these opcodes, and it remains to be seen if it is even practical. </p> </div> <div class="refsect1" title="Performance"> <a id="idp38100152"></a> <h2>Performance</h2> <p> <span class="emphasis"><em>kfmod</em></span> -- Scale all frequencies by factor kfmod. 1.0 = no change, 2 = up one octave. </p> <p> <span class="emphasis"><em>pvsadsyn</em></span> is experimental, and implements the oscillator bank using a fast direct calculation method, rather than a lookup table. This takes advantage of the fact, empirically arrived at, that for the analysis rates generally used, (and presuming analysis using <a class="link" href="pvsanal.html" title="pvsanal"><em class="citetitle">pvsanal</em></a>, where frequencies in a bin change only slightly between frames) it is not necessary to interpolate frequencies between frames, only amplitudes. Accurate resynthesis is often contingent on the use of pvsanal with iwinsize = ifftsize*2. </p> <p> This opcode is the most likely to change, or be much extended, according to feedback and advice from users. It is likely that a full interpolating table-based method will be added, via a further optional iarg. The parameter list to pvsadsyn mimics that for <a class="link" href="pvadd.html" title="pvadd"><em class="citetitle">pvadd</em></a>, but excludes spectral extraction. </p> </div> <div class="refsect1" title="Examples"> <a id="idp38103376"></a> <h2>Examples</h2> <p> Here is an example of the pvsadsyn opcode. It uses the file <a class="ulink" href="examples/pvsadsyn.csd" target="_top"><em class="citetitle">pvsadsyn.csd</em></a>. </p> <div class="example"> <a id="idp38104360"></a> <p class="title"> <strong>Example 634. Example of the pvsadsyn 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="comment">; Select audio/midi flags here according to platform</span> <span class="comment">; Audio out Audio in</span> -odac <span class="comment">;;;RT audio I/O</span> <span class="comment">; For Non-realtime ouput leave only the line below:</span> <span class="comment">; -o pvsadsyn.wav -W ;;; for file output any platform</span> <span class="csdtag"></CsOptions></span> <span class="csdtag"><CsInstruments></span> <span class="ohdr">sr</span> <span class="op">=</span> 44100 <span class="ohdr">ksmps</span> <span class="op">=</span> 16 <span class="ohdr">nchnls</span> <span class="op">=</span> 1 <span class="ohdr">0dbfs</span> <span class="op">=</span> 1 <span class="comment">;; example written by joachim heintz 2009</span> <span class="oblock">opcode</span> FileToPvsBuf, iik, Siiii <span class="comment">;;writes an audio file at the first k-cycle to a fft-buffer (via pvsbuffer)</span> Sfile, ifftsize, ioverlap, iwinsize, iwinshape <span class="opc">xin</span> ktimek <span class="opc">timeinstk</span> <span class="octrl">if</span> ktimek <span class="op">==</span> 1 then ilen <span class="opc">filelen</span> Sfile kcycles <span class="op">=</span> ilen <span class="op">*</span> <span class="ohdr">kr</span><span class="comment">; number of k-cycles to write the fft-buffer</span> kcount <span class="opc">init</span> 0 <span class="olabel">loop</span><span class="op">:</span> ain <span class="opc">soundin</span> Sfile fftin <span class="opc">pvsanal</span> ain, ifftsize, ioverlap, iwinsize, iwinshape ibuf, ktim <span class="opc">pvsbuffer</span> fftin, ilen <span class="op">+</span> (ifftsize <span class="op">/</span> sr) <span class="octrl">loop_lt</span> kcount, 1, kcycles, <span class="olabel">loop</span> <span class="opc">xout</span> ibuf, ilen, ktim <span class="octrl">endif</span> <span class="oblock">endop</span> <span class="oblock">instr</span> 1 istretch <span class="op">=</span> p4<span class="comment">; time stretching factor</span> ifftsize <span class="op">=</span> 1024 ioverlap <span class="op">=</span> ifftsize <span class="op">/</span> 4 iwinsize <span class="op">=</span> ifftsize iwinshape <span class="op">=</span> 1<span class="comment">; von-Hann window</span> ibuffer, ilen, k0 FileToPvsBuf "fox.wav", ifftsize, ioverlap, iwinsize, iwinshape p3 <span class="op">=</span> istretch <span class="op">*</span> ilen<span class="comment">; set p3 to the correct value</span> ktmpnt <span class="opc">linseg</span> 0, p3, ilen<span class="comment">; time pointer</span> fread <span class="opc">pvsbufread</span> ktmpnt, ibuffer<span class="comment">; read the buffer</span> aout <span class="opc">pvsadsyn</span> fread, 10, 1<span class="comment">; resynthesis with the first 10 bins</span> <span class="opc">out</span> aout <span class="oblock">endin</span> <span class="csdtag"></CsInstruments></span> <span class="csdtag"><CsScore></span> <span class="stamnt">i</span> 1 0 1 20 <span class="stamnt">e</span> <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="idp38106640"></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="pvsadsyn.html" title="pvsadsyn"><em class="citetitle">pvsadsyn</em></a> </p> </div> <div class="refsect1" title="Credits"> <a id="idp38108616"></a> <h2>Credits</h2> <p> </p> <table border="0" summary="Simple list" class="simplelist"> <tr> <td>Author: Richard Dobson</td> </tr> <tr> <td>August 2001 </td> </tr> </table> <p> </p> <p>New in version 4.13</p> </div> </div> <div class="navfooter"> <hr /> <table width="100%" summary="Navigation footer"> <tr> <td width="40%" align="left"><a accesskey="p" href="pvread.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="pvsanal.html">Next</a></td> </tr> <tr> <td width="40%" align="left" valign="top">pvread </td> <td width="20%" align="center"> <a accesskey="h" href="index.html">Home</a> </td> <td width="40%" align="right" valign="top"> pvsanal</td> </tr> </table> </div> </body> </html>