[linux-audio-user] midi interface

Alexandre Ratchov alex at caoua.org
Mon Jan 8 17:00:38 EST 2007


On Sun, Jan 07, 2007 at 07:02:35PM +0100, Julien Claassen wrote:
> Hi!
>   If I have a midi-interface, one of those externals, to which you can connect 
> more than one device (synth, keyboard), how does this look to alsa? Does it 
> only see one dvice with a lot of channels or does it see more devices? I think 
> about getting one to use it with midish, which uses rawmidi devices and I 
> wonder if it will work.

hello!

if your MIDI interface has multiple MIDI ports but they don't
appear in /dev you can use 'modprobe snd-virmidi' to create virtual
MIDI devices (they will appear in /dev). Then you can use
aconnect(1) to connect virtual devices to real devices.

For instance i have an Edirol UM2 USB-MIDI interface (2 input ports
and 2 output ports). According to 'aseqdump -l' devices appear to
ALSA as ports 16:0 and 16:1. Virtual devices appear as ports 24:0
25:0 26:0 27:0.

$ aseqdump -l
 Port    Client name                      Port name
  0:0    System                           Timer
  0:1    System                           Announce
 14:0    Midi Through                     Midi Through Port-0
 16:0    UM-2                             UM-2 MIDI 1
 16:1    UM-2                             UM-2 MIDI 2
 20:0    MPU-401 MIDI 1-0                 MPU-401 MIDI 1-0
 24:0    Virtual Raw MIDI 2-0             VirMIDI 2-0
 25:0    Virtual Raw MIDI 2-1             VirMIDI 2-1
 26:0    Virtual Raw MIDI 2-2             VirMIDI 2-2
 27:0    Virtual Raw MIDI 2-3             VirMIDI 2-3

$ ls -l /dev/snd/midi*
crw-rw---- 1 root audio 116,  8 2007-01-08 21:56 /dev/snd/midiC0D0
crw-rw---- 1 root audio 116, 40 2007-01-08 21:56 /dev/snd/midiC1D0
crw-rw---- 1 root audio 116, 72 2007-01-08 22:06 /dev/snd/midiC2D0
crw-rw---- 1 root audio 116, 73 2007-01-08 22:06 /dev/snd/midiC2D1
crw-rw---- 1 root audio 116, 74 2007-01-08 22:06 /dev/snd/midiC2D2
crw-rw---- 1 root audio 116, 75 2007-01-08 22:06 /dev/snd/midiC2D3

Then, I connect (in both "in" and "out" directions) port 16:0 to
port 24:0 and 16:1 to 25:0, so that both ports of my UM2 will be
usable as /dev/snd/midiC2D0 and /dev/snd/midiC2D1

$ aconnect 16:0 24:0
$ aconnect 24:0 16:0
$ aconnect 16:1 25:0
$ aconnect 25:0 16:1

At this stage, midish is able to use /dev/snd/midiC2D0 and
/dev/snd/midiC2D1. For instance the following will configure
devices and start sending everything from device 1 (my keyboard) to
device 0 (my sound module)

$ rmidish 
send EOF character (control-D) to quit
1> devattach 0 "/dev/snd/midiC2D0"
2> devattach 1 "/dev/snd/midiC2D1"
3> filtnew myfilt
4> filtdevmap myfilt 1 0
5> songidle
press control-C to finish

cheers,

-- Alexandre



More information about the Linux-audio-user mailing list