# Midi Configuration

Although at this time Ardour does not support MIDI sequencing, it does support a fairly rich set of interactions via MIDI with other devices. In particular:

- Ardour can function as MIDI Time Code (MTC) master or slave

- Ardour can control or be controlled by other devices using MIDI Machine Control (MMC)

- Ardour can bind all gain faders, panners, mute/solo/rec-enable buttons and all plugin parameters to be controlled by MIDI Continuous Controller (CC) or Note On/Off messages.

- Ardour can send MIDI "feedback" whenever gain, pan or plugin state changes, so that external motorized control surfaces can reflect parameter changes caused by automation etc.

## Specifying MIDI ports

Ardour does not attempt to discover what MIDI ports exist on your system. This is a complex issue, and on systems like Linux and OS X that permit virtual ports to be created at any time, it is not trivial to get right (although future versions of Ardour may try).

Instead, the MIDI ports that are available for Ardour to use are defined in your `ardour.rc` file. These port definitions are not session specific, on the assumption that your system's MIDI hardware probably doesn't change much from session to session. The default version of this file contains a single port that can be used for inter-application MIDI routing as well as MIDI I/O to whatever physical MIDI ports might be available on your computer. In many cases, you will not need to change them.

When you first use Ardour, the `ardour.rc` file that you will have contains a single port definition. It defines a port that is almost guaranteed to be usable on your system ((Linux/ALSA users may need to ensure that the `snd-seq` kernel module gets loaded - many distributions do not do this by default)). This port is a "virtual port" it isn't actually a hardware MIDI port, but instead is a software port that can be connected to other software ports or to whatever hardware MIDI ports you have (see ).

## Defining additional MIDI ports

To define additional ports, find the line in `ardour.rc` that looks roughly like this:

    <MIDI-port tag="hw:0" device="/dev/snd/midiC1D0" type="alsa/raw" mode="duplex"/>

On OSX/CoreMIDI it would look more like:

    <MIDI-port tag="coremidi" device="ardour" type="coremidi" mode="duplex"/>

You can then add another line right after it that looks similar but contains a different port definition.

You will see there are 4 pieces of information required to define a MIDI port for use within Ardour. Your port definition

### Tag

This is just a name of your own choosing. It is how the port will be referred to within Ardour. You could use a name that describes what is plugged into the port (e.g. "1600x", "Novation"), or a name that describes the computer device/system that provides the port (e.g. "HDSP", "Sequencer"), or a whimsical name of your own choice (e.g. "bowtie", "merlin").

### Type

This is an operating system specific identifier that defines what kind of port this is. It can be set to one of three values:

- `alsa/raw` - the port corresponds to a physical MIDI port that is accessed directly without involving the ALSA MIDI routing subsystem.

- `alsa/sequencer` - the port is a virtual port that can send and receive MIDI data via the ALSA MIDI routing subsystem.

- `coremidi` - the port is a virtual port that can send and receive MIDI data via the CoreMidi inter-application MIDI routing subsystem.

### Device

This is an operating specific and MIDI subsystem-specific name that actually identifies the device to be used for MIDI I/O.

- for a raw ALSA hardware port, it is the name of the device file corresponding to the hardware MIDI port. A typical value might be `/dev/snd/midiC0D0/`.

- for an ALSA sequencer port, it is an arbitrary name for the port that will appear as part of the ALSA MIDI routing system

- for a CoreMIDI port, it is an arbitrary name for the port that will appear as in any CoreMIDI port selection dialogs.

### Mode

This specifies whether the port is available for input, output or both:

- `read` - the port is available for input only

- `write` - the port is available for output only

- `duplex` - the port is available for input and output

You should probably always use `duplex` here. It is rare to need to open a port for unidirectional communication only.

## Removing Midi Ports

To remove a MIDI port, simply delete the line in your `ardour.rc` file that defines it.

## Making Connections

If you use actual physical hardware MIDI ports, then establishing connections to other MIDI equipment is simply a matter of connecting cables correctly. However, if you use "virtual ports" such as those offered by the ALSA router/sequencer or CoreMIDI, making connections is slightly more involved.

Ardour does not come with any way of establishing MIDI connections from/to other software MIDI ports. This is a difficult task to get right, and Ardour may offer something in the future. For now, you need to use an external tool that is dedicated to this purpose, much the same way you would use a patchbay (audio/MIDI) with physical equipment.

### Linux/ALSA

qjackctl (the same program that is recommended for controlling JACK) also includes an excellent MIDI connection manager. You could also use command line tools such as aconnect.

### OSX/CoreMIDI

On OSX/CoreMIDI you need to connect the MIDI ports with a patchbay tool such as the excellent MIDI Patchbay from Pete Yandell

## Using MIDI ports

Each port that is defined in `ardour.rc` can be used for any of the following functions:

- MTC input and output

- MMC input and output

- MIDI CC/Note input and output