In the last post on music production, I talked about the basics of the tools you'd need for music production. In this one, I'll talk about getting that stuff working on Linux. Why am I writing a dedicated post for it? Because music production setup is more of a pain than on macOS and Windows, and I enjoy the benefits of Linux enough that I went and did it anyway. Let's make the setup easier for you.

If you're not sure about any of the production terms mentioned in here, look over the initial post :) I'll focus more on comparisons between options in terms of ability to use on Linux than deep production usability reviews.

Digital Audio Workstation

There are two options to get a DAW running on Linux: use one that runs natively, or use WINE to run a Windows one.
Some that run natively:

  • Reaper
    • The one I've been using. Generally seen as pretty powerful and customisable, with a slightly steep learning curve and relatively cheap license. Free license through June (now August 2020), because they're lovely folks. It's the only one I've used of this list
  • Ardour
    • Open-source!
  • Bitwig Studio
    • One of the bigger players in the DAW realms. Fairly expensive though
  • Tracktion Waveform
    • There's a free version, and a pro version
  • QTractor

I'd love to give full reviews, but I'm simply not in a position to do so - there are far better comparisons made by those far more familiar with the field out there. Searching for "DAW comparison 2020" will find them.

Using WINE is a little less reliable; the DAWs involved don't support Linux at all, and it's not guaranteed that WINE can run any given program flawlessly. But it's worth a shot!

Both of the above are big players in the professional DAW scene, and so shouldn't leave users lacking.

Audio Drivers

On most distributions, you're probably using pulseaudio.

pactl list  # This will throw an error if pulseaudio isn't running
Check if you have pulseaudio

Unfortunately, pulseaudio can come with a whole lot of latency (the time between Things Happening on the computer and the sound reaching your ears). If you look at the top-right of Reaper, you'll see how much latency you have at the moment. When using pulseaudio, I've seen it be something like 220ms. That's... not cool, when trying to play an instrument with any kind of accuracy, and certainly not realtime. I only realised that wasn't okay when I tried playing to a click track, then listened back to it; my playing was completely off. That wasn't me, honest! It was the latency, and to sort this out we need an audio driver with less of it. Enter JACK.

JACK

JACK is pretty much an alternative to PulseAudio that's more geared towards low-latency usage with professional audio — exactly what we need. The downside is that it needs a little bit of configuration love, and tends to be a little more CPU-intensive. After all, it IS delivering the audio faster. Let's get the things we'll need to set it up nicely. I'm using Arch, so I'll give arch package names, but you should be able to find them on other distros.

  • jack2
    • JACK itself. There are 2 implementations of this, jack 1 and jack 2. They're pretty much equivalent, minus a couple tidbits, but we'll be setting up jack2 here.
  • cadence
    • A very nice interface for seeing the status of JACK, controlling its configuration, and other tools. 100% recommend.
  • pulseaudio-jack
    • JACK support for PulseAudio, used for getting PulseAudio and JACK to hold hands and play nice
    • jack2 has pretty painless support for bridging between it, PulseAudio, and ALSA. Nice.
  • a2jmidid
    • A daemon that lets older ALSA MIDI things be visible to JACK. We'll need this later
  • realtime-privileges
    • Only on Arch's AUR, but I'll show you what to do on other distros
    • JACK needs realtime privileges to do, who'da thunk, realtime audio. This package sets them up.It pus the privileges in /etc/security/limits.d/99-realtime-privileges.conf

Once you've installed those with your favourite package manager, you're in a good position to get up and running with JACK.

First, run Cadence!

Cadence initial startup

You'll see something like this, except "User in audio group" (on the left) and "Realtime" on the right will likely be unchecked. Let's fix that.

If you're on Arch and installed `realtime-privileges`, you can just do:

usermod -a -G realtime username
Add your user to the realtime group set up by realtime-privileges

On Arch, with realtime-privileges having set up the resource limits for users in that group, this will effectively give the user permission to run things in realtime.

If you're on another distro, it's likely you'll need to set up those limits yourself; it involves creating a group and editing a couple files. Or, if you don't want to do that stuff yourself, I've written a bash script to do it for you — it'll add your current user to that group too. As usual, don't just blindly trust and run scripts people give you, look it over if possible.

At this point, you should have realtime privileges set up. At this point, you should be able to run JACK without any issues by hitting "Start". We're not quite done yet though; there are a few things to configure still.

Getting JACK To Play Nicely With Other Things

PulseAudio

JACK is an audio daemon. So is Pulse. So... we can swap them out just fine, right? Unfortunately not. Some things assume Pulse will be there and will throw a tantrum if it's not, so let's sort out running them in tandem.

When we installed pulseaudio-jack, we got a bridge JACK can use to do this. In Cadence, you'll want to be in the System tab. Click "Jack Bridges -> ALSA Audio", and for Bridge Type, choose "ALSA -> PulseAudio -> JACK (plugin)", so they all play together nicely.

Now, when JACK starts via hitting "Start" in Cadence, it'll kinda sit underneath PulseAudio doing its own stuff, while PulseAudio continues its existence peacefully (instead of JACK trying to violently murder Pulse and take its place). When other things (like your DAW) use an audio device, you can point it at JACK if you want it to use JACK. It also appears as a sink in PulseAudio.

MIDI Things

Some MIDI things talk to ALSA, the almost-hardware level of audio driver. JACK doesn't go talk to those old-school critters; that's why we got a2jmidid, which persuades JACK those critters exist. With that installed, we can click "ALSA MIDI" in Cadence, and check both "Export hardware ports" and "Start with Jack". Awesome, now JACK will actually see any MIDI stuff you plug in.

I didn't know about this at first, and got rather confused about why, when REAPER was using JACK, it couldn't see my MiniLab Mk2. This fixes that.

Further Configuration

Lowering Latency

That should get JACK up and running, though you might not have as nice latency as you'd like ("Block latency" in Cadence's Jack Status). The General Advice I've seen around is you want to aim for below 10ms. How do we lower latency?

There are two main options you can change here that affect JACK's latency: Buffer Size and Periods/Buffer.

  • Buffer size is the audio frames per second between process() calls in JACK (audio frames aren't the kind of frames per second you'd have on your monitor). The lower, the less latenct, but your hardware might not be able to process the audio fast enough — if you go too low, you'll get xruns, where that happens and a little bit of audio skips (usually heard as a crackle). Try to go as low as you can without too many of these.
  • Periods/buffer. The larger the period size, the higher the latency but the less chance of xruns. I've not really had latency increase putting this up, but 2 or 3 is a good starting point, and I've not had issues there

Technically, you can change sample rate too, but you'll probably want to keep this at 48k, or whatever the sample rate of your hardware device is.

VST Plugins

Your favourite DAW will likely use VST plugins to do everything from track effects to virtual instruments. Unfortunately, most of these too are centered around Windows and Mac. We can sidestep around this though, by using LinVST, a VST wrapper that under the hood uses WINE to run the Windows VSTs. You'll want both WINE and LinVST; on Arch, these are the wine and linvst-stable packages respectively.

Note: WINE doesn't guarantee that what you're running will work, but it'll give it a good shot

Download Windows versions of your wanted VSTs to anywhere you'd like, and then run:

linvstconvert-cli -r -f -d /usr/bin/linvst.so -i /path/to/windows/VSTs
Creates wrappers for all the VSTs in the path it is given

-r means it operates recursively (ie will convert in {VSTs}/deeper/folders)
-f means it'll overwrite any wrappers there
-d is the path to the linvst binary, in my case /usr/bin/linvst.so
-i is the input folder: where your Windows VSTs are stored

It also comes with a GUI tool you could also use (linvstconvert, but you have to select the linvst.so file every time.

After this runs, you'll have some VSTname.so files in the same directory as the Windows VST VSTname.dll files — these are the wrapped VSTs, and you can use them directly in your DAW.

Fin

That should be it! Now, once you've started JACK, you should be able to select JACK as your audio device in your favourite DAW, and have all your MIDI instruments work, as well as having much lower latency than you would with Pulse!

This has been a long post, but I hope the detail helps people get up-and-running smoothly without having to dig in many other places :)

Author's note: Sorry this took so long to come out!