I'm trying to create virtual midi port on rpi3 with one channel input and one output.

I'm first creating a virtual port using

$ modprobe snd-virmidi snd_index=1

which I can see is created using

$ aconnect -lio
client 0: 'System' [type=kernel]
0 'Timer           '
1 'Announce        '
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     '

and then try to route 21 to 20 using

$ aconnect 21:0 20:0

which seems successful

$ aconnect -l
client 20: 'Virtual Raw MIDI 1-0' [type=kernel]
0 'VirMIDI 1-0     '
    Connected From: 21:0
client 21: 'Virtual Raw MIDI 1-1' [type=kernel]
0 'VirMIDI 1-1     '
    Connecting To: 20:0

then when I'm trying to dump contents of ch 20 in one terminal window via

$ amidi -p hw:1,0 -d

and sending raw midi using another terminal

$ amidi -p hw:1,1 -S 'A0'

I'm not getting anything on my first terminal no matter how long the byte sequence or values I type. Finally I just terminate read via ctrl+c and it terminates with following message

0 bytes read

Any suggestions on what am I doing wrong or is it even possible via virtual midi?

  • 1
    What is the actual problem you're trying to solve? – CL. Jan 8 '17 at 18:06
  • I'm trying to build a midi hub between 2 usb-midi devices and some digital switches to alter messages depending on value. I was hoping to use virtual midi ports to stimulate bytes and read response while developing interface as it cumbersome to have both hw plugged in all the time. – randomUser56 Jan 12 '17 at 19:14
  • Do you want to use the ALSA sequencer, or an OSS MIDI device? – CL. Jan 12 '17 at 20:36
  • I was planning to use ALSA sequencer – randomUser56 Jan 13 '17 at 14:19

The snd-virmidi driver is a bridge between ALSA sequencer ports and OSS MIDI ports.

To get loopback ports (that send back what they receive), use the snd-seq-dummy driver. It's loaded automatically; you already have the "Midi Through Port".

  • and how does one send to this port. Please elaborate. for example is amidi -p"Midi Through" ..... correct? – nass Oct 7 '17 at 23:37
  • @nass amidi works only with RawMIDI ports. Use aplaymidi or pretty much any other program. – CL. Oct 8 '17 at 6:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.