Bounding Unicorns

Using JACK On Linux


On Debian I use the jackd2 package. This package recommends qjackctl which is a QT application (350 MB of dependencies), thus for installation on a server it is necessary to configure APT to not install recommended packages.


There is rather limited information out there on how to actually use JACK, especially without clicking through GUI tools.

First, we need to launch a JACK server:

jack -d alsa

Chances are, that isn't going to work out of the box.

The first complaint was:

Failed to connect to session bus for device reservation: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11

To bypass device reservation via session bus, set JACK_NO_AUDIO_RESERVATION=1 prior to starting jackd.

Naturally, I do not use or need dbus for anything.

Second, I run audio through a USB sound card with S/PDIF output to my receivers, meaning I need to specify the card explicitly.

Third, it appears that JACK fixes the sample rate on the output device, and the default is 48000. I have more 44100 music than 48000 music and the 41000 music is generally of higher recording quality, thus it makes sense to use 44100 sample rate.

Putting it all together:

env JACK_NO_AUDIO_RESERVATION=1 jackd -d alsa -d hw:2 -r 44100

That invocation still ended up not working using my USB audio card. If I specified -d hw:1 to output audio to the integrated Intel HDA card, the above invocation works. With the USB card however it fails thusly:

ALSA: could not start playback (Broken pipe)
Cannot start driver
JackServer::Start() failed with -1
Failed to start server

There is, as far as I can tell, zero diagnostics for what pipe is broken and why. But after some trial and error I noticed that I could get JACK running on the USB audio card if I limited it to only capture or only playback, as follows:

JACK_NO_AUDIO_RESERVATION=1 jackd -d alsa -d hw:2 -r 44100 -P

JACK_NO_AUDIO_RESERVATION=1 jackd -d alsa -d hw:2 -r 44100 -C

As long as JACK only tries to handle one of these, it works. With both capture and playback, on the USB audio card, it fails to start.

This is a problem because I intended to use JACK to measure the processing latency added by the Yamaha HTR-3064 receiver I just purchased, which requires both capture and playback functionality to exist in the same JACK daemon.

For sending audio to JACK, see here.

Real-Time Priority

To enable real-time priority for JACK programmatically, run:

echo 'jackd2 jackd/tweak_rt_limits boolean true' |debconf-set-selections
env DEBIAN_FRONTEND=noninteractive dpkg-reconfigure -p high jackd2 

Sources: here and my existing configuration scripts.

For this change to take effect, a new user session is required (log out & back in).

Reference: here.

ALSA To JACK Routing

Guides: here and here.