<?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>ctrl14</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="crunch.html" title="crunch" /> <link rel="next" href="ctrl21.html" title="ctrl21" /> </head> <body> <div class="navheader"> <table width="100%" summary="Navigation header"> <tr> <th colspan="3" align="center">ctrl14</th> </tr> <tr> <td width="20%" align="left"><a accesskey="p" href="crunch.html">Prev</a> </td> <th width="60%" align="center">Orchestra Opcodes and Operators</th> <td width="20%" align="right"> <a accesskey="n" href="ctrl21.html">Next</a></td> </tr> </table> <hr /> </div> <div class="refentry"> <a id="ctrl14"></a> <div class="titlepage"></div> <a id="IndexCtrl14" class="indexterm"></a> <div class="refnamediv"> <h2> <span class="refentrytitle">ctrl14</span> </h2> <p>ctrl14 — Allows a floating-point 14-bit MIDI signal scaled with a minimum and a maximum range. </p> </div> <div class="refsect1"> <a id="idm281472943756296"></a> <h2>Description</h2> <p> Allows a floating-point 14-bit MIDI signal scaled with a minimum and a maximum range. </p> </div> <div class="refsect1"> <a id="idm281472943675432"></a> <h2>Syntax</h2> <pre class="synopsis">idest <span class="command"><strong>ctrl14</strong></span> ichan, ictlno1, ictlno2, imin, imax [, ifn]</pre> <pre class="synopsis">kdest <span class="command"><strong>ctrl14</strong></span> ichan, ictlno1, ictlno2, kmin, kmax [, ifn]</pre> </div> <div class="refsect1"> <a id="idm281472943671816"></a> <h2>Initialization</h2> <p> <span class="emphasis"><em>idest</em></span> -- output signal </p> <p> <span class="emphasis"><em>ichan</em></span> -- MIDI channel number (1-16) </p> <p> <span class="emphasis"><em>ictln1o</em></span> -- most-significant byte controller number (0-127) </p> <p> <span class="emphasis"><em>ictlno2</em></span> -- least-significant byte controller number (0-127) </p> <p> <span class="emphasis"><em>imin</em></span> -- user-defined minimum floating-point value of output </p> <p> <span class="emphasis"><em>imax</em></span> -- user-defined maximum floating-point value of output </p> <p> <span class="emphasis"><em>ifn</em></span> (optional) -- table to be read when indexing is required. Table must be normalized. Output is scaled according to <span class="emphasis"><em>imax</em></span> and <span class="emphasis"><em>imin</em></span> val. </p> </div> <div class="refsect1"> <a id="idm281472943664152"></a> <h2>Performance</h2> <p> <span class="emphasis"><em>kdest</em></span> -- output signal </p> <p> <span class="emphasis"><em>kmin</em></span> -- user-defined minimum floating-point value of output </p> <p> <span class="emphasis"><em>kmax</em></span> -- user-defined maximum floating-point value of output </p> <p> <span class="emphasis"><em>ctrl14</em></span> (i- and k-rate 14 bit MIDI control) allows a floating-point 14-bit MIDI signal scaled with a minimum and a maximum range. The minimum and maximum values can be varied at k-rate. It can use optional interpolated table indexing. It requires two MIDI controllers as input. </p> <p> <span class="emphasis"><em>ctrl14</em></span> differs from <a class="link" href="midic14.html" title="midic14"><em class="citetitle">midic14</em></a> because it can be included in score-oriented instruments without Csound crashes. It needs the additional parameter <span class="emphasis"><em>ichan</em></span> containing the MIDI channel of the controller. MIDI channel is the same for all the controllers used in a single <span class="emphasis"><em>ctrl14</em></span> opcode. </p> </div> <div class="refsect1"> <a id="idm281472943656792"></a> <h2>Examples</h2> <p> Here is an example of the ctrl14 opcode. It uses the file <a class="ulink" href="examples/ctrl14.csd" target="_top"><em class="citetitle">ctrl14.csd</em></a>. </p> <div class="example"> <a id="idm281472943654936"></a> <p class="title"> <strong>Example 175. Example of the ctrl14 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="idm281472776650552"></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> -odac -M0 <span class="c1">;;;RT audio I/O with MIDI in</span> <span class="c1">;-iadc ;;;uncomment -iadc if RT audio input is needed too</span> <span class="nt"></CsOptions></span> <span class="nt"><CsInstruments></span> <span class="vg">sr</span> <span class="o">=</span> <span class="mi">44100</span> <span class="vg">ksmps</span> <span class="o">=</span> <span class="mi">32</span> <span class="vg">nchnls</span> <span class="o">=</span> <span class="mi">2</span> <span class="vg">0dbfs</span> <span class="o">=</span> <span class="mi">1</span> <span class="kd">instr</span> <span class="nf">1</span> <span class="c1">; expects MIDI controller input on channel 1</span> <span class="c1">; run and move your midi controller to see result</span> i<span class="n">max</span> <span class="o">=</span> <span class="mi">1</span> i<span class="n">min</span> <span class="o">=</span> <span class="mi">0</span> i<span class="n">chan</span> <span class="o">=</span> <span class="mi">1</span> i<span class="n">ctlno</span> <span class="o">=</span> <span class="mi">7</span> <span class="nb">initc14</span> <span class="mi">1</span><span class="p">,</span> i<span class="n">ctlno</span><span class="p">,</span> i<span class="n">ctlno</span><span class="o">+</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span> <span class="c1">; start at max. volume</span> k<span class="n">amp</span> <span class="nb">ctrl14</span> i<span class="n">chan</span><span class="p">,</span> i<span class="n">ctlno</span><span class="p">,</span> i<span class="n">ctlno</span><span class="o">+</span><span class="mi">1</span><span class="p">,</span> i<span class="n">min</span><span class="p">,</span> i<span class="n">max</span> <span class="c1">; controller 7</span> <span class="nb">printk2</span> k<span class="n">amp</span> a<span class="n">sig</span> <span class="nb">oscil</span> k<span class="n">amp</span><span class="p">,</span> <span class="mi">220</span><span class="p">,</span> <span class="mi">1</span> <span class="nb">outs</span> a<span class="n">sig</span><span class="p">,</span> a<span class="n">sig</span> <span class="kd">endin</span> <span class="nt"></CsInstruments></span> <span class="nt"><CsScore></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">1</span> <span class="nb">i</span><span class="mi">1</span> <span class="mi">0</span> <span class="mi">20</span> <span class="nb">e</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="idm281472943650744"></a> <h2>See Also</h2> <p> <a class="link" href="ctrl7.html" title="ctrl7"><em class="citetitle">ctrl7</em></a>, <a class="link" href="ctrl21.html" title="ctrl21"><em class="citetitle">ctrl21</em></a>, <a class="link" href="initc7.html" title="initc7"><em class="citetitle">initc7</em></a>, <a class="link" href="initc14.html" title="initc14"><em class="citetitle">initc14</em></a>, <a class="link" href="initc21.html" title="initc21"><em class="citetitle">initc21</em></a>, <a class="link" href="midic7.html" title="midic7"><em class="citetitle">midic7</em></a>, <a class="link" href="midic14.html" title="midic14"><em class="citetitle">midic14</em></a>, <a class="link" href="midic21.html" title="midic21"><em class="citetitle">midic21</em></a> </p> </div> <div class="refsect1"> <a id="idm281472943641976"></a> <h2>Credits</h2> <p> </p> <table border="0" summary="Simple list" class="simplelist"> <tr> <td>Author: Gabriel Maldonado</td> </tr> <tr> <td>Italy</td> </tr> </table> <p> </p> <p>New in Csound version 3.47</p> <p>Thanks goes to Rasmus Ekman for pointing out the correct MIDI channel and controller number ranges.</p> </div> </div> <div class="navfooter"> <hr /> <table width="100%" summary="Navigation footer"> <tr> <td width="40%" align="left"><a accesskey="p" href="crunch.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="ctrl21.html">Next</a></td> </tr> <tr> <td width="40%" align="left" valign="top">crunch </td> <td width="20%" align="center"> <a accesskey="h" href="index.html">Home</a> </td> <td width="40%" align="right" valign="top"> ctrl21</td> </tr> </table> </div> </body> </html>