alsa offeres a virutal midi device that can be used to connect several midi applications running on the same computer. This allows you to connect various standalone applications like DAWs, livecoding environments like sonic-pi, supercollider, pd, ... or visualization software and sending midi data between them.
To activate the virtual midi devices the snd_virmidi module needs to be loaded. For a one time setup you can load the module in the terminal using modprobe
sudo modprobe snd_virmidi
but after a reboot you would have to do this again. If you want to load the module at boot time you can add the module to the /etc/modules file.
this activates the virtual mididevices you can use in your applications. To see which devices have been activated use a midi enabled alsa tool like amidiplay or aconnect to list de devices
in your application you assing one of the virtual midi devices you want to use - unfortunately there are several ways to address them and you need to consult the manual of the software you want to use which one you need
some apps use the port identifier like 68:0
some apps need connect strings like 'VirMIDI [hw:12,1,1]'
some apps need the device numbers directly like 12, 1, 1
some apps need the device paths like '/dev/midi11'
after you choose the devices in your apps and have them running you patch a virtual midi cable between those devices using aconnect aconnect 68:0 69:0
to list all connections you made use
to list the outgoing connections
to list the incomming connections
to remove a connection you can use
aconnect -d 68:0 69:0
and to remove all connections use
there are also graphical patchbays available - for exampel QJackCtl supports alsa midi and can be used to create the routing setup
Hope this helps a bit and have fun making music on your linux box
Arduino based Midi Trigger box for analog synths
creating midifiles using ruby
How to modulate Midi-CC values in Bitwig Studio
Semimodular meets SonicPI