Using a2jmidid to Re-Route ALSA MIDI

As I created a larger setup I discovered that my MIDI connections were becoming complicated. Some programs support ALSA MIDI, some support JACK MIDI, and some support both. My MIDI controller hardware is only supported by ALSA.

My version of JACK (0.124.1) handles this reasonably well in many cases by automatically bridging ALSA MIDI ports as JACK MIDI ports. However, I have a case that it doesn’t handle: having multiple devices of the same model. The automatic ALSA-JACK bridge only showed one port when I had three identical devices. Fortunately, I found a2jmidid, which shows all three ports.

I use QjackCtl to control JACK. Here’s how I originally had it configured for MIDI (I stopped JACK and clicked QjackCtl’s Setup button to see the Setup dialog).

On the Settings tab, MIDI Driver (near the lower right corner) was set to seq:


On the Misc tab, Enable ALSA Sequencer support was checked:


With this configuration I started JACK and connected a KORG nanoKONTROL device. The nanoKONTROL appeared on the ALSA tab in the Connections window:


The nanoKONTROL also appeared on the MIDI tab as a sub-device of alsa_midi:


I then connected a second nanoKONTROL unit. The second nanoKONTROL appeared on the ALSA tab:


The second nanoKONTROL didn’t appear on the MIDI tab:


In a terminal, I executed the following:

[steve@audio ~]$ a2jmidid --export-hw

(Option -e can be used instead of —export-hw)

A new entry a2j appeared in the MIDI tab and both nanoKONTROLs were present:


I then stopped JACK, clicked the Setup button, and simplified my QjackCtl configuration with a few simple tweaks.

On the Settings tab, I changed MIDI Driver to none. This will eliminate the alsa_midi entry on the MIDI tab:


On the Misc tab, I unchecked Enable ALSA Sequencer support. This will eliminate the ALSA tab:


On the Options tab, I checked Execute script after Startup and entered a2jmidid –export-hw & in the box (note that there are two dashes before export-hw). This will start a2jmidid automatically after JACK starts:


After clicking OK I saw a message that I needed to restart QjackCtl, which I did. I started JACK and opened the new, simplified Connections window:


One issue I’ve found is that Nano-Basket doesn’t work when connected via a2jmidid; it seems to require regular ALSA MIDI. My workaround is to connect Nano-Basket using a program other than QjackCtl; I tried Patchage, which worked fine (although I also noticed that a2jmidid won’t start if Patchage is already running).

I’m very pleased with how a2jmidid has simplified my setup.

Tagged with: , , , ,
Posted in Tools

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: