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.
read more ...
Many hardware synthesizer come with an USB port these days and some of them even connect as a soundcard, allowing you to route the audio from the synth directly to your daw without wasting an input on your soundcard. And sometimes you want to record something using an USB microphone or USB Guitar cable.
To connect such devices to my DAW via jack on linux I created a little startup script that runs every time I start Bitwig Studio to make sure all the external devices are connected. I use alsa_in - a command line tool that allows you to connect an additional alsa sound card. a2jack needs some parameters like the device name, sampling rate or buffer size to use and starts a process. Then it starts a process that listens to the alsa device and forwards the input to jack by connecting as a jack client application with some inputports. These ports can be configured as input routes in your daw like Bitwig or ardor - just like you would do with an input channel on your main sound-card.
To route audio from your daw to the output of an second sound you can use alsa_out
My music startup script connects the audio interface of my Yamaha MX61 and an usb-soundcard, that is connected to my Korg KaosPad Mini, so I can use it as an external effects processor in bitwig-studio
alsa_in -j "MX61" -d hw:CARD=MX49MX61,DEV=0 -r 44100 -p 256 & alsa_in -j "FX" -d hw:CARD=Device,DEV=0 -r 44100 -p 256 & alsa_out -j "FX" -d hw:CARD=Device,DEV=0 -r 44100 -p 512
You can get a list of the available alsa device names by running the command
Unfortunately the USB soundcard I use always selects the microphone input when it is plugged in or my computer restarts. To fix this I use the amixer command to change the capture channel to line and mute it - so I don' t generate feedback loops (I spent hours finding out where that distortion came from :-/)
amixer -D "hw:CARD=Device" cset numid=11 on # Line capture on amixer -D "hw:CARD=Device" cset numid=5 off # Line mute
you can get a list of supported controls and their id by a running
amixer -D "hw:CARD=Device" controls
just replace "hw:CARD=Device" with the device identifier of your sound interface.read more ...