The MIDI parser, midi_parser.so, requires a configuration file (midi.cfg) that describes its runtime environment, including the paths to sound patches and instrument configurations.
The file midi.cfg describes the runtime environments of the
MIDI media filter,including the paths of sound patches,
instruments configurations, and so on.
Configuration files define the mapping of MIDI programs to
instrument files. Multiple files may be specified, and
statements in later ones will override earlier ones.
The parser looks for midi.cfg in the
following order:
- In the file named by the MMEDIA_MIDI_CFG environment variable.
- In $HOME/.media/config/midi.cfg
- In /etc/config/media/midi.cfg
The midi.cfg configuration file can have the following statements:
- # this is a comment
- Comment lines start with the # character.
- dir directory
- The directory becomes the current working directory. For example:
dir /usr/share/media/midi
- source file
- Reads another configuration file, then continues processing the current one. For example:
source midi.cfg
Here, the media filter will load the configuration file /usr/share/media/midi/midi.cfg
- bank number
- Selects the tone bank to modify. Patch mappings that follow will affect this tone bank.
- drumset number
- Selects the drum set to modify. Patch mappings that follow will affect this drum set.
- number file [options]
- Specify that the MIDI program number in the current tone bank or drum set should be played using the patch file file. Options may be any of the following:
- amp=a
- Amplify the instrument's volume by a percent. If no value is specified, it's automatically determined whenever the instrument is loaded.
- note=n
- Specifies a fixed MIDI note to use when playing the instrument. If n is 0, the instrument is played at whatever note the Note On event triggering it has. For percussion instruments, if no value is specified in the configuration file, the default in the patch file is used.
- keep={loop|env}
- By default, percussion instruments have their loop and envelope information stripped. Strangely shaped envelopes are removed automatically from melodic instruments as well. Use keep to prevent envelope or loop data from being stripped. For example, the Short and Long Whistle percussion instruments (General MIDI numbers 71 and 72) need to have keep=loop keep=env specified in the configuration file.
This is a short example midi.cfg file:
#this is a comment
dir /usr/share/media/midi
source default.cfg