Debian Codegraph @

midi/top.xml

raw symbols SCIP
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
6 from MIDI files. Realtime MIDI input is activated using the <link
7 linkend="FlagsCatMinusUpperM"><citetitle>-M</citetitle></link> (or
8 <emphasis>--midi-device</emphasis>=DEVICE) command line flag. For
9 single port input, you
10 must specify the device number or name after the
11 <emphasis>-M</emphasis>. For multiport input (currently
12 implemented only in the PortMIDI module), use 'a' or 'm'.
13 For example to use device number 2, you would use something like:
14 </para>
15 <literallayout>csound -M2 myrtmidi.csd</literallayout>
16 <para>
17 You can find out the available devices by running Csound with
18 --midi-devices option:
19 </para>
20 <literallayout>csound --midi-devices</literallayout>
21
22 <para>
23 Starting from version 6.14, the PortMIDI module (see below for a list
24 of all modules) allows multiple ports to be mapped to higher-order
25 channels. By using the 'm' device name, Csound will take inputs from
26 any existing MIDI device in the system and map it according to
27 (N+1)*channel, where N is the device number as listed by PortMIDI and
28 channel is the original device input channel. Alternatively, the 'a'
29 device name listens to all inputs but does not map to higher-order
30 channels.
31 </para>
32
33 <para>
34 Realtime MIDI output is activated using <link linkend="FlagsCatMinusUpperQ"><citetitle>-Q</citetitle></link>, using device number or names as shown above.
35 </para>
36 <para>
37 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.
38 </para>
39 <para>
40 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.
41 </para> <para>
42 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 (This means that MIDI controlled instruments are polyphonic by default, since each note will generate a new instance of the instrument.)
43 If you have 1 instrument only, Csound works in omni mode, ie. it responds to all channels into that single instrument.
44 If you have more than one instrument and instrs 1 - 16 , then by default instr 1 -> chn 1, instr 2 -> chn 2, unless you alter the mapping (see <link linkend="massign"><citetitle>massign</citetitle></link> and <link linkend="pgmassign"><citetitle>pgmassign</citetitle></link> to change this behavior).
45 For a single port input, if you have more than one instrument, but instr N in between 1 - 16 is missing, then chn N will be routed by default to the lowest order instrument.
46 </para>
47 <para>
48 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.
49 </para>
50 <para>
51 There are several realtime MIDI modules available, you must use the <emphasis>-+rtmidi</emphasis> flag (See <link linkend="FlagsCatMinusPlusRtmidi"><citetitle>-+rtmidi</citetitle></link>), to specify the module. The default module is portmidi which provides adequate MIDI I/O on all platforms, however for improved performance and reliability some platform specific modules are also provided.
52 </para>
53 <para>
54 Currently the midi modules available are:
55 </para>
56 <itemizedlist>
57 <listitem><para><emphasis>portmidi</emphasis> - To use the
58 PortMIDI system (all platforms). This is the default setting and
59 it allows multiple-port inputs (with 'm' or 'a' device names).</para></listitem>
60 <listitem><para><emphasis>alsa</emphasis> - To use the ALSA midi system (Linux only)</para></listitem>
61 <listitem><para><emphasis>jack</emphasis> - To use the Jack midi system</para></listitem>
62 <listitem><para><emphasis>winmme</emphasis> - To use the windows MME system (Windows only)</para></listitem>
63 <listitem><para><emphasis>virtual</emphasis> - To use a virtual graphical keyboard (See below) as MIDI input (all platforms)</para></listitem>
64 </itemizedlist>
65
66 <tip>
67 <para>When csound runs, it will process the score and then
68 quit. If there are no events in the score, Csound will run
69 forever. If you want to use only MIDI events instead of score
70 events and you know how long you wish to run, you can tell Csound
71 to run that amount of time by using the dummy <link linkend="f"><citetitle>f-statement</citetitle></link> like "f 0 360".
72 </para>
73 </tip>
74
75 &midivirtual;
76 &midiinput;
77 &midioutput;
78 &midigeneric;
79 &midiconvert;
80 &midiextender;
81 &midionoff;
82 &midiinterop;
83 &midirealtime;
84 &midisliderbk;
85
86 </chapter>