The default location for the configuration file is '/etc/midiard.conf'. Other files can be selected using '-f [location]' on the command line.
There are 4 main sections in the configuration file:
general - general config options.
ports - where MidiARd ports are configured.
connections - where automatic connections are configured.
rules - for rules to be run when midi events are received.
general
Current the only option is 'name'. This sets the alsa name of midiard (defaults to midiard).
ports
The basic layout is {internal_name} {external_name} {port_type}.
All options are mandatory.
The internal name is the name used internally in the midiard config file. Spaces are not allowed.
The external name is the name that other ALSA apps will see.
Port type is one of INPUT, OUTPUT or DUPLEX.
connections
The basic layout is {internal_name} {external_name}
The internal name is the internal port name as defined in the ports section above.
The external name is an ALSA Sequencer port name. This can be obtained from running 'acconnect -io'. It is important to note that at the moment only the port name can be used and the client name can't.
rules
Rules specified directly under rules are applied to all input ports when midi events arrive. Port specific rules can be specified below rules by inserting a section with the internal name of the port as specified above in the ports section and enclosing it in square brackets, ie '[]'.
The rules are fairly simple and include IF THEN ELSE, SET, SEND and END. IF tests can only be simple AND/OR tests and brackets are not permitted. SET is used to set a particular midi attribute on the event and SEND is used to send the event to a port for output. END is used to stop processing for this event.
IF tests and SET can be used against the following event details:
Type - Event type including NOTEON, NOTEOFF, CONTROLLER, PGMCHANGE, SENSING etc
Channel - Midi event channel
Note
Velocity
CtrlNo
CtrlVal
Additionally, an internal_port can be tested to see if it is connected.