Sophie

Sophie

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

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>fluidControl</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="fluidCCk.html" title="fluidCCk" />
    <link rel="next" href="fluidEngine.html" title="fluidEngine" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">fluidControl</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="fluidCCk.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="fluidEngine.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry" title="fluidControl">
      <a id="fluidControl"></a>
      <div class="titlepage"></div>
      <a id="IndexFluidControl" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">fluidControl</span>
        </h2>
        <p>fluidControl — 
      Sends MIDI note on, note off, and other messages to a SoundFont preset.
           </p>
      </div>
      <div class="refsect1" title="Syntax">
        <a id="idp23078504"></a>
        <h2>Syntax</h2>
        <pre class="synopsis"><span class="command"><strong>fluidControl</strong></span> ienginenum, kstatus, kchannel, kdata1, kdata2</pre>
      </div>
      <div class="refsect1" title="Description">
        <a id="idp23107264"></a>
        <h2>Description</h2>
        <p>The fluid opcodes provide a simple
    Csound opcode wrapper around Peter Hanappe's Fluidsynth SoundFont2
    synthesizer. This implementation accepts any MIDI note on, note
    off, controller, pitch bend, or program change message at
    k-rate. Maximum polyphony is 4096 simultaneously sounding
    voices. Any number of SoundFonts may be loaded and played
    simultaneously.
    </p>
      </div>
      <div class="refsect1" title="Initialization">
        <a id="idp23108456"></a>
        <h2>Initialization</h2>
        <p><span class="emphasis"><em>ienginenum </em></span> -- engine number assigned from
fluidEngine</p>
      </div>
      <div class="refsect1" title="Performance">
        <a id="idp23109352"></a>
        <h2>Performance</h2>
        <p><span class="emphasis"><em>kstatus </em></span> -- MIDI channel message status byte: 128 for
note off, 144 for note on, 176 for control change, 192 for program change, or
224 for pitch bend. </p>
        <p><span class="emphasis"><em>kchannel </em></span> -- MIDI channel number to which the
Fluidsynth program is assigned: from 0 to 255. MIDI channels numbered 16 or
higher are virtual channels.</p>
        <p><span class="emphasis"><em>kdata1 </em></span> -- For note on, MIDI key number: from 0
(lowest) to 127 (highest), where 60 is middle C. For continuous controller
messages, controller number.</p>
        <p><span class="emphasis"><em>kdata2 </em></span> -- For note on, MIDI key velocity: from 0 (no
sound) to 127 (loudest). For continous controller messages, controller
value.</p>
        <p>Invoke fluidControl in instrument definitions that actually play
notes and send control messages. Each instrument definition must
consistently use one MIDI channel that was assigned to a Fluidsynth
program using fluidLoad.</p>
        <p>In this implementation, SoundFont effects such as chorus or
reverb are used if and only if they are defaults for the preset. There
is no means of turning such effects on or off, or of changing their
parameters, from Csound.</p>
      </div>
      <div class="refsect1" title="Examples">
        <a id="idp23113384"></a>
        <h2>Examples</h2>
        <p>
      Here is a more complex example of the fluidsynth opcodes written by Istvan Varga. It uses the file <a class="ulink" href="examples/fluidcomplex.csd" target="_top"><em class="citetitle">fluidcomplex.csd</em></a>.
    </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>
<span class="comment">;Load external midi file from manual/examples</span>
-odac -T -F  Anna.mid<span class="comment">;;;realtime audio I/O and midifile in</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 fluidcomplex.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="comment">; Example by Istvan Varga</span>

<span class="comment">; disable triggering of instruments by MIDI events</span>

ichn <span class="op">=</span> 1
<span class="olabel">lp1</span><span class="op">:</span>
        <span class="ohdr">massign</span>   ichn, 0
        <span class="octrl">loop_le</span>   ichn, 1, 16, <span class="olabel">lp1</span>
        <span class="ohdr">pgmassign</span> 0, 0

<span class="comment">; initialize FluidSynth</span>

gifld   <span class="opc">fluidEngine</span>
gisf2   <span class="opc">fluidLoad</span> "sf_GMbank.sf2", gifld, 1

<span class="comment">; k-rate version of fluidProgramSelect</span>

<span class="oblock">opcode</span> fluidProgramSelect_k, 0, kkkkk
  keng, kchn, ksf2, kbnk, kpre <span class="opc">xin</span>
        <span class="octrl">igoto</span>     skipInit
  doInit<span class="op">:</span>
        <span class="opc">fluidProgramSelect</span> <span class="opc">i</span>(keng), <span class="opc">i</span>(kchn), <span class="opc">i</span>(ksf2), <span class="opc">i</span>(kbnk), <span class="opc">i</span>(kpre)
        <span class="opc">reinit</span>    doInit
        <span class="opc">rireturn</span>
  skipInit<span class="op">:</span>
<span class="oblock">endop</span>

<span class="oblock">instr</span> 1
  <span class="comment">; initialize channels</span>
  kchn  <span class="opc">init</span> 1
  <span class="octrl">if</span> (kchn <span class="op">==</span> 1) then
<span class="olabel">lp2</span><span class="op">:</span>
        <span class="opc">fluidControl</span> gifld, 192, kchn <span class="op">-</span> 1, 0, 0
        <span class="opc">fluidControl</span> gifld, 176, kchn <span class="op">-</span> 1, 7, 100
        <span class="opc">fluidControl</span> gifld, 176, kchn <span class="op">-</span> 1, 10, 64
        <span class="octrl">loop_le</span>   kchn, 1, 16, <span class="olabel">lp2</span>
  <span class="octrl">endif</span>

  <span class="comment">; send any MIDI events received to FluidSynth</span>
<span class="olabel">nxt</span><span class="op">:</span>
  kst, kch, kd1, kd2 <span class="opc">midiin</span>
  <span class="octrl">if</span> (kst <span class="op">!=</span> 0) then
    <span class="octrl">if</span> (kst <span class="op">!=</span> 192) then
        <span class="opc">fluidControl</span> gifld, kst, kch <span class="op">-</span> 1, kd1, kd2
    <span class="octrl">else</span>
        fluidProgramSelect_k gifld, kch <span class="op">-</span> 1, gisf2, 0, kd1
    <span class="octrl">endif</span>
      <span class="octrl">kgoto</span> <span class="olabel">nxt</span>
  <span class="octrl">endif</span>

<span class="comment">; get audio output from FluidSynth</span>
  ivol   <span class="opc">init</span> 3 <span class="comment">;a bit louder</span>
  aL, aR <span class="opc">fluidOut</span> gifld
         <span class="opc">outs</span>     aL<span class="op">*</span>ivol, aR<span class="op">*</span>ivol
<span class="oblock">endin</span>

<span class="csdtag">&lt;/CsInstruments&gt;</span>
<span class="csdtag">&lt;CsScore&gt;</span>

<span class="stamnt">i</span> 1 0 3600
<span class="stamnt">e</span>

<span class="csdtag">&lt;/CsScore&gt;</span>
<span class="csdtag">&lt;/CsoundSynthesizer&gt;</span>
</pre>
      </div>
      <div class="refsect1" title="See Also">
        <a id="idp23115008"></a>
        <h2>See Also</h2>
        <p><a class="link" href="fluidEngine.html" title="fluidEngine"><em class="citetitle">fluidEngine</em></a>, <a class="link" href="fluidNote.html" title="fluidNote"><em class="citetitle">fluidNote</em></a>, <a class="link" href="fluidLoad.html" title="fluidLoad"><em class="citetitle">fluidLoad</em></a></p>
        <p> More information on soundfonts in the Floss Manuals: <a class="ulink" href="http://en.flossmanuals.net/csound/ch048_d-reading-midi-files" target="_top"><em class="citetitle">http://en.flossmanuals.net/csound/ch048_d-reading-midi-files</em></a></p>
        <p> Other information on soundfonts on Wikipedia: <a class="ulink" href="http://en.wikipedia.org/wiki/Soundfont" target="_top"><em class="citetitle">http://en.wikipedia.org/wiki/Soundfont</em></a></p>
      </div>
      <div class="refsect1" title="Credits">
        <a id="idp23118240"></a>
        <h2>Credits</h2>
        <p>Opcodes by Michael Gogins (gogins at pipeline dot
  com). Thanks to Peter Hanappe for Fluidsynth, and to Steven Yi for
  seeing that it is necessary to break up the Fluidsynth into several
  different Csound opcodes.</p>
        <p>New in Csound5.00</p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="fluidCCk.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="fluidEngine.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">fluidCCk </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> fluidEngine</td>
        </tr>
      </table>
    </div>
  </body>
</html>