Real-time MIDI Support Csound supports realtime MIDI input and output, as well as input from MIDI files. Realtime MIDI input is activated using the -M (or --midi-device=DEVICE) command line flag. You must specify the device number or name after the -M. For example to use device number 2, you would use something like: csound -M2 myrtmidi.csd You can find out the available devices by using an out of range device: csound -M99 myrtmidi.csd This will only work if the MIDI module can be accessed by device number. For alsa, you must first find the device name using: cat /proc/asound/cards You must then use something like: csound -+rtmidi=alsa -M hw:3 myrtmidi.csd Realtime MIDI output is activated using -Q, using device number or names as shown above. You can also load a MIDI file using the -F or --midifile=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. Once realtime MIDI input and/or output has been activated, opcodes like MIDI Input and MIDI Output will have effect. When MIDI input is enabled (with -M or -F), each incoming noteon 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.) If you have 1 instrument only, Csound works in omni mode, ie. it responds to all channels into that single instrument. 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 massign and pgmassign to change this behavior). 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. See the MIDI/Score Interoperability opcodes for information on designing instruments which can be used from the score or driven by MIDI. There are several realtime MIDI modules available, you must use the -+rtmidi flag (See -+rtmidi), 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. Currently the midi modules available are: alsa - To use the ALSA midi system (Linux only) jack - To use the Jack midi system winmme - To use the windows MME system (Windows only) portmidi - To use the portmidi system (all platforms). This is the default setting. virtual - To use a virtual graphical keyboard (See below) as MIDI input (all platforms) When csound runs, it will process the score and then quit. If there are no events in the score, Csound will exit immediately. If you want to use only MIDI events instead of score events, you need to tell Csound to run for a certain amount of time. This can be done with a dummy f-statement like "f 0 3600". &midivirtual; &midiinput; &midioutput; &midigeneric; &midiconvert; &midiextender; &midionoff; &midiinterop; &midirealtime; &midisliderbk;