Setting up Jack Audio Connection Kit for Dummies

This guide is meant to be an easy walkthrough of how to install, configure and use JACK on GNU/Linux. Please read it carefully to not miss any steps.
Note: Some distros have started shipping with PipeWire instead of PulseAudio. PipeWire offers a drop-in replacement for JACK, which allows JACK clients and PulseAudio clients to use the same audio graph instead of using a bridge like pulseaudio-module-jack. Please consult your distro's documentation for how to set this up (e.g. Debian). PipeWire is in most cases the preferred solution, however, in some cases JACK is preferred. Running the JACK server instead of pipewire-jack allows for more reliable real-time performance. If you wish to continue, you'll need to remove pipewire-alsa, pipewire-audio, and pipewire-module-jack.

Table of contents

Installing the necesssary packages

To get started, you need to install the packages from your distro's column:

Debian/Ubuntu Arch
jackd2 jack2
qjackctl qjackctl
pavucontrol pavucontrol
pulseaudio-module-jack pulseaudio-jack
vlc-plugin-jack not needed

System configuration

In order to get the best performance from JACK, you will need to configure your system to allow JACK to run in realtime mode. Run
cat /etc/security/limits.d/audio.conf
to see if your distro's packagers already included a limits config file. If the file already doesn't exist, run this:
sudo mkdir -p /etc/security/limits.d/
echo "@audio   -  rtprio     95
@audio   -  memlock    unlimited" | sudo tee /etc/security/limits.d/audio.conf
Then you'll need to create an audio user group.
sudo groupadd audio
Then you'll need to add your user to it, so run this command with your username.
sudo usermod -a -G audio your_username
You will need to log out and in again or reboot for the changes to take effect.

Releasing audio device

On most distros, audio devices are accessed by pulseaudio by default. You will need to tell pulseaudio to stop using the device so that it can be used by JACK. To do so, follow these simple steps: PulseAudio should remember the profile if you don't disconnect the audio device, but if you do disconnect it, you may have to do this everytime you wish to use JACK.

Configuring QjackCtl

Open up QjackCtl and click Setup. Make sure you are in the Settings tab and under that in the Parameters tab.

You will be presented with several parameters. I'll quickly guide you though the most important ones.

The Driver is the backend that JACK uses to talk to hardware. It is almost always just set to alsa.

The Realtime checkbox makes JACK run in realtime mode, which makes it more reliable and results in less Xruns (over/underruns, audible pops and clicks).

The Interface option selects what audio device to use. If you want to use separate interfaces for input and output, you can do so under the Advanced tab.

Leave MIDI Driver set to none if you're not familiar with JACK MIDI yet.

The Sample Rate is pretty self explanatory. You can set it as higher than your hardware's sample rate and JACK will use resampling, but I recommend you leave it at your hardware's limit. If you don't know what you hardware supports, leave it at 48000.

Frames/Period and Periods/Buffer define the buffer size that JACK uses. This is the chunk of audio that JACK processes at a time. A smaller buffer size will result in less latency but it can increase the amount of Xruns, so you'll hear more pops and clicks. This should be adjusted to your hardware capabilities and how important clean audio is to your use case. A starting point is 256 Frames/Period at 2 Periods/Buffer.

In the bottom right corner, you can see the Latency that your choice of buffer size produces.

Test if JACK works with VLC

VLC supports playback using JACK. To enable it, under Tools click Preferences and open the Audio settings. Under Output select JACK audio output as the Output module. Close and reopen VLC for it to take effect.

Now you should be able to play audio with VLC when using JACK.

Using PulseAudio with JACK

There's two main methods to use PulseAudio with JACK.

Using a script

I wrote a script that starts a bridge between PulseAudio and JACK so that you can use PulseAudio applications while running JACK.

First make sure that Enable JACK D-Bus interface isn't enabled under the Misc tab in QjackCtl setup.

Click here to download the script. Move it to whereever you want, but I recomment you put it in your home folder.

Rightclick the script and click properties. Under Permissions you will need to enable the Allow execution.

In the QjackCtl Setup, click the Options tab and enable Execute script after startup. Click the 3 dot button on the right and select the script you downloaded. Click Apply and OK and restart JACK and you should be able to get audio from JACK.

To verify that the link loaded succesfully, click Graph in QjackCtl. You should see these 2 boxes:

Using JACK D-Bus interface

This method might not work on every distro, but is worth trying if you don't want to rely on a script.

Open QjackCtl setup and select the Misc tab. Select Enable JACK D-Bus interface. Apply and restart JACK. If it's working, you should the same as the image from the above method when you click Graph.

Autostarting JACK

If you wish to automatically start JACK when you log into your user, here is how to do it.

Open the QjackCtl setup. Click the Misc tab. Under Other enable Start JACK audio server on application startup.

Then run this command to add a shortcut for QjackCtl to the autostart folder.
cp /usr/share/applications/qjackctl.desktop ~/.config/autostart/qjackctl.desktop
Now QjackCtl should start automatically when you log in.

Installing a real-time kernel

Installing a realtime kernel can drastically improve audio performance and reduce Xruns.

On Debian and Ubuntu you can simply install linux-image-rt-amd64 and reboot your system. For Arch, follow this guide.