Multi-usb mic/jackd/liquidsoap setup

From wiki.occupyboston.org
Jump to: navigation, search

Assuming you have two usb mics plugged in, and they are assigned the alsa devices hw:1 and hw:2, you can use the following to stream them:

I suggest using qjackctl to set jack options, because it's easier, but if you don't want to do that jackd should be run with the following options:

/usr/bin/jackd -r -dalsa -r44100 -p1024 -n2 -D -Chw:1 -Phw:0

These options, in order: disable realtime prio (which should be enabled once we get a realtime kernel), use the alsa backend, use a samplerate of 44100hz, set 1024 frames/period, set 2 periods/buffer, set duplex mode, set the default capture device to hw:1 (the first usb mic), and set the default playback device to hw:0 (the default alsa device).

Once jackd is running, you can use the other usb mic by running:

alsa_in -j mic2 -c 1 -d hw:2

alsa_in is a jackd client for alsa devices (there's also alsa_out). The options: change the jack name, set the number of channels, and set the device to use.

I've encounter problems running multiple instances of alsa_in on different alsa devices, so I haven't been able to get more than two microphones in.

The liquidsoap test script which can take input from jack is:

#!/usr/local/bin/liquidsoap

#set("log.file.path","/home/brandon/ls.log")
set("log.stdout", true)

full = input.jack(id="liquidsoap")

output.icecast(%mp3, host="a.stream.mayfirst.org", port=8000, password="######", mount="brandon.mp3", full)
output.icecast(%vorbis, host="a.stream.mayfirst.org", port=8000, password="######", mount="brandon.ogg", full)

Once that's running, you can just drag and drop the connections in qjackctl. There should be two capture devices in the left column (the default jackd capture device and 'mic2'), which you can drag over to the 'liquidsoap' device on the right. Anything piped into the liquidsoap device will stream to both ogg and mp3 at the specified mountpoint.

Meterbridge is a handy jack tool that I like to use as well (ubuntu package 'meterbridge').

meterbridge -t sco -n meterbridge 1 2

This will give you two oscilloscope type monitors which you can jack the inputs into as well.


I did have to install liquidsoap from source, because the ubuntu packages were broken. This can be done easily:

apt-get build-dep liquidsoap
apt-get source liquidsoap
cd liquidsoap-<version>
./configure
make
make install

Liquidsoap documentation can be found here: http://savonet.sourceforge.net/documentation.html

here's a liquidsoap example with some scheduling and 'jingles': http://savonet.sourceforge.net/doc-1.0.0-beta3/complete_case.html