<?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>poscil3</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="portk.html" title="portk" /> <link rel="next" href="poscil.html" title="poscil" /> </head> <body> <div class="navheader"> <table width="100%" summary="Navigation header"> <tr> <th colspan="3" align="center">poscil3</th> </tr> <tr> <td width="20%" align="left"><a accesskey="p" href="portk.html">Prev</a> </td> <th width="60%" align="center">Orchestra Opcodes and Operators</th> <td width="20%" align="right"> <a accesskey="n" href="poscil.html">Next</a></td> </tr> </table> <hr /> </div> <div class="refentry" title="poscil3"> <a id="poscil3"></a> <div class="titlepage"></div> <a id="Indexposcil3" class="indexterm"></a> <div class="refnamediv"> <h2> <span class="refentrytitle">poscil3</span> </h2> <p>poscil3 — High precision oscillator with cubic interpolation. </p> </div> <div class="refsect1" title="Description"> <a id="idp36843352"></a> <h2>Description</h2> <p> High precision oscillator with cubic interpolation. </p> </div> <div class="refsect1" title="Syntax"> <a id="idp36844096"></a> <h2>Syntax</h2> <pre class="synopsis">ares <span class="command"><strong>poscil3</strong></span> aamp, acps, ifn [, iphs]</pre> <pre class="synopsis">ares <span class="command"><strong>poscil3</strong></span> aamp, kcps, ifn [, iphs]</pre> <pre class="synopsis">ares <span class="command"><strong>poscil3</strong></span> kamp, acps, ifn [, iphs]</pre> <pre class="synopsis">ares <span class="command"><strong>poscil3</strong></span> kamp, kcps, ifn [, iphs]</pre> <pre class="synopsis">ires <span class="command"><strong>poscil3</strong></span> kamp, kcps, ifn [, iphs]</pre> <pre class="synopsis">kres <span class="command"><strong>poscil3</strong></span> kamp, kcps, ifn [, iphs]</pre> </div> <div class="refsect1" title="Initialization"> <a id="idp36893744"></a> <h2>Initialization</h2> <p> <span class="emphasis"><em>ifn</em></span> -- function table number </p> <p> <span class="emphasis"><em>iphs</em></span> (optional, default=0) -- initial phase (normalized table index 0-1) </p> </div> <div class="refsect1" title="Performance"> <a id="idp36895176"></a> <h2>Performance</h2> <p> <span class="emphasis"><em>ares</em></span> -- output signal </p> <p> <span class="emphasis"><em>kamp</em></span>, <span class="emphasis"><em>aamp</em></span> -- the amplitude of the output signal. </p> <p> <span class="emphasis"><em>kcps</em></span>, <span class="emphasis"><em>acps</em></span> -- the frequency of the output signal in cycles per second. </p> <p> <span class="emphasis"><em>poscil3</em></span> works like <a class="link" href="poscil.html" title="poscil"><em class="citetitle">poscil</em></a>, but uses cubic interpolation. </p> <p>Note that <span class="emphasis"><em>poscil3</em></span> can use defered (non-power of two) length tables.</p> </div> <div class="refsect1" title="Examples"> <a id="idp36898936"></a> <h2>Examples</h2> <p> Here is an example of the poscil3 opcode. It uses the file <a class="ulink" href="examples/poscil3.csd" target="_top"><em class="citetitle">poscil3.csd</em></a>. </p> <div class="example"> <a id="idp36899920"></a> <p class="title"> <strong>Example 606. Example of the poscil3 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> -odac <span class="comment">;;;realtime audio out</span> <span class="comment">;-iadc ;;;uncomment -iadc if real audio input is needed too</span> <span class="comment">; For Non-realtime ouput leave only the line below:</span> <span class="comment">; -o poscil3.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> 32 <span class="ohdr">nchnls</span> <span class="op">=</span> 2 <span class="ohdr">0dbfs</span> <span class="op">=</span> 1 giSine <span class="ohdr">ftgen</span> 0, 0, 2^10, 10, 1 <span class="oblock">instr</span> 1 krnd <span class="opc">randomh</span> 40, 440, 1 <span class="comment">; produce random values</span> ain <span class="opc">poscil3</span> .6, krnd, giSine kline <span class="opc">line</span> 1, p3, 0 <span class="comment">; straight line</span> aL,aR <span class="opc">pan2</span> ain, kline <span class="comment">; sent across image</span> <span class="opc">outs</span> aL, aR <span class="oblock">endin</span> <span class="csdtag"></CsInstruments></span> <span class="csdtag"><CsScore></span> <span class="stamnt">i</span>1 0 10 <span class="stamnt">e</span> <span class="csdtag"></CsScore></span> <span class="csdtag"></CsoundSynthesizer></span> </pre> </div> </div> <p><br class="example-break" /> </p> <p> Here is another example of the poscil3 opcode, which uses a table filled from a sound file. It uses the file <a class="ulink" href="examples/poscil3-file.csd" target="_top"> <em class="citetitle">poscil3-file.csd</em> </a>. </p> <div class="example"> <a id="idp36903248"></a> <p class="title"> <strong>Example 607. Another example of the poscil3 opcode.</strong> </p> <div class="example-contents"> <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 No messages</span> -odac -iadc -d <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 poscil3-file.wav -W ;;; for file output any platform</span> <span class="csdtag"></CsOptions></span> <span class="csdtag"><CsInstruments></span> <span class="comment">; Example written by Joachim Heintz 07/2008</span> <span class="ohdr">sr</span> <span class="op">=</span> 44100 <span class="ohdr">kr</span> <span class="op">=</span> 4410 <span class="ohdr">ksmps</span> <span class="op">=</span> 10 <span class="ohdr">nchnls</span> <span class="op">=</span> 1 <span class="comment">; non-normalized function table with a sample 1</span> giFile <span class="ohdr">ftgen</span> 1, 0, 0, <span class="op">-</span>1, "fox.wav", 0, 0, 0 <span class="comment">; Instrument #1 - uses poscil3 for playing samples from a function table</span> <span class="oblock">instr</span> 1 kamp <span class="op">=</span> p4 kspeed <span class="op">=</span> p5 ifn <span class="op">=</span> 1 iskip <span class="op">=</span> p6 kcps <span class="op">=</span> kspeed <span class="op">/</span> (<span class="opc">ftlen</span>(ifn) <span class="op">/</span> <span class="opc">ftsr</span>(ifn))<span class="comment">; frequency of the oscillator</span> iphs <span class="op">=</span> iskip <span class="op">/</span> (<span class="opc">ftlen</span>(ifn) <span class="op">/</span> <span class="opc">ftsr</span>(ifn))<span class="comment">; calculates skiptime to phase values (0-1)</span> a1 <span class="opc">poscil3</span> kamp, kcps, ifn, iphs <span class="opc">out</span> a1 <span class="oblock">endin</span> <span class="csdtag"></CsInstruments></span> <span class="csdtag"><CsScore></span> <span class="stamnt">i</span>1 0 2.756 1 1 0 <span class="stamnt">i</span>1 3 2.756 1 -1 0 <span class="stamnt">i</span>1 6 1.378 1 .5 2.067 <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="idp36904256"></a> <h2>See Also</h2> <p> <a class="link" href="poscil.html" title="poscil"><em class="citetitle">poscil</em></a> </p> </div> <div class="refsect1" title="Credits"> <a id="idp36905304"></a> <h2>Credits</h2> <p> </p> <table border="0" summary="Simple list" class="simplelist"> <tr> <td>Authors: John ffitch, Gabriel Maldonado</td> </tr> <tr> <td>Italy</td> </tr> </table> <p> </p> <p>New in Csound version 3.52</p> <p> variants with a-rate amplitude or frequency new in 5.16</p> </div> </div> <div class="navfooter"> <hr /> <table width="100%" summary="Navigation footer"> <tr> <td width="40%" align="left"><a accesskey="p" href="portk.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="poscil.html">Next</a></td> </tr> <tr> <td width="40%" align="left" valign="top">portk </td> <td width="20%" align="center"> <a accesskey="h" href="index.html">Home</a> </td> <td width="40%" align="right" valign="top"> poscil</td> </tr> </table> </div> </body> </html>