Low-Latency Guitar Setup on CachyOS

Title image: Guitarix, Reaper, and PipeWire logos, with a guitar in the background.

🎸 Why This Setup?

As a guitar player, I wanted a Linux-based setup that lets me:

This guide explains how to configure PipeWire and JACK on CachyOS so you can play guitar through Guitarix while listening to backing tracks from your browser or music player.

πŸŽ›οΈ Overview: Audio Architecture

Audio Interface
β”‚
└── ALSA
    β”‚
    └── PipeWire
        β”œβ”€β”€ JACK Compatibility Layer (libspa-jack)
        β”‚   └── virtual amp: Guitarix
        β”‚   └── DAW: Reaper
        β”‚
        └── Other Audio: Browser, Music Player

πŸ› οΈ Setup Steps

ince I use CachyOS (an Arch Linux-based distribution), PipeWire is already pre-configured. However, some additional steps are required to ensure everything works smoothly for guitar practice and recording. If you’re using Arch Linux, see rhe arch linux documentation on pipewire for additional dependencies.

1. πŸ“¦ Install Required Packages

On CachyOS, PipeWire is pre-configured. Install PipeWire-JACK support, Guitarix, and Reaper:

sudo pacman -S pipewire-jack guitarix reaper

2. πŸ”Œ Running Guitarix and Reaper via JACK

On CachyOS this step can be skipped, you typically don’t need to use pw-jack to start JACK applications, as PipeWire handles JACK compatibility out of the box. However, if you encounter issues (e.g., on Ubuntu or Fedora), you can use the pw-jack wrapper:

pw-jack guitarix
pw-jack reaper

Creating Desktop Shortcuts (Optional)

To launch Guitarix/Reaper with pw-jack from your application menu:

  1. Locate the .desktop file:

    find /usr/share/applications ~/.local/share/applications -iname "*guitarix*.desktop"
  2. Copy it to your local applications directory:

    cp /usr/share/applications/guitarix.desktop ~/.local/share/applications/guitarix-jack.desktop
  3. Edit the Exec line:

    Exec=pw-jack guitarix
  4. Update the desktop database:

    update-desktop-database ~/.local/share/applications/

Tip: Repeat for Reaper (reaper-jack.desktop).

3. 🎧 Configure Audio Routing

Audio routing issues can occur, especially when using Reaper or connecting new USB audio devices. Here’s how to manage your connections:

Manual Routing with Helvum

Install Helvum, a graphical patchbay for PipeWire:

sudo pacman -S helvum

Start Helvum and connect:

Troubleshooting with Command Line

If you need to manually manage connections or disconnect routes, use these commands:

# List available inputs and outputs
pw-link -io

# Example output:
# alsa_input.usb-MOTU_M4_XXXXXX-00.analog-surround-40\:capture_RL
# gx_head_amp\:in_0
# gx_head_fx\:out_0
# REAPER\:in1

# Create a link (e.g., guitar input to Guitarix)
pw-link alsa_input.usb-MOTU_M4_XXXXXX-00.analog-surround-40\:capture_RL gx_head_amp\:in_0

# Delete a link
pw-link -d alsa_input.usb-MOTU_M4_XXXXXX-00.analog-surround-40\:capture_RL gx_head_amp\:in_0

Note: Replace MOTU_M4_XXXXXX with your actual MOTU M4 device ID (check with pw-link -o -i).

4. ⚑ Optimizing for Low Latency

For the best real-time guitar performance, configure PipeWire for low latency:

1. Create a configuration file:

mkdir -p ~/.config/pipewire/pipewire.conf.d
vim ~/.config/pipewire/pipewire.conf.d/low-latency.conf

2. Add the following configuration:

context.properties = {
    default.clock.rate          = 48000
    default.clock.quantum       = 128
    default.clock.min-quantum   = 32   # Lower for less latency
    default.clock.max-quantum   = 256  # Upper limit
}

3. Restart PipeWire to apply the changes:

systemctl --user restart pipewire wireplumber

πŸ’‘ Troubleshooting

High Latency in Guitarix?

If you experience high latency:

Lower default.clock.min-quantum in the PipeWire config (e.g., 32). Restart PipeWire:

systemctl --user restart pipewire wireplumber

Guitarix/Reaper Not Detecting JACK?

Ensure that libspa-0.2-jack is installed. If issues persist, launch the applications with pw-jack:

pw-jack guitarix

Crackling Sound

I encountered unresolvable crackling issues on an Intel Xeon E3-1505M v6 system. This problem did not occur on an AMD Ryzen 7 5800X or an Intel Core i5-3230M. It appears that some devices have energy-saving features that disrupt audio performance. Unfortunately, the only workaround is to increase latency, which is not ideal for real-time applications like recording an instrument.

πŸ“š References