Jump to content

Electric guitar interface setup

From Official NixOS Wiki

Electric guitar interface setup

This guide covers setting up an electric guitar with NixOS to achieve professional, low-latency audio processing. It targets live playing with round-trip latency under 6 ms using the modern PipeWire/JACK stack.

Introduction

The digital signal chain for a guitar consists of:

  1. Instrument-level signal from Hi-Z pickups.
  2. Analog-to-Digital conversion via an external audio interface.
  3. Real-time processing on NixOS using a low-latency kernel and specialized software.

Installation

System Configuration

Add the following to your `/etc/nixos/configuration.nix`. This configuration is optimized for high-performance CPUs like the AMD Ryzen 7 9700X.

{ pkgs, ... }:

{
  # 1. Sound Server: PipeWire with JACK/PulseAudio support
  services.pipewire = {
    enable = true;
    alsa.enable = true;
    alsa.support32Bit = true;
    pulse.enable = true;
    jack.enable = true;
    wireplumber.enable = true;
    
    # Global low-latency defaults
    extraConfig.pipewire."92-low-latency" = {
      "context.properties" = {
        "default.clock.rate" = 48000;
        "default.clock.quantum" = 128;      # ~5ms latency
        "default.clock.min-quantum" = 64;   # ~2.5ms latency
        "default.clock.max-quantum" = 512;
      };
    };
  };

  # 2. Real-time Scheduling and Privileges
  security.rtkit.enable = true;
  users.users.yourname.extraGroups = [ "audio" "realtime" ];

  # 3. Kernel and Performance Tweaks
  boot.kernelPackages = pkgs.linuxPackages_zen; 
  boot.kernelParams = [ 
    "preempt=full" 
    "threadirqs" 
    "usbcore.autosuspend=-1" 
    "processor.max_cstate=1" 
  ];

  powerManagement.cpuFreqGovernor = "performance";

  # 4. Essential Packages
  nixpkgs.config.allowUnfree = true; 
  environment.systemPackages = with pkgs; [
    qpwgraph
    pavucontrol
    ardour
    reaper
    carla
    guitarix
    gxplugins-lv2
    lsp-plugins
    calf
    dragonfly-reverb
    neural-amp-modeler-lv2
    proteus
    kapitonov-plugins-pack
    tuxguitar
    hydrogen
    cpupower
  ];
}

Applying Changes

sudo nixos-rebuild switch

Hardware & Connection

Audio Interface

Standard PC line-ins are unsuitable for guitar. Use a dedicated interface with a Hi-Z (Instrument) input.

Verified compatible devices (2026):

  • Focusrite Scarlett Solo (4th Gen): Plug-and-play, excellent Linux support.
  • Arturia MiniFuse 1: Stable performance under PipeWire.

Verification

lsusb      # Confirm hardware connection
aplay -l   # Confirm ALSA sees the interface

Audio Server Setup

Pro Audio Profile

To achieve minimal latency, you must bypass standard software mixing:

  1. Open pavucontrol.
  2. Go to Configuration.
  3. Set your interface profile to Pro Audio.

Dynamic Buffer Control

You can change latency without rebuilding the system:

# Force a specific buffer size (quantum)
pw-metadata -n settings 0 clock.force-quantum 64

# Verify current status
pw-metadata -n settings 0

Software Hosts

Type Examples Best Use Case
Standalone Guitarix Quick practice, simple pedalboard
Modular Carla Flexible routing, loading Windows VSTs
DAW Ardour, Reaper Professional recording, lowest latency via ALSA

Plugin Ecosystem (March 2026 Status)

Available in Nixpkgs

  • Neural Amp Modeler (NAM): neural-amp-modeler-lv2. Current standard for high-fidelity amp captures.
  • LSP Plugins: Includes LSP Latency Meter.
  • Proteus: Excellent for RNN-based captures.

Unavailable / Alternatives

  • Ratatouille / AIDA-X: Currently not in nixpkgs. Use NAM or Proteus.
  • MOD Desktop: Use Carla for similar modular functionality.

Measuring Latency

Never trust software reports. Always perform a physical loopback test:

  1. Connect a cable from your interface Output back into the Input.
  2. Open LSP Latency Meter.
  3. Measure the Round-trip Latency (RTL).
Latency Perception
< 5 ms Professional / Imperceptible
5-10 ms Acceptable for practice
> 12 ms Noticable "lag", difficult to play

Troubleshooting

  • Xruns (Audio Glitches): Ensure powerManagement.cpuFreqGovernor = "performance" is active.
  • No Sound: Check qpwgraph. PipeWire does not always auto-connect.
  • NVIDIA Latency: Add nvidia.NVreg_EnablePowerManagement=0 to boot.kernelParams.

See Also