Midipus is an intelligent MIDI switch. One bidirectional ALSA sequencer connection (the head) is switched between multiple bidirectional outputs (the arms) by special, out of band messages. Data arriving on inactive arms is analyzed, compressed, and relayed to the head upon switching. This allows, for instance, a single BCF2000 to control Ardour, envy24control, Rosegarden, ZynAddSubFX and FreeWheeling at once in a paged, exclusive fashion; without any undesirable interaction between clients and without the BCF and the clients' parameter values drifting out of sync. It also eliminates the need to create many complex presets on the BCF, or ensure that different presets avoid mapping the same parameters. Multiple ALSA sequencer clients may be subscribed to an arm, allowing one to, say, control Ardour's mixer with faders while controlling amSynth's parameters with rotary encoders, but still allow switching to exclusive envy24control access, even if they utilize some of the same controller numbers. Midipus should work with any client software--even conventional MIDI mappers--, and with any sufficiently capable MIDI controller. I only mention the BCF2000 because it's the hardware I own. The Midipus code itself is mostly device neutral.
The way I use Midipus is as follows: I have a Behringer BCF2000 programmed with a 1:1 preset/arm relationship. The number of encoder groups on the BCF is reduced to 2 in all presets and all presets have the unused encoder group buttons mapped to Midipus SysEx arm change commands (SysEx dumps to reprogram your BCF in this manner are included in the distribution). Midipus is set to echo program changes upon receiving arm change messages, thereby keeping the BCF's current preset in sync with Midipus' current arm. The reason for this strange state of affairs is that the BCF2000's preset change buttons cannot be reprogrammed to send arm change messages without also disabling the function keys for LEARN, STORE, EDIT and EXIT. Obviously, there are other ways to approach the problem: feel free to program your hardware in any way you see fit.
This setup works flawlessly for most clients. It fails, however, for evil applications which attempt to connect to all system MIDI ports--Rosegarden being the obvious example. Such clients must be prevented from making automatic subscriptions so that subscriptions may be managed by your preferred patchbay (QJackCtl, Patchage, etc.)
Midipus can also be used with the BCR2000, any control surface that can be programmed to generate arbitrary SysEx messages, or any device that can send NoteOn events for notes 0 and 1 (depending on how Midipus is invoked).
The Midipus caching system is almost certainly inadequate for Abs-14 style controller messages. That is to say, only the coarse value or MSB would be properly cached. This isn't currently a problem, as very few MIDI applications on Linux seem to support these messages.
At the time of writing Midipus there was no usable MIDI patchbay persistence on Linux (see the following subsections), so I wrote my own solution; ASSPatch is persistent patchbay daemon which does everything necessary and has an effortless snapshot capability. I suggest you install and use ASSPatch if you'd like to be able to open and close programs and always have the proper MIDI connections--functionality that should be provided by QJackCtl, but, sadly, isn't.
Included in this distribution are several SysEx files to automatically reprogram a BCF2000 to work with Midipus. Please back up your existing presets before proceeding any further.
To find the port of the BCF2000 run:
$ PORT=`amidi -l | sed -n 's/^IO\s\+\(hw:[[:digit:]]\+\),.*\sBCF2000 MIDI 1.*$/\1/p'`
To backup all presets run:
$ amidi -p $PORT -r BCF2000-backup.syx
Now, to dump all presets from the BCF to the computer, hold down the EDIT button and press STORE. Now turn encoder #6 (MODE) until the display reads "All" and press down on the encoder. When the display has finished whirling about, send amidi a Ctrl-C.
To reprogram all presets on the BCF to send Midipus arm change messages on encoder group buttons 3 and 4 (thereby rendering encoder groups 3 and 4 inaccessible) run:
$ amidi -p $PORT -s BCF2000-remap-all-presets-for-midipus.syx
Note that this will only remap encoder group buttons 3 and 4; all other controls in the presets will remain unchanged. Each preset is stored automatically.
To remap only the current preset, without automatically saving, run:
$ amidi -p $PORT -s BCF2000-remap-current-preset-for-midipus.syx
Simply replace BCF with BCR in the instructions provided in the previous section.
The SysEx message which causes Midipus to switch to a lower arm is:
F0 00 20 70 00 F7
And to a higher arm:
F0 00 20 70 01 F7
This signature can currently only be changed by editing
midipus.c and recompiling.
If your device has a learning mode, activate it and then use amidi to send one of the messages above, eg:
$ amidi -p $PORT -S "F0 00 20 70 00 F7"
Or, alternatively, the
--control option can be used to cause Midipus to respond to NoteOn messages for notes 0 and 1 instead of SysEx:
$ midipus -c note
If your particular device doesn't respond to MIDI Program Change messages by changing the current preset, then you should probably run Midipus with the