MIDI, ALSA, USB, and JACK

Akai recently released a USB version of their Electronic Wind Instrument (EWI) which I was able to purchase for under $200. I was fairly quickly able to get it running using QJackCtl and QSynth. But then I wanted to understand what was happening. That involved spelunking into the four subsystems that make up the title of this post.


Quick, non-canonical definitions

MIDI: Event notification framework for Music and more
ALSA: Advanced Linux Sound Architecture
USB: Universal Serial Bus
JACK: Jack Audio Connection Kit

To get a sound out of the EWI, I ran two Qt based programs:

qjackctl &
qsynth &
Screenshot from 2014-01-27 12:22:15

And I connected the EWI to the synth. Note that it was on the ALSA tab, not Audio nor MIDI. Nothing shows up on the Midi tab, and the Audio tab shows only System and the Synthesizer. What is going on here?

Turns out I don’t know JACK. This is OK, as it turns out there is no JACK here. QJackCtl actually talks direct to ALSA to do all of the setup.

Thanks to the folks on Freenode #jack for setting me straight.

I’ve since plugged in Rosegarden, and it shows up between the EWI and the synth.  You’ll notice that in the output below.

The command line program that shows the info I want is aconnect. The input devices are:

$ aconnect -l -i
client 0: 'System' [type=kernel]
    0 'Timer           '
    1 'Announce        '
	Connecting To: 129:0, 130:0
client 14: 'Midi Through' [type=kernel]
    0 'Midi Through Port-0'
client 20: 'EWI-USB' [type=kernel]
    0 'EWI-USB MIDI 1  '
	Connecting To: 129:0
client 129: 'rosegarden' [type=user]
    1 'sync out        '
    2 'external controller'
    3 'out 1 - General MIDI Device'
	Connecting To: 128:0

and the output devices are

$ aconnect -l -o
client 14: 'Midi Through' [type=kernel]
    0 'Midi Through Port-0'
client 20: 'EWI-USB' [type=kernel]
    0 'EWI-USB MIDI 1  '
	Connecting To: 129:0
client 128: 'FLUID Synth (qsynth)' [type=user]
    0 'Synth input port (qsynth:0)'
	Connected From: 129:3
client 129: 'rosegarden' [type=user]
    0 'record in       '
	Connected From: 0:1, 20:0
    2 'external controller'

I can kill the connection between Rosegarden and the EWI using

aconnect --disconnect 20:0 129:0

And reconnect it using

aconnect 20:0 129:0

I’ve also learned that the list of devices comes from

$ cat /proc/asound/cards
 0 [PCH            ]: HDA-Intel - HDA Intel PCH
                      HDA Intel PCH at 0xf2530000 irq 45
 1 [EWIUSB         ]: USB-Audio - EWI-USB
                      Akai Professional, LLC. EWI-USB at usb-0000:00:1a.0-1.2, full speed
 4 [ThinkPadEC     ]: ThinkPad EC - ThinkPad Console Audio Control
                      ThinkPad Console Audio Control at EC reg 0x30, fw unknown

UPDATE:
I can run the fluidsynth program directly:

fluidsynth /usr/share/soundfonts/default.sf2 -j

Once it is running I have to set the sound sample:

select 0 0 0 67

To get something that sounds vaguely like a saxophone.

1 thought on “MIDI, ALSA, USB, and JACK

  1. Thanx for sharing your experience in using Jack, etc.
    Question… what exactly is “MIDI through”?; I get the same thing on my Patchage (Jack) diagram, and sometimes “midi through” gets automatically connected, sometimes not.
    And when connected, it’s confusing as to why it’s typically a loop type connection, from say, Muse to and from “midi through”.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.