<?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>oscil3</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="oscil1i.html" title="oscil1i" /> <link rel="next" href="oscil.html" title="oscil" /> </head> <body> <div class="navheader"> <table width="100%" summary="Navigation header"> <tr> <th colspan="3" align="center">oscil3</th> </tr> <tr> <td width="20%" align="left"><a accesskey="p" href="oscil1i.html">Prev</a> </td> <th width="60%" align="center">Orchestra Opcodes and Operators</th> <td width="20%" align="right"> <a accesskey="n" href="oscil.html">Next</a></td> </tr> </table> <hr /> </div> <div class="refentry" title="oscil3"> <a id="oscil3"></a> <div class="titlepage"></div> <a id="IndexOscil3" class="indexterm"></a> <div class="refnamediv"> <h2> <span class="refentrytitle">oscil3</span> </h2> <p>oscil3 — A simple oscillator with cubic interpolation. </p> </div> <div class="refsect1" title="Description"> <a id="idp33748184"></a> <h2>Description</h2> <p> <span class="emphasis"><em>oscil3</em></span> reads table <span class="emphasis"><em>ifn</em></span> sequentially and repeatedly at a frequency <span class="emphasis"><em>xcps</em></span>. The amplitude is scaled by <span class="emphasis"><em>xamp</em></span>. Cubic interpolation is applied for table look up from internal phase values. </p> </div> <div class="refsect1" title="Syntax"> <a id="idp33759088"></a> <h2>Syntax</h2> <pre class="synopsis">ares <span class="command"><strong>oscil3</strong></span> xamp, xcps, ifn [, iphs]</pre> <pre class="synopsis">kres <span class="command"><strong>oscil3</strong></span> kamp, kcps, ifn [, iphs]</pre> </div> <div class="refsect1" title="Initialization"> <a id="idp33760920"></a> <h2>Initialization</h2> <p> <span class="emphasis"><em>ifn</em></span> -- function table number. Requires a wrap-around guard point. </p> <p> <span class="emphasis"><em>iphs</em></span> (optional) -- initial phase of sampling, expressed as a fraction of a cycle (0 to 1). A negative value will cause phase initialization to be skipped. The default value is 0. </p> </div> <div class="refsect1" title="Performance"> <a id="idp33762368"></a> <h2>Performance</h2> <p> <span class="emphasis"><em>kamp, xamp</em></span> -- amplitude </p> <p> <span class="emphasis"><em>kcps, xcps</em></span> -- frequency in cycles per second. </p> <p> <span class="emphasis"><em>oscil3</em></span> is identical to <a class="link" href="oscili.html" title="oscili"><em class="citetitle">oscili</em></a>, except that it uses cubic interpolation. </p> <p> Table <span class="emphasis"><em>ifn</em></span> is incrementally sampled modulo the table length and the value obtained is multiplied by <span class="emphasis"><em>amp</em></span>. </p> <p> If you need to change the oscillator table with a k-rate signal, you can use <a class="link" href="oscilikt.html" title="oscilikt"><em class="citetitle">oscilikt</em></a>. </p> </div> <div class="refsect1" title="Examples"> <a id="idp33798032"></a> <h2>Examples</h2> <p> Here is an example of the oscil3 opcode. It uses the file <a class="ulink" href="examples/oscil3.csd" target="_top"><em class="citetitle">oscil3.csd</em></a>. </p> <div class="example"> <a id="idp33799000"></a> <p class="title"> <strong>Example 528. Example of the oscil3 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 realtime audio input is needed too</span> <span class="comment">; For Non-realtime ouput leave only the line below:</span> <span class="comment">; -o oscil3.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 <span class="oblock">instr</span> 1 kamp <span class="op">=</span> .6 kcps <span class="op">=</span> 440 ifn <span class="op">=</span> p4 asig <span class="opc">oscil</span> kamp, kcps, ifn <span class="opc">outs</span> asig,asig <span class="oblock">endin</span> <span class="oblock">instr</span> 2 kamp <span class="op">=</span> .6 kcps <span class="op">=</span> 440 ifn <span class="op">=</span> p4 asig <span class="opc">oscil3</span> kamp, kcps, ifn <span class="opc">outs</span> asig,asig <span class="oblock">endin</span> <span class="csdtag"></CsInstruments></span> <span class="csdtag"><CsScore></span> <span class="stamnt">f</span>1 0 128 10 1 <span class="comment">; Sine with a small amount of data</span> <span class="stamnt">f</span>2 0 128 10 1 0.5 0.3 0.25 0.2 0.167 0.14 0.125 .111 <span class="comment">; Sawtooth with a small amount of data</span> <span class="stamnt">f</span>3 0 128 10 1 0 0.3 0 0.2 0 0.14 0 .111 <span class="comment">; Square with a small amount of data</span> <span class="stamnt">f</span>4 0 128 10 1 1 1 1 0.7 0.5 0.3 0.1 <span class="comment">; Pulse with a small amount of data</span> <span class="stamnt">i</span> 1 0 2 1 <span class="stamnt">i</span> 2 3 2 1 <span class="stamnt">i</span> 1 6 2 2 <span class="stamnt">i</span> 2 9 2 2 <span class="stamnt">i</span> 1 12 2 3 <span class="stamnt">i</span> 2 15 2 3 <span class="stamnt">i</span> 1 18 2 4 <span class="stamnt">i</span> 2 21 2 4 <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="idp33801272"></a> <h2>See Also</h2> <p> <a class="link" href="oscil.html" title="oscil"><em class="citetitle">oscil</em></a>, <a class="link" href="oscili.html" title="oscili"><em class="citetitle">oscili</em></a>, <a class="link" href="oscilikt.html" title="oscilikt"><em class="citetitle">oscilikt</em></a> </p> </div> <div class="refsect1" title="Credits"> <a id="idp33803248"></a> <h2>Credits</h2> <p>Author: John ffitch</p> <p>New in Csound version 3.50</p> </div> </div> <div class="navfooter"> <hr /> <table width="100%" summary="Navigation footer"> <tr> <td width="40%" align="left"><a accesskey="p" href="oscil1i.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="oscil.html">Next</a></td> </tr> <tr> <td width="40%" align="left" valign="top">oscil1i </td> <td width="20%" align="center"> <a accesskey="h" href="index.html">Home</a> </td> <td width="40%" align="right" valign="top"> oscil</td> </tr> </table> </div> </body> </html>