Skip to content
No description, website, or topics provided.
C
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
SysEx
Makefile
README
README.html
README.mu
midipus.c

README






_____________________________

______ __  _     _

-+--- Description - -    -

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.


		Chapter 1.: Implementation

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 #(b,LEARN), #(b,STORE), #(b,EDIT) and
#(b,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--#(i,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).


______ __  _     _

-+--- 1.1. Limitations - -    -

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. 


		Chapter 2.: Usage


______ __  _     _

-+--- 2.1. Managing connections - -    -

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.

  QJackCtl
    QJackCtl's patchbay is practically useless. It can take hours to design
    a patchbay in it because it can't take valid snapshots of connections.
    It is also incapable of making certain types of connections common to
    Midipus or other multi-port MIDI clients. I recommend to avoid using
    its patchbay functionality.

  Patchage
    Patchage is cumbersome but workable. Using it to maintain connections
    requires that you manage your sessions via LASH, hard to do,
    considering that Patchage is pretty much the only LASH client out
    there.

  Alsa-Patch-Bay
    Lightweight, but suffers the same limitations as Patchage. Plus, works
    with LADCCA, an obsolete version of LASH

  AConnectGUI
    Fine for setting up connections, but no persistence or even LASH
    support.

  ASSPatch
    Designed by the author specifically for use with Midipus, ASSPatch is
    the only fully functional ALSA Sequencer subscription persistence
    manager available. It runs as a daemon process and requires no GUI.
    Define your patchbay connections in a simple configuration file, or
    allow ASSPatch to take a snapshot of current connections and write the
    file for you.  I personally have QJackCtl set to launch ASSPatch (along
    with some other clients) at server startup.


______ __  _     _

-+--- 2.2. Programing Your Controller - -    -


______ __  _     _

-+--- 2.2.1. The BCF2000 - -    -

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
#(b,EDIT) button and press #(b,STORE). Now turn encoder #6 (#(b,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


______ __  _     _

-+--- 2.2.2. The BCR2000 - -    -

Simply replace #(i,BCF) with #(i,BCR) in the instructions provided in the
previous section. 


______ __  _     _

-+--- 2.2.3. Other Devices - -    -

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 #(c,midipus.c) and
recompiling.

If your device has a learning mode, activate it and then use #(i,amidi) to
send one of the messages above, eg:

  $ amidi -p $PORT -S "F0 00 20 70 00 F7"

Or, alternatively, the #(c,--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
#(c,--no-pc) option.

You can’t perform that action at this time.