Ok, I’ve made some nice progress with adding rules to amidiauto
, please give it a try
To install the new build, do:
git clone https://github.com/BlokasLabs/amidiauto -b amidiauto_rules
cd amidiauto
make
sudo make install
Create /etc/amidiauto.conf with the following contents:
[allow]
* <-> *
MEC MIDI -> Pure Data # Can also be written as Pure Data <- MEC MIDI
[disallow]
MEC MIDI <-> *
Push 2 <-> *
The strings in amidiauto.conf are the ALSA MIDI client names of the devices. The name matching is done by searching for the provided substring (like ‘MEC MIDI’) in the full ALSA MIDI client name.
amidiauto still works with the very first input and output port provided by the ALSA client.
The middle part can be one of <->
, ->
and <-
. It indicates the direction of connection, from a MIDI output to an input. <->
is a shorthand for specifying the same rule twice, once with <-
, and then with ->
.
The rules work by evaluating their strength, and giving ‘allow’ priority, in case both ‘allow’ and ‘disallow’ would evaluate to the same strength. The strength of the rules, from weakest, to strongest:
* <-> * # Weakest
something <-> * # Stronger
something <-> something_else # Strongest
So the above config file sets amidiauto to connect every hardware and software MIDI ports together, unless they are either “MEC MIDI” or “Push 2”, and still setting up the connection from “MEC MIDI” to “Pure Data” automatically.
The wildcard rules still are categorizing MIDI ports into ‘software’ and ‘hardware’ ports, and only making automatic connections between the categories. Using the explicit strongest rule is possible to make automatic connections between ports within the same category.