JACK Audio Connection Kit

From ArchWiki
Revision as of 20:39, 9 December 2010 by Thestinger (talk | contribs)
Jump to navigation Jump to search

If you know anything about JACK, please expand this article. I've uninstalled it, so I can't really expand it any further.


Multiprocessor implementation (soon: JACK2)

JACK2 is currently available in the [community] and can be installed from there

pacman -S jack2

You can compile Jack2 with the new dbus-based control system or the 'classic' interface. Which one you have depends on whether you compiled Jack2 with the --dbus configure option or not.

Jack2 without --dbus executes similarly to Jack1. With --dbus, control is done using the jack_control utility. Run `jack_control` to see what it does. The important commands are listed below:

jack_control start  -  starts the jack server
jack_control stop  - stops the jack server
jack_control ds alsa  -  selects alsa as the driver (backend)
jack_control eps realtime True  -  set engine parameters, such as realtime
jack_control dps period 256  -  set the driver parameter period to 256

You may also need to play with the driver parameters nperiods and rate.


Alternatively, there is the normal version from the extra repository, install it with:

pacman -S jack

Jack for a multi-user system

So, you have a descent multiuser system as it was designed more than 20 years ago, and now some developers decided that sound is only for a mono-user system... No I can not believe it !

Warning: Before following the below instructions, please note that there is a security risk to any service running as root, and, more importantly, the developers for jack do not test it for running as root. In other words, it could eat your babies, data, or both

Fortunately some time ago someone convinced the developers to allow jack to run as a system wide daemon. Here is the procedure to follow:

Create a /etc/profile.d/jack.sh file containing:


Replace /etc/rc.d/jack-audio-connection-kit with the following content


. /etc/rc.conf
. /etc/rc.d/functions

# source application-specific settings
[ -f /etc/conf.d/jack-audio-connection-kit ] && . /etc/conf.d/jack-audio-connection-kit

PID=`pidof -o %PPID /usr/bin/jackd`

[ -n "$JACKUSER" ] && HOME="/home/$JACKUSER"
[ -z "$JACK_PARAMS" ] && JACK_PARAMS=$(sed 's:/usr/bin/jackd ::' $HOME/.jackdrc)

case "$1" in
    stat_busy "Starting JACK"
    if [ -z "$PID" ]; then
      if [ -n "$JACKUSER" ]; then
        su - $JACKUSER -c 'export JACK_PROMISCUOUS_SERVER="" && . /etc/conf.d/jack-audio-connection-kit && umask 0000 && /usr/bin/jackd $JACK_PARAMS &> /dev/null &'
	umask 0000
        /usr/bin/jackd $JACK_PARAMS &> /dev/null &

    if [ ! -z "$PID" -o $? -gt 0 ]; then
      add_daemon jack
    stat_busy "Stopping JACK"
    [ ! -z "$PID" ]  && kill $PID &> /dev/null
    if [ $? -gt 0 ]; then
      rm_daemon jack
    $0 stop
    sleep 1
    $0 start
    echo "usage: $0 {sta|stop|restart}"
exit 0

Where my /etc/conf.d/jack-audio-connection-kit is

# Configuration for starting JACK at boot

# Uncomment this to run as user (recommended)

# Uncomment this to not source ~/.jackdrc
JACK_PARAMS="-R -P89 -dalsa -dhw:1 -r48000 -p512 -n3"

Playing nice with ALSA

To allow Alsa programs to play while jack is running you must install the jack plugin for alsa:

pacman -S alsa-plugins

And enable it by editing (or creating) /etc/asound.conf (system wide settings) to have these lines:

# convert alsa API over jack API
# use it with
# % aplay foo.wav

# use this as default
pcm.!default {
type plug
slave { pcm "jack" }

ctl.mixer0 {
type hw
card 1

# pcm type jack
pcm.jack {
type jack
playback_ports {
0 system:playback_1
1 system:playback_2
capture_ports {
0 system:capture_1
1 system:capture_2

You needn't restart your computer or anything. Just edit the alsa config files, start up jack, and there you go...

Remember to start it as an user. If you start it with "jackd -d alsa" as user X, it won't work for user Y.

Related Articles

Pro Audio