<?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>oscilikt</title> <link rel="stylesheet" type="text/css" href="csound.css" /> <link rel="stylesheet" type="text/css" href="syntax-highlighting.css" /> <meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /> <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="oscili.html" title="oscili" /> <link rel="next" href="osciliktp.html" title="osciliktp" /> </head> <body> <div class="navheader"> <table width="100%" summary="Navigation header"> <tr> <th colspan="3" align="center">oscilikt</th> </tr> <tr> <td width="20%" align="left"><a accesskey="p" href="oscili.html">Prev</a> </td> <th width="60%" align="center">Orchestra Opcodes and Operators</th> <td width="20%" align="right"> <a accesskey="n" href="osciliktp.html">Next</a></td> </tr> </table> <hr /> </div> <div class="refentry"> <a id="oscilikt"></a> <div class="titlepage"></div> <a id="IndexOscilikt" class="indexterm"></a> <div class="refnamediv"> <h2> <span class="refentrytitle">oscilikt</span> </h2> <p>oscilikt — A linearly interpolated oscillator that allows changing the table number at k-rate. </p> </div> <div class="refsect1"> <a id="idm281472908925176"></a> <h2>Description</h2> <p> <span class="emphasis"><em>oscilikt</em></span> is very similar to <a class="link" href="oscili.html" title="oscili"><em class="citetitle">oscili</em></a>, but allows changing the table number at k-rate. It is slightly slower than <span class="emphasis"><em>oscili</em></span> (especially with high control rate), although also more accurate as it uses a 31-bit phase accumulator, as opposed to the 24-bit one used by <span class="emphasis"><em>oscili</em></span>. </p> </div> <div class="refsect1"> <a id="idm281472908850584"></a> <h2>Syntax</h2> <pre class="synopsis">ares <span class="command"><strong>oscilikt</strong></span> xamp, xcps, kfn [, iphs] [, istor]</pre> <pre class="synopsis">kres <span class="command"><strong>oscilikt</strong></span> kamp, kcps, kfn [, iphs] [, istor]</pre> </div> <div class="refsect1"> <a id="idm281472908846872"></a> <h2>Initialization</h2> <p> <span class="emphasis"><em>iphs</em></span> (optional, defaults to 0) -- initial phase in the range 0 to 1. Other values are wrapped to the allowed range. </p> <p> <span class="emphasis"><em>istor</em></span> (optional, defaults to 0) -- skip initialization. </p> </div> <div class="refsect1"> <a id="idm281472908844024"></a> <h2>Performance</h2> <p> <span class="emphasis"><em>kamp</em></span>, <span class="emphasis"><em>xamp</em></span> -- amplitude. </p> <p> <span class="emphasis"><em>kcps</em></span>, <span class="emphasis"><em>xcps</em></span> -- frequency in Hz. Zero and negative values are allowed. However, the absolute value must be less than <a class="link" href="sr.html" title="sr"><em class="citetitle">sr</em></a> (and recommended to be less than <span class="emphasis"><em>sr/</em></span>2). </p> <p> <span class="emphasis"><em>kfn</em></span> -- function table number. Can be varied at control rate (useful to <span class="quote">“<span class="quote">morph</span>”</span> waveforms, or select from a set of band-limited tables generated by <a class="link" href="GEN30.html" title="GEN30"><em class="citetitle">GEN30</em></a>). </p> </div> <div class="refsect1"> <a id="idm281472908836888"></a> <h2>Examples</h2> <p> Here is an example of the oscilikt opcode. It uses the file <a class="ulink" href="examples/oscilikt.csd" target="_top"><em class="citetitle">oscilikt.csd</em></a>. </p> <div class="example"> <a id="idm281472908835032"></a> <p class="title"> <strong>Example 625. Example of the oscilikt 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> <div class="refsect1"> <a id="idm281472731872008"></a> <pre class="programlisting"> <span class="nt"><CsoundSynthesizer></span> <span class="nt"><CsOptions></span> <span class="c1">; Select audio/midi flags here according to platform</span> <span class="c1">; Audio out Audio in No messages</span> -odac -iadc -d <span class="c1">;;;RT audio I/O</span> <span class="c1">; For Non-realtime ouput leave only the line below:</span> <span class="c1">; -o oscilikt.wav -W ;;; for file output any platform</span> <span class="nt"></CsOptions></span> <span class="nt"><CsInstruments></span> <span class="c1">; Initialize the global variables.</span> <span class="vg">sr</span> <span class="o">=</span> <span class="mi">44100</span> <span class="vg">kr</span> <span class="o">=</span> <span class="mi">4410</span> <span class="vg">ksmps</span> <span class="o">=</span> <span class="mi">10</span> <span class="vg">nchnls</span> <span class="o">=</span> <span class="mi">1</span> <span class="c1">; Instrument #1.</span> <span class="kd">instr</span> <span class="nf">1</span> <span class="c1">; Generate a uni-polar (0-1) square wave.</span> k<span class="n">amp1</span> <span class="nb">init</span> <span class="mi">1</span> k<span class="n">cps1</span> <span class="nb">init</span> <span class="mi">2</span> i<span class="n">type</span> <span class="o">=</span> <span class="mi">3</span> k<span class="n">square</span> <span class="nb">lfo</span> k<span class="n">amp1</span><span class="p">,</span> k<span class="n">cps1</span><span class="p">,</span> i<span class="n">type</span> <span class="c1">; Use the square wave to switch between Tables #1 and #2.</span> k<span class="n">amp2</span> <span class="nb">init</span> <span class="mi">20000</span> k<span class="n">cps2</span> <span class="nb">init</span> <span class="mi">220</span> k<span class="n">fn</span> <span class="o">=</span> k<span class="n">square</span> <span class="o">+</span> <span class="mi">1</span> a<span class="n">1</span> <span class="nb">oscilikt</span> k<span class="n">amp2</span><span class="p">,</span> k<span class="n">cps2</span><span class="p">,</span> k<span class="n">fn</span> <span class="nb">out</span> a<span class="n">1</span> <span class="kd">endin</span> <span class="nt"></CsInstruments></span> <span class="nt"><CsScore></span> <span class="c1">; Table #1, a sine waveform.</span> <span class="nb">f</span> <span class="mi">1</span> <span class="mi">0</span> <span class="mi">4096</span> <span class="mi">10</span> <span class="mi">0</span> <span class="mi">1</span> <span class="c1">; Table #2: a sawtooth wave</span> <span class="nb">f</span> <span class="mi">2</span> <span class="mi">0</span> <span class="mi">3</span> <span class="o">-</span><span class="mi">2</span> <span class="mi">1</span> <span class="mi">0</span> <span class="o">-</span><span class="mi">1</span> <span class="c1">; Play Instrument #1 for two seconds.</span> <span class="nb">i</span> <span class="mi">1</span> <span class="mi">0</span> <span class="mi">2</span> <span class="nt"></CsScore></span> <span class="nt"></CsoundSynthesizer></span> </pre> </div> </div> </div> <p><br class="example-break" /> </p> </div> <div class="refsect1"> <a id="idm281472908830744"></a> <h2>See Also</h2> <p> <a class="link" href="osciliktp.html" title="osciliktp"><em class="citetitle">osciliktp</em></a> and <a class="link" href="oscilikts.html" title="oscilikts"><em class="citetitle">oscilikts</em></a>. </p> </div> <div class="refsect1"> <a id="idm281472908827640"></a> <h2>Credits</h2> <p>Author: Istvan Varga</p> <p>Example written by Kevin Conder.</p> <p>New in version 4.22</p> </div> </div> <div class="navfooter"> <hr /> <table width="100%" summary="Navigation footer"> <tr> <td width="40%" align="left"><a accesskey="p" href="oscili.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="osciliktp.html">Next</a></td> </tr> <tr> <td width="40%" align="left" valign="top">oscili </td> <td width="20%" align="center"> <a accesskey="h" href="index.html">Home</a> </td> <td width="40%" align="right" valign="top"> osciliktp</td> </tr> </table> </div> </body> </html>