MIDI [Syntax]

Common Music supports reading and writing MIDI data to and from drivers or files. MIDI support is organized in three layers. The highest layer provides object class definitions like midi-note, midi-channel-message and midi-message, and commands like import, open, play and receive. Objects and functions at the highest level automatically transform compositional data to and from a lower level representation called MIDI messages. Functions and data structures at this mid-level support reading and writing MIDI messages either in real-time to and from MIDI clients or to and from a MIDI file.

MIDI File Support

All ports of Common Music support reading and writing midi level 0 files. MIDI level 1 files may be read and imported one track at a time. See midi-file [Class].

MIDI Real-Time Support

Common Music's MIDI real-time architecture is based on Mi_D, a platform- and driver-independent shared MIDI library written by (Tobias Kunze). Through the Mi_D environment, Common Music supports a virtually unlimited number of logical channels, (logical) routes and (interface) connections.

Mi_D Environment

MIDI runtime communication between Mi_D and the outside world uses a number of input/output stream pairs, so-called connections. Each stream may be thought of as a software MIDI cable and as such accomodates up to 16 channels of standard MIDI data. Streams are typically connected ("associated") with interfaces, that is, software MIDI clients, serial ports or similar devices, although they are not required to do so: data sent via an output connection that is not associated with an interface will be simply lost.

"Logical" MIDI messages are translated to and from standard MIDI messages via two lookup tables: a "Channel Map" translates logical channel information of MIDI channel messages to and from (logical) routes and (real MIDI) channels and a "Route Map" translates between (logical) route information of both, channel and system messages, and (real) connections. As mentioned above, a connection may or may not be actually associated with an interface, just as a real MIDI cable may or may not be actually plugged into a MIDI device.

Note too, that, while both, the channel map and route maps support many-to-many mappings, associations between connections and interfaces do not. Each connection represents exactly one input and one output "cable pair", which may or may not be connected to a "device" (an interface).

See Also:

midi-file, midi-file, midi-port, midi-message, midi-note, MIDI Messages, Working with Algorithms in Real-Time, Mi_D

Last Modified: 5-Mar-1998