Sophie

Sophie

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

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>fluidProgramSelect</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="fluidOut.html" title="fluidOut" />
    <link rel="next" href="fluidSetInterpMethod.html" title="fluidSetInterpMethod" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">fluidProgramSelect</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="fluidOut.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="fluidSetInterpMethod.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry" title="fluidProgramSelect">
      <a id="fluidProgramSelect"></a>
      <div class="titlepage"></div>
      <a id="IndexFluidProgramSelect" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">fluidProgramSelect</span>
        </h2>
        <p>fluidProgramSelect — 
      Assigns a preset from a SoundFont to a channel on a fluidEngine.
           </p>
      </div>
      <div class="refsect1" title="Syntax">
        <a id="idp23218528"></a>
        <h2>Syntax</h2>
        <pre class="synopsis"><span class="command"><strong>fluidProgramSelect</strong></span> ienginenum, ichannelnum, isfnum, ibanknum, ipresetnum</pre>
      </div>
      <div class="refsect1" title="Description">
        <a id="idp23229136"></a>
        <h2>Description</h2>
        <p>Assigns a preset from a SoundFont to a channel on a fluidEngine.
    </p>
      </div>
      <div class="refsect1" title="Initialization">
        <a id="idp23229936"></a>
        <h2>Initialization</h2>
        <p><span class="emphasis"><em>ienginenum</em></span> -- engine number assigned from fluidEngine</p>
        <p><span class="emphasis"><em>ichannelnum</em></span> -- which channel number to use for the preset in the given fluidEngine</p>
        <p><span class="emphasis"><em>isfnum</em></span> -- number of the SoundFont from which the preset is assigned</p>
        <p><span class="emphasis"><em>ibanknum</em></span> -- number of the bank in the SoundFont from which the preset is assigned</p>
        <p><span class="emphasis"><em>ipresetnum</em></span> -- number of the preset to assign</p>
      </div>
      <div class="refsect1" title="Examples">
        <a id="idp23232328"></a>
        <h2>Examples</h2>
        <p>
      Here is an example of the fluidProgramSelect opcode. It uses the file <a class="ulink" href="examples/fluidProgramSelect.csd" target="_top"><em class="citetitle">fluidProgramSelect.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>
-odac   -+rtmidi=virtual  -M0    <span class="comment">;;;realtime audio out and realtime midi 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 fluidProgramSelect.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

giengine <span class="opc">fluidEngine</span>
<span class="comment">; soundfont path to manual/examples</span>
isfnum	 <span class="opc">fluidLoad</span> "19Trumpet.sf2", giengine, 1
	 <span class="opc">fluidProgramSelect</span> giengine, 1, isfnum, 0, 56

<span class="oblock">instr</span> 1

	<span class="opc">mididefault</span>   60, p3
	<span class="opc">midinoteonkey</span> p4, p5
ikey	<span class="opc">init</span> p4
ivel	<span class="opc">init</span> p5
	<span class="opc">fluidNote</span> giengine, 1, ikey, ivel

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

<span class="oblock">instr</span> 99

imvol  <span class="opc">init</span> 7
asigl, asigr <span class="opc">fluidOut</span> giengine
       <span class="opc">outs</span> asigl<span class="op">*</span>imvol, asigr<span class="op">*</span>imvol

<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 2 60 100 <span class="comment">;play one note from score and...</span>
<span class="stamnt">i</span> 99 0 60      <span class="comment">;play virtual keyboard for 60 sec.</span>
<span class="stamnt">e</span>

<span class="csdtag">&lt;/CsScore&gt;</span>
<span class="csdtag">&lt;/CsoundSynthesizer&gt;</span>
</pre>
        <p>
      Here is another 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="idp23266696"></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="idp23269888"></a>
        <h2>Credits</h2>
        <p>Michael Gogins (gogins at pipeline dot com), Steven Yi. 
    Thanks to Peter Hanappe for Fluidsynth.</p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="fluidOut.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="fluidSetInterpMethod.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">fluidOut </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> fluidSetInterpMethod</td>
        </tr>
      </table>
    </div>
  </body>
</html>