<?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" href="csound.css" type="text/css" /> <meta name="generator" content="DocBook XSL Stylesheets V1.75.2" /> <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="oscili.html" title="oscili" /> </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="oscili.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="id3062445"></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="id3062478"></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="id3063365"></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="id3063389"></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="id3063450"></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="id3063467"></a> <p class="title"> <b>Example 404. Example of the oscil3 opcode.</b> </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 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 oscil3.wav -W ;;; for file output any platform</span> <span class="csdtag"></CsOptions></span> <span class="csdtag"><CsInstruments></span> <span class="comment">; Initialize the global variables.</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">; Instrument #1 - a basic oscillator.</span> <span class="oblock">instr</span> 1 kamp <span class="op">=</span> 10000 kcps <span class="op">=</span> 220 ifn <span class="op">=</span> 1 a1 <span class="opc">oscil</span> kamp, kcps, ifn <span class="opc">out</span> a1 <span class="oblock">endin</span> <span class="comment">; Instrument #2 - the basic oscillator with cubic interpolation.</span> <span class="oblock">instr</span> 2 kamp <span class="op">=</span> 10000 kcps <span class="op">=</span> 220 ifn <span class="op">=</span> 1 a1 <span class="opc">oscil3</span> kamp, kcps, ifn <span class="opc">out</span> a1 <span class="oblock">endin</span> <span class="csdtag"></CsInstruments></span> <span class="csdtag"><CsScore></span> <span class="comment">; Table #1, a sine wave table with a small amount of data.</span> <span class="stamnt">f</span> 1 0 32 10 0 1 <span class="comment">; Play Instrument #1, the basic oscillator, for </span> <span class="comment">; two seconds. This should sound relatively rough.</span> <span class="stamnt">i</span> 1 0 2 <span class="comment">; Play Instrument #2, the cubic interpolated oscillator, for</span> <span class="comment">; two seconds. This should sound relatively smooth.</span> <span class="stamnt">i</span> 2 2 2 <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="id3063504"></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="id3063537"></a> <h2>Credits</h2> <p>Author: John ffitch</p> <p>Example written by Kevin Conder.</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="oscili.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"> oscili</td> </tr> </table> </div> </body> </html>