Categories :

Free Software Audio Production, Part 1: Setting up JACK

A few months ago, I became very curious about audio production. The idea of writing, recording, mixing, and distributing my own original  music has long been an enticing fantasy. But most of all, I wanted to  know: is it possible to use only Free Software to produce good music?

The short answer is, ultimately: yes, you absolutely can! It’s entirely possible to use a Linux distribution as a daily driver, and leverage a workflow that only contains Free Software applications.

The longer answer is, again, yes. But there are some fundamental quirks to consider, and you’ll need to expand your knowledge a lot in order to get a usable workflow. I’d love to talk about my own setup, what tools I use, and what things I had to do to get the whole stack working.

Today, we’re going to focus on the basics: getting JACK audio set up with a desktop GNU/Linux distribution.

Linux Distribution

There are a couple of Linux distributions available today that focus specifically on audio production, such as Ubuntu Studio or the more contemporary KXStudio. That being said, you can pretty much use any general Linux distribution you please.

In my case, I ended up sticking with elementaryOS, which is a great generalist distro that focuses on visual design and usability.

Low-Latency Kernel

One important tweak that I made was that I installed the lowlatency Linux kernel, which is a must if you’re working with real-time audio applications. Most deb-based distributions have a package for this,  which makes installation easy:

sudo apt-get install linux-lowlatency

After installation, you can load that kernel specifically by rebooting and choosing your kernel options in GRUB.  You should boot to this kernel whenever you intend to work on audio production.

Understanding JACK

The  sound system situation in Linux has historically been a mess in one way or another. Despite the existence of backends such as PulseAudio, or  perhaps because of it, users can find it challenging to get different audio applications to play nice with each other.

For example, you might be using ALSA to play an audio track in a music sequencer, while  simultaneously using a PortAudio application to record microphone input.  If you’re trying to use real-time microphone monitoring, this can confuse applications such as Audacity!

One great way to work around this is to use JACK,  which is specifically geared for audio production work. The project describes itself as infrastructure for audio applications to communicate with each other and audio hardware.

Have you ever wanted to take the audio output of one piece of software and send it to another? How about taking the output of that same program and send it to two others, then record the result in the first program? Or maybe you’re a programmer who writes real-time audio and music applications and who is looking for a cross-platform API that enables not only device sharing but also inter-application audio routing, and is incredibly easy to learn and use? If so, JACK may be what you’ve been looking for.

It’s a bit of a beast to work with, and can initially seem intimidating to newcomers, but JACK is extremely versatile and makes up for a lot of shortcomings one might feel when trying to use ALSA or PulseAudio.

There’s a few steps to setting JACK set up, so let’s run through them.

Step 1 – Install JACK

JACK is pretty widely packaged across Linux distributions, so you should be able to easily obtain it from your distribution’s package manager.

In a deb-based system, you’ll likely want to run:

sudo apt-get install jack-tools qjackctl

Step 2 – Add Real-Time Permissions

This part is a little more hairy, but we only have to address it once. Basically, we need to make sure that the system gives the JACK daemon permissions for real-time capabilities. The official JACK site has a really great guide that makes this process pretty cut-and-dry. Here’s what I did specifically:

Create a file at /etc/security/limits.d/99-realtime.conf

Give the file these contents:

@realtime   -  rtprio     99
@realtime   -  memlock    unlimited

Then create a realtime group:

groupadd realtime
usermod -a -G realtime yourUserID

Where yourUserID is whatever your system user id is.

After that, just log out and log back in!

Step 3 – Use QJackCtl

The easiest way to use the JACK system is to use a frontend – otherwise, you’re going to have to do everything in the terminal. qjackctl is a great app that makes this process mostly transparent.

Leave a Reply