<?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" /> <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="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" title="oscilikt"> <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" title="Description"> <a id="idp33849608"></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" title="Syntax"> <a id="idp33860928"></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" title="Initialization"> <a id="idp33862832"></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" title="Performance"> <a id="idp33899008"></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" title="Examples"> <a id="idp33902800"></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="idp33903792"></a> <p class="title"> <strong>Example 531. 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> <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 oscilikt.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.</span> <span class="oblock">instr</span> 1 <span class="comment">; Generate a uni-polar (0-1) square wave.</span> kamp1 <span class="opc">init</span> 1 kcps1 <span class="opc">init</span> 2 itype <span class="op">=</span> 3 ksquare <span class="opc">lfo</span> kamp1, kcps1, itype <span class="comment">; Use the square wave to switch between Tables #1 and #2.</span> kamp2 <span class="opc">init</span> 20000 kcps2 <span class="opc">init</span> 220 kfn <span class="op">=</span> ksquare <span class="op">+</span> 1 a1 <span class="opc">oscilikt</span> kamp2, kcps2, kfn <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 waveform.</span> <span class="stamnt">f</span> 1 0 4096 10 0 1 <span class="comment">; Table #2: a sawtooth wave</span> <span class="stamnt">f</span> 2 0 3 -2 1 0 -1 <span class="comment">; Play Instrument #1 for two seconds.</span> <span class="stamnt">i</span> 1 0 2 <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="idp33906072"></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" title="Credits"> <a id="idp33907640"></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>