Sophie

Sophie

distrib > Mageia > 5 > x86_64 > media > core-release > by-pkgid > b707d9a4ee443103660a75ccb6e51334 > files > 509

csound-doc-5.19.01-10.mga5.noarch.rpm

<?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>ctrl7</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="ctrl21.html" title="ctrl21" />
    <link rel="next" href="ctrlinit.html" title="ctrlinit" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">ctrl7</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="ctrl21.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="ctrlinit.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry" title="ctrl7">
      <a id="ctrl7"></a>
      <div class="titlepage"></div>
      <a id="IndexCtrl7" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">ctrl7</span>
        </h2>
        <p>ctrl7 — 
      Allows a floating-point 7-bit MIDI signal scaled with a minimum and a maximum range.
    </p>
      </div>
      <div class="refsect1" title="Description">
        <a id="idp17388840"></a>
        <h2>Description</h2>
        <p>
      Allows a floating-point 7-bit MIDI signal scaled with a minimum and a maximum range.
    </p>
      </div>
      <div class="refsect1" title="Syntax">
        <a id="idp17389536"></a>
        <h2>Syntax</h2>
        <pre class="synopsis">idest <span class="command"><strong>ctrl7</strong></span> ichan, ictlno, imin, imax [, ifn]</pre>
        <pre class="synopsis">kdest <span class="command"><strong>ctrl7</strong></span> ichan, ictlno, kmin, kmax [, ifn]</pre>
        <pre class="synopsis">adest <span class="command"><strong>ctrl7</strong></span> ichan, ictlno, kmin, kmax [, ifn] [, icutoff]</pre>
      </div>
      <div class="refsect1" title="Initialization">
        <a id="idp17441952"></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 (1-16)
    </p>
        <p>
      <span class="emphasis"><em>ictlno</em></span> -- MIDI 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>
        <p>
      <span class="emphasis"><em>icutoff</em></span> (optional) -- low pass filter cut-off frequency for smoothing a-rate output.
    </p>
      </div>
      <div class="refsect1" title="Performance">
        <a id="idp17446064"></a>
        <h2>Performance</h2>
        <p>
      <span class="emphasis"><em>kdest, adest</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>ctrl7</em></span> (i- and k-rate 7 bit MIDI control) allows a floating-point 7-bit MIDI signal scaled with a minimum and a maximum range. It also allows optional non-interpolated table indexing. Minimum and maximum values can be varied at k-rate.
    </p>
        <p>
      <span class="emphasis"><em>ctrl7</em></span> differs from <a class="link" href="midic7.html" title="midic7"><em class="citetitle">midic7</em></a> because it can be included in score-oriented instruments without Csound crashes. It also needs the additional parameter <span class="emphasis"><em>ichan</em></span> containing the MIDI channel of the controller.
    </p>
        <p>
      The a-rate version of <span class="emphasis"><em>ctrl7</em></span> outputs an a-rate variable, which is low-pass filtered (smoothed). It contains an optional <span class="emphasis"><em>icutoff</em></span> parameter, to set the cutoff frecuency for the low-pass filter. The default is 5.
    </p>
      </div>
      <div class="refsect1" title="Examples">
        <a id="idp17450624"></a>
        <h2>Examples</h2>
        <p>
      Here is an example of the ctrl7 opcode. It uses the file <a class="ulink" href="examples/ctrl7.csd" target="_top"><em class="citetitle">ctrl7.csd</em></a>.

      </p>
        <div class="example">
          <a id="idp17451592"></a>
          <p class="title">
            <strong>Example 147. Example of the ctrl7 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">&lt;CsoundSynthesizer&gt;</span>
<span class="csdtag">&lt;CsOptions&gt;</span>
<span class="comment">; Select audio/midi flags here according to platform</span>
-odac   -M0  <span class="comment">;;;RT audio I/O with MIDI in</span>
<span class="comment">;-iadc    ;;;uncomment -iadc if RT audio input is needed too</span>
<span class="csdtag">&lt;/CsOptions&gt;</span>
<span class="csdtag">&lt;CsInstruments&gt;</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	<span class="comment">; expects MIDI controller input on channel 1</span>
<span class="comment">; run and move your midi controller to see result</span>

imax <span class="op">=</span> 1
imin <span class="op">=</span> 0
ichan <span class="op">=</span> 1 
ictlno <span class="op">=</span> 7
 
	<span class="opc">initc7</span>	1, 7, 1			<span class="comment">; start at max. volume</span>
kamp	<span class="opc">ctrl7</span>	ichan, ictlno, imin, imax	<span class="comment">; controller 7</span>
	<span class="opc">printk2</span>	kamp
asig	<span class="opc">oscil</span>	kamp, 220, 1
	<span class="opc">outs</span>	asig, asig

<span class="oblock">endin</span>

<span class="csdtag">&lt;/CsInstruments&gt;</span>
<span class="csdtag">&lt;CsScore&gt;</span>
<span class="stamnt">f</span> 1 0 4096 10 1

<span class="stamnt">i</span>1 0 20

<span class="stamnt">e</span>
<span class="csdtag">&lt;/CsScore&gt;</span>
<span class="csdtag">&lt;/CsoundSynthesizer&gt;</span>
</pre>
          </div>
        </div>
        <p><br class="example-break" />
    </p>
      </div>
      <div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;">
        <table border="0" summary="Note">
          <tr>
            <td rowspan="2" align="center" valign="top" width="25">
              <img alt="[Note]" src="images/note.png" />
            </td>
            <th align="left">Note</th>
          </tr>
          <tr>
            <td align="left" valign="top">
    ctrl7 only outputs k values once the controller is first moved. To
    set an initial k-value, a call to initc7 is required. Ctrlinit does not work
    for this purpose.
  </td>
          </tr>
        </table>
      </div>
      <div class="refsect1" title="See Also">
        <a id="idp17454240"></a>
        <h2>See Also</h2>
        <p>
      <a class="link" href="ctrl14.html" title="ctrl14"><em class="citetitle">ctrl14</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" title="Credits">
        <a id="idp17458616"></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>
        <p>The a-rate version of <span class="emphasis"><em>ctrl7</em></span> was added in version 5.06</p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="ctrl21.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="ctrlinit.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">ctrl21 </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> ctrlinit</td>
        </tr>
      </table>
    </div>
  </body>
</html>