Csound supports realtime MIDI input and output, as well as input from MIDI files. For realtime input (and output) the correct Command line flags and devices must be chosen. MIDI input is activated with the flag -M (or --midi-device=DEVICE) followed by the device number. On some systems, using an out of range number like 999 will print available devices. MIDI output is activated using the -Q flag. You can load a MIDI file from the command line using the flag -F or --midifile=FILE
When MIDI input is enabled (with -M or -F), each incoming noteon message will generate a note for an instrument which has by default the same number as the channel of the event (see massign and pgmassign). This means that MIDI controlled instruments are polyphonic by default.
See the MIDI/Score Interoperability opcodes for information on designing instruments which can be used from the score or driven by MIDI.
The following opcodes can recieve MIDI information:
MIDI information for any instruments: aftouch, chanctrl and polyaft, pchbend.
MIDI information for MIDI-triggered instruments: veloc , midictrl and notnum. See also Converters.
MIDI Controller input for any instrument: midic7, midic14 and midic21.
MIDI Controller input for MIDI-triggered instruments: ctrl7, ctrl14 and ctrl21.
MIDI controller value initialization: initc7, initc14, initc21 and ctrlinit.
massign can be used to specify the csound instrument to be triggered by a particular MIDI channel. pgmassign can be use to assign a csound instrument to a specific MIDI program.