Jack on Vector Linux

<Back to main

Any audio junky that's been using Linux for a while will know Jack is the most important thing in Linux.

Why? Because it gives you the power to connect audio outputs and inputs of programs together and do all sorts of funky things. Ever wanted to play 2 different songs at the same time, sing something else entirely and mix and record all of it in a new file? Or perhaps add some effects first? With Jack you can do just that.

Getting Jack 

There's a Jack package in the repository, you can get it with 

slapt-get --install jack

Giving Jack realtime priority

There's a problem though: to get the best performance from Jack, you need to make sure it has higher priority than anything else on the system, so other programs won't use the speed that jack actually needs to stream it's audio in realtime. If it doesn't have enough processor speed, the sound will stutter and you'll have to start recording all over (unless you like breakbeats).

There are at least 2 ways to get realtime priority:

using PAM + rtlimits : Unfortunately I haven't done much research to this yet.. According to some people it's the best way, but it's not quite clear to me why. PAM is a pain to set up. Also, the other way works fine.

using the realtime kernel module: The kernels on both Vector Linux 5.8 Standard and SOHO come with the realtime kernel module, so this is clearly the easiest path. The realtime module gives realtime priority to programs that belong to a certain group. Most programs just belong to the default 'root' group On VL. The group audio is group number 17, but no audio programs seem to use it. However, we'll now make jackd part of the audio group: 

chgrp audio /usr/bin/jackd

Now, we make sure the realtime module is loaded at boot and we make sure it allows realtime priority to programs of the audio group (group 17) by adding an extra line to /etc/rc.d/rc.local (this is not a very elegant way but it always works). As root, open the file in an editor and add this to the bottom of it: 

modprobe realtime gid=17
Next time you boot the realtime module will be loaded.

To start jackd with realtime priority, use:

jackd -R -d alsa

Getting qjackctl

Jack is nice, but connecting programs to it from a terminal is a pain. Fortunately, we don't have to. There's a very cool program called Qjackctl in which we can do that with the mouse and have a nice graphical representation of the connections:


click for bigger image

there's a qjackctl package in the repositories, you should be able to install it with 

slapt-get --install qjackctl

(note: you might need to have a 'testing' repository enabled to get the latest version)

Using Qjackctl to control jack

This is where it gets interesting.

 1) Open Qjackctl. There should be a menu item for it if you're using xfce / kde / gnome and installed from the package in the VL repository. If not, start it with the command 

qjackctl & 

Start Jack by pushing the green 'start' button. 

2) Start the programs you want to connect (they must be built to include jack support, unfortunately you can't just hook anything together).

I've installed jackbeat, and jack-rack. I let Jackbeat play a loop, and modify the sound with jack-rack. The result is played on the speakers:

click for bigger image

As you can see in qjackctl 's "Connections" window, not only can you connect programs together, you can also choose how to connect the different channels. For instance, by default a lot of programs will connect to alsa_pcm. I don't want to hear the sound from jackbeat though,  I want to hear just the modified sound coming from jack-rack. So I connect just the jackbeat channels I want to modify to jack-rack and disconnect them from alsa_pcm . Then, I connect jack-rack's output to alsa_pcm.