Playing Guitar on Linux (approved by the CEO of PipeWire)

Monday, 30 Dec 2024
computer music

Amp and guitar

My bootlegged guitar amplifier sounds very bad and it makes my counterfeit Squier guitar sounds even worse. I don’t want to build a crazy effect board if I’m limited to this one amplifier. Instead of getting a good amplifier, I decided to get a USB audio interface and let my computer processes the effects!

There is a good piece of software for this purpose, Guitarix, which is a virtual guitar amplifier.

In short

Guitarix runs on JACK but I’m a PipeWire fan. Thank God PipeWire is pretty good now, so I can copy random commands I found on the Internet while logged in as root:

pacman -S pipewire pipewire-pulse pipewire-jack guitarix helvum
The thing with the commands above is that PipeWire will replace both the implementations of PulseAudio and JACK.

Now, Helvum is a patchbay for PipeWire. You can do more with it such as managing connections between audio sources and outputs. However, I use this simply to connect the audio interface to Guitarix and finally to the speaker. You can also use other patchbays but I will stick to Helvum for a while since it has a cool name.

Those are the bare minimum since I use PipeWire. However, I need to address my personal problems and the thing about delay.

Helvum interface

Guitarix interface

Artix Linux

Sadly, I fell for the Artix Linux meme. There is no guitarix and helvum packages in the official repo. There are the git version of both in the AUR. I can compile Helvum without any problem. However, in order to compile Guitarix, I need zita-convolver which doesn’t exist in both Artix repo and the AUR!

I probably can get that library from somewhere else, but I want to minimize frustration. The simplest way to solve this is just to add Arch repo to the system.1

pacman -S artix-archlinux-support

Append the following to /etc/pacman.conf:

[extra]
Include = /etc/pacman.d/mirrorlist-arch

And then:

pacman-key --populate archlinux
pacman -Sy

Now I can get Guitarix, either from the Arch repo or from the AUR (which will pull the previously mentioned dependency from the Arch repo anyway).

Latency

It’s possible to set a custom buffer size:

PIPEWIRE_LATENCY="128/48000" guitarix

However, thanks to this blog2, I learned that it’s possible to make this persistent either system-wide or local. For local changes only:

cp /usr/share/pipewire/jack.conf ~/.config/pipewire/jack.conf

Uncomment node.latency under jack.properties and set its value to 128/48000. This will apply to all jack clients. You can create specific rules for certain clients under jack.rules, but I don’t need it.

Ulimit

You’ll get a warning system init *** mlockall failed in Guitarix. To solve this, we need to set our resource limits.

Create the file /etc/security/limits.d/audio.conf with the content:

@audio  -   rtprio      95
@audio  -   memlock     unlimited

This is probably a boring Linux stuff, but you can read the manual for limits.conf if you’re interested. Basically, @audio indicates a group name while the last column is the limit value.

So, we need to actually add our user to the audio group:

sudo usermod -a -G audio $USER

DAW

It’s possible to use Guitarix as a DAW plugin. I encountered this cool blog3 that mentions this. However, since my use case is still simple, I’ll be using Gutarix as a standalone program.

Physical Audio Output

a.k.a. speakers

I don’t actually have a real computer speaker, so I use my bootlegged guitar amplifier as an audio output for my computer.

Amp as a speaker

The USB audio interface and the bootleg amplifier

It feels like I get a new amplifier without actually buying one!


left arrow icon To blog upwards arrow icon To top