Sophie

Sophie

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

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>midinoteoff</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="midiin.html" title="midiin" />
    <link rel="next" href="midinoteoncps.html" title="midinoteoncps" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">midinoteoff</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="midiin.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="midinoteoncps.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry" title="midinoteoff">
      <a id="midinoteoff"></a>
      <div class="titlepage"></div>
      <a id="IndexMidinoteoff" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">midinoteoff</span>
        </h2>
        <p>midinoteoff — 
      Gets a MIDI noteoff value.
          </p>
      </div>
      <div class="refsect1" title="Description">
        <a id="idp31061632"></a>
        <h2>Description</h2>
        <p>
      <span class="emphasis"><em>midinoteoff</em></span> is designed to simplify writing instruments that can be used interchangeably for either score or MIDI input, and to make it easier to adapt instruments originally written for score input to work with MIDI input.
    </p>
        <p>
      In general, it should be possible to write instrument definitions that work identically with both scores
and MIDI, including both MIDI files and real-time MIDI input, without using any conditional statements, and that take full advantage of MIDI voice messages.
    </p>
        <p>
      Note that correlating Csound instruments with MIDI channel numbers is done using the <a class="link" href="massign.html" title="massign"><em class="citetitle">massign</em></a> opcode for real-time performance,.  For file-driven performance, instrument numbers default to MIDI channel number + 1, but the defaults are overridden by any MIDI program change messages in the file.
    </p>
      </div>
      <div class="refsect1" title="Syntax">
        <a id="idp31074200"></a>
        <h2>Syntax</h2>
        <pre class="synopsis"><span class="command"><strong>midinoteoff</strong></span> xkey, xvelocity</pre>
      </div>
      <div class="refsect1" title="Performance">
        <a id="idp31075256"></a>
        <h2>Performance</h2>
        <p>
      <span class="emphasis"><em>xkey</em></span> -- returns MIDI key during MIDI activation, remains unchanged otherwise.
    </p>
        <p>
      <span class="emphasis"><em>xvelocity</em></span> -- returns MIDI velocity during MIDI activation, remains unchanged otherwise.
    </p>
        <p>
      If the instrument was activated by MIDI input, the opcode overwrites the values of the <span class="emphasis"><em>xkey</em></span> and <span class="emphasis"><em>xvelocity</em></span> with the corresponding values from MIDI input. If the instrument was <span class="emphasis"><em>NOT</em></span> activated by MIDI input, the values of <span class="emphasis"><em>xkey</em></span> and <span class="emphasis"><em>xvelocity</em></span> remain unchanged.
    </p>
        <p>
      This enables score p-fields to receive MIDI input data during MIDI activation, and score values otherwise.
    </p>
        <div class="note" title="Adapting a score-activated Csound instrument." style="margin-left: 0.5in; margin-right: 0.5in;">
          <table border="0" summary="Note: Adapting a score-activated Csound instrument.">
            <tr>
              <td rowspan="2" align="center" valign="top" width="25">
                <img alt="[Note]" src="images/note.png" />
              </td>
              <th align="left">Adapting a score-activated Csound instrument.</th>
            </tr>
            <tr>
              <td align="left" valign="top">
                <p>See the <a class="link" href="MidiInterop.html" title="MIDI/Score Interoperability opcodes"><em class="citetitle">MIDI interop opcodes</em></a> section for details on adapting score driven instruments for MIDI or vice-versa.</p>
              </td>
            </tr>
          </table>
        </div>
      </div>
      <div class="refsect1" title="Examples">
        <a id="idp31116376"></a>
        <h2>Examples</h2>
        <p>
      Here is an example of the midinoteoff opcode. It uses the file <a class="ulink" href="examples/midinoteoff.csd" target="_top"><em class="citetitle">midinoteoff.csd</em></a>.
      </p>
        <div class="example">
          <a id="idp31117376"></a>
          <p class="title">
            <strong>Example 461. Example of the midinoteoff 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    -M1 -Q1  <span class="comment">;;;realtime audio out and midi in and midi out</span>
<span class="comment">;-iadc    ;;;uncomment -iadc if realtime audio input is needed too</span>
<span class="comment">; For Non-realtime ouput leave only the line below:</span>
<span class="comment">; -o midinoteoff.wav -W ;;; for file output any platform</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">;uses external midi device</span>

kkey <span class="opc">init</span> 0				<span class="comment">;initialize key number</span>
kvel <span class="opc">init</span> 0				<span class="comment">;initialize velocity</span>
<span class="opc">midinoteoff</span> kkey,kvel			<span class="comment">;MIDI noteoff value</span>
<span class="opc">printk2</span>	kvel				<span class="comment">;display noteoff value</span>
<span class="opc">midion</span> 1, kkey, kvel			<span class="comment">;sent note to external device</span>

<span class="oblock">endin</span>
<span class="csdtag">&lt;/CsInstruments&gt;</span>
<span class="csdtag">&lt;CsScore&gt;</span>
<span class="stamnt">f</span> 0 30	<span class="comment">;runs for 30 seconds	</span>

<span class="stamnt">i</span> 1 0 2 62	<span class="comment">; play these notes from score as well</span>
<span class="stamnt">i</span> 1 + 2 65
<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" />
      Its output should include lines like:
      </p>
        <pre class="screen">
 i1    60.00000
 i1    76.00000
      </pre>
        <p>
    </p>
      </div>
      <div class="refsect1" title="See Also">
        <a id="idp31120112"></a>
        <h2>See Also</h2>
        <p>
      <a class="link" href="midichannelaftertouch.html" title="midichannelaftertouch"><em class="citetitle">midichannelaftertouch</em></a>, 
      <a class="link" href="midicontrolchange.html" title="midicontrolchange"><em class="citetitle">midicontrolchange</em></a>, 
      <a class="link" href="mididefault.html" title="mididefault"><em class="citetitle">mididefault</em></a>, 
      <a class="link" href="midinoteoncps.html" title="midinoteoncps"><em class="citetitle">midinoteoncps</em></a>, 
      <a class="link" href="midinoteonkey.html" title="midinoteonkey"><em class="citetitle">midinoteonkey</em></a>, 
      <a class="link" href="midinoteonoct.html" title="midinoteonoct"><em class="citetitle">midinoteonoct</em></a>, 
      <a class="link" href="midinoteonpch.html" title="midinoteonpch"><em class="citetitle">midinoteonpch</em></a>, 
      <a class="link" href="midipitchbend.html" title="midipitchbend"><em class="citetitle">midipitchbend</em></a>, 
      <a class="link" href="midipolyaftertouch.html" title="midipolyaftertouch"><em class="citetitle">midipolyaftertouch</em></a>, 
      <a class="link" href="midiprogramchange.html" title="midiprogramchange"><em class="citetitle">midiprogramchange</em></a>
    </p>
      </div>
      <div class="refsect1" title="Credits">
        <a id="idp31125816"></a>
        <h2>Credits</h2>
        <p>Author: Michael Gogins</p>
        <p>New in version 4.20</p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="midiin.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="midinoteoncps.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">midiin </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> midinoteoncps</td>
        </tr>
      </table>
    </div>
  </body>
</html>