Making WebMIDI outputs work on Ubuntu with Timidity or fluidsynth

In my first experimentation with WebMIDI, I could never get any simple MIDI output on Ubuntu 14.04. I wanted at least to make it work with timidity.

I assume that you have enable WebMIDI in Chrome/Chromium/Dartium

chrome://flags/#enable-web-midi

I assume timidity is already running otherwise you can start it using

timidity -iAD

If you rather use fluidsynth you can start it with a command similar to

fluidsynth -a alsa -m alsa_seq -l -i /usr/share/soundfonts/fluidr3/FluidR3GM.SF2

the list of outputs using the WebMIDI API was empty although I had the following

$ aconnect -lo

client 14: 'Midi Through' [type=kernel]
    0 'Midi Through Port-0'
client 128: 'TiMidity' [type=user]
    0 'TiMidity port 0 '
    1 'TiMidity port 1 '
    2 'TiMidity port 2 '
    3 'TiMidity port 3 '
client 129: 'FLUID Synth (32737)' [type=user]

    0 'Synth input port (32737:0)'


The solution I found was to load snd-virmidi

$ sudo modprobe snd-virmidi

I then had 4 midi outputs available from WebMIDI:

$ aconnect -lo

client 14: 'Midi Through' [type=kernel]
    0 'Midi Through Port-0'
client 20: 'Virtual Raw MIDI 1-0' [type=kernel]
    0 'VirMIDI 1-0     '
client 21: 'Virtual Raw MIDI 1-1' [type=kernel]
    0 'VirMIDI 1-1     '
client 22: 'Virtual Raw MIDI 1-2' [type=kernel]
    0 'VirMIDI 1-2     '
client 23: 'Virtual Raw MIDI 1-3' [type=kernel]
    0 'VirMIDI 1-3     '
client 128: 'TiMidity' [type=user]
    0 'TiMidity port 0 '
    1 'TiMidity port 1 '
    2 'TiMidity port 2 '
    3 'TiMidity port 3 '
client 129: 'FLUID Synth (32737)' [type=user]

    0 'Synth input port (32737:0)'


 however with no sounds as I need to connect the virtual port to timidity or fluidsynth using:

$ aconnect 20:0 128:0

meaning that I connect the first virtual port to the first timidity port

$ aconnect -lo

client 14: 'Midi Through' [type=kernel]
    0 'Midi Through Port-0'
client 20: 'Virtual Raw MIDI 1-0' [type=kernel]
    0 'VirMIDI 1-0     '
Connecting To: 128:0
client 21: 'Virtual Raw MIDI 1-1' [type=kernel]
    0 'VirMIDI 1-1     '
client 22: 'Virtual Raw MIDI 1-2' [type=kernel]
    0 'VirMIDI 1-2     '
client 23: 'Virtual Raw MIDI 1-3' [type=kernel]
    0 'VirMIDI 1-3     '
client 128: 'TiMidity' [type=user]
    0 'TiMidity port 0 '
Connected From: 20:0
    1 'TiMidity port 1 '
    2 'TiMidity port 2 '
    3 'TiMidity port 3 '
client 129: 'FLUID Synth (32737)' [type=user]

    0 'Synth input port (32737:0)'



I had to restart Chrome/Chromium/Dartium to then be able to use the first midi output available and send midi events

Popular posts from this blog

Fixing "DerInputStream.getLength(): lengthTag=109, too big" in Android Studio

Simple Samba setup on Lubuntu

Solving: insufficient permissions for device: user in plugdev group; are your udev rules wrong