From MorphOS Library

Author: Antoine Dubourg - Proof-reading: Neil Pearson

MorphOS is able to make use of the MIDI protocol with various system components.

To make best use of MIDI, it is advised to have some MIDI instruments be it physical devices or soft synthesis.

Low level components

All the MIDI intricacies are handled by two system components:

  • camd.library, which handles message parsing and delivery to applications
  • camdusbmidi.class, which bridges MIDI messages from USB compliant MIDI devices to camd.library

camd.library is located in SYS:MorphOS/Libs/ while camdusbmidi.class is located in SYS:MorphOS/Classes/USB/.

CAMD concepts

CAMD library was designed in the 90s using the concept of delivery by copying of MIDI messages.

When an application wants to use MIDI, it creates a MidiNode, which is a type of area for storing messages.

Once MidiNode is created by the application, this node is then linked to its destination name, the MIDI cluster.

MidiLink can be only a single type: sending or receiving. So, an application will send MIDI messages while some will receive MIDI messages. Some might do both.

All the mechanics of CAMD is based around MIDI clusters: they provide a user friendly way to promote MIDI flux. Usually, clusters are presented to a user to configure access to MIDI instruments.

Instrument(s) and application(s) can be started in any order. The cluster name is a collection point created by the first one joining the cluster.

Understanding the MIDI cluster naming scheme

When a MIDI instrument is connected to CAMD, it 'registers' itself to a MIDI cluster using a specific naming scheme.

Usually, an instrument will create a two way communication link, one for sending MIDI messages and another one for receiving MIDI messages.

The cluster name ending with '.out' is used to send MIDI messages to the instrument.

The cluster name ending with .'in' is used to receive MIDI messages from the instrument.

Those '.in' and '.out' are usually prefixed with a name. For example, you have a MIDI instrument of whatever brand, which will usually be shown similar to 'Brand-DeviceName.in' and 'Brand-DeviceName.out'.

Installing & testing MIDI gear

Initial, first time, setup of MIDI gear can be quite intimidating. It has to be correctly wired if connected using legacy DIN connectors (inverting in and out isn't dangerous at all, it will just not work) and figuring out how to use an application often requires some getting used to.

MorphOS features two handy applications that can help with testing and boot-strapping MIDI gear:

  • MIDI Piano, is a simple virtual MIDI keyboard for sending or receiving MIDI messages
  • MIDI Logger, a tool for looking at MIDI messages

Both tools are located in SYS:Utilities/MIDI/.

Using Virtual MIDI Keyboard

Run it by double-clicking the MIDI Piano icon. You'll get a window with a large piano keyboard. VMK (Virtual MIDI Keyboard) is able to receive or send MIDI messages.

  1. Select the mode of operation with the first cycle, 'Receive' for ... receiving MIDI messages, 'Send' for ... you guessed it, sending MIDI messages.
  2. Select the cluster to connect to. If you're sending, be sure to select a cluster with a name ending in '.out'. Inversly, select an '.in' cluster for receiving.
  3. Select to which MIDI channels you want to send/receive MIDI messages. VMK will happily send/receive from multiple MIDI channels at once.
  4. a) If you are in receive mode, the piano keyboard won't react to mouse events but will colour the keys as/when receiving note events from the cluster.
    b) If in send mode, the piano keyboard will react to mouse event(s): clicking on the piano keys will emit MIDI messages to the selected cluster.

Tip: The MIDI instrument keeps emitting an annoying sound? If so, then send an 'All Notes Off' message with 'Send a MIDI message' using that menu option.

Using MIDI Logger

MIDI Logger is an analysis tool for watching incoming MIDI messages. It is most helpful for debugging an application, or to simply check MIDI messages.

This application is only able to receive MIDI messages.

  1. Select the cluster you'd like to receive from
  2. Select channels you'd like to view
  3. Select the kind of MIDI message you'd like to view

Any message meeting your filter criteria will be displayed in the list.

Playing a MIDI file

MorphOS features a MIDI playback tool wisely named PlayMIDI. This is a Shell only tool that features the minimum for playback '.smf' MIDI files.

It takes a FILE argument that should point to a valid '.smf' MIDI file and a CLUSTERNAME argument that should point to an '.out' cluster name.

For example:

PlayMIDI FILE=song.smf CLUSTERNAME=myinstrument.out

The song will be sent to the 'myinstrument.out' cluster.

Soft Synthesis

MorphOS does not feature any soft synthesis application for MIDI. You'll have to rely on an external application for that. One tool is available for doing soft synthesis: FrozenLiquid (available at the developer's page or MorphOS Storage).

FrozenLiquid needs a sound font for producing sound. Sound fonts are easy to find with any search engine.

Soft synthesis is producing sound with the help of the CPU. It can consume a large amount of CPU capability depending on the number of MIDI events required to process, and the complexity of the sound font.

Starting FrozenLiquid is just a single step:

FrozenLiquid FILE=soundfontname.sf2

By default, FrozenLiquid will create a MIDI cluster based on the filename of the sound font.

With PlayMIDI and FrozenLiquid, you can experience MIDI without owning any actual hardware based MIDI instrument.