| 1 |
|
| 2 |
<chapter id="MidiTop"> |
| 3 |
<title>Real-time MIDI Support</title> |
| 4 |
<para> |
| 5 |
Csound supports realtime MIDI input and output, as well as input from MIDI files. Realtime MIDI input is activated using the <link linkend="FlagsCatMinusUpperM"><citetitle>-M</citetitle></link> (or <emphasis>--midi-device</emphasis>=DEVICE) command line flag. You must specify the device number or name after the <emphasis>-M</emphasis>. For example to use device number 2, you would use something like: |
| 6 |
</para> |
| 7 |
<literallayout>csound -M2 myrtmidi.csd</literallayout> |
| 8 |
<para> |
| 9 |
You can find out the available alsa devices by using: |
| 10 |
</para> |
| 11 |
<literallayout>cat /proc/asound/cards</literallayout> |
| 12 |
<para> |
| 13 |
You must then use something like: |
| 14 |
</para> |
| 15 |
<literallayout>csound -+rtmidi=alsa -M hw:3 myrtmidi.csd</literallayout> |
| 16 |
<para> |
| 17 |
Realtime MIDI output is activated using <link linkend="FlagsCatMinusUpperQ"><citetitle>-Q</citetitle></link>, using device number or names as shown above. |
| 18 |
</para> |
| 19 |
<para> |
| 20 |
You can also load a MIDI file using the <link linkend="FlagsCatMinusUpperF"><citetitle>-F</citetitle></link> or <emphasis>--midifile</emphasis>=FILE command line flag. The MIDI file is read in realtime, and behaves as if it was being performed or received in realtime. So the csound program is not aware if MIDI input comes from a MIDI file or directly from a MIDI interface. |
| 21 |
</para> |
| 22 |
<para> |
| 23 |
Once realtime MIDI input and/or output has been activated, opcodes like <link linkend="MidiInput"><citetitle>MIDI Input</citetitle></link> and <link linkend="MidiOutput"><citetitle>MIDI Output</citetitle></link> will have effect. |
| 24 |
</para> <para> |
| 25 |
When MIDI input is enabled (with -M or -F), each incoming <emphasis>noteon</emphasis> message will generate a note event for an instrument which has the same number as the channel of the event (see <link linkend="massign"><citetitle>massign</citetitle></link> and <link linkend="pgmassign"><citetitle>pgmassign</citetitle></link> to change this behavior). This means that MIDI controlled instruments are polyphonic by default, since each note will generate a new instance of the instrument. |
| 26 |
</para> |
| 27 |
<para> |
| 28 |
See the <link linkend="MidiInterop"><citetitle>MIDI/Score Interoperability</citetitle></link> opcodes for information on designing instruments which can be used from the score or driven by MIDI. |
| 29 |
</para> |
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
&midiinput; |
| 46 |
&midioutput; |
| 47 |
&midigeneric; |
| 48 |
&midiconvert; |
| 49 |
&midiextender; |
| 50 |
&midionoff; |
| 51 |
&midiinterop; |
| 52 |
&midirealtime; |
| 53 |
&midisliderbk; |
| 54 |
|
| 55 |
</chapter> |