Electric guitar interface setup: Difference between revisions
Mr.Smith1970 (talk | contribs) Electric guitar interface setup: clean up, fix Wine package, add Audient iD4, remove unavailable plugins, comply with MOS |
Mr.Smith1970 (talk | contribs) Update: add PipeASIO, TONE3000, modernize kernel tweaks and Rocksmith setup |
||
| Line 1: | Line 1: | ||
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 (RTL) under 6 ms using the modern PipeWire and WirePlumber stack. | |||
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 (RTL) under 6 ms using the modern PipeWire | |||
{{Warning|Always start with monitoring volume at minimum when testing new signal chains. A sudden, loud feedback loop can be generated during loopback testing. Increase volume gradually only after the plugin is open and stable.}} | {{Warning|Always start with monitoring volume at minimum when testing new signal chains. A sudden, loud feedback loop can be generated during loopback testing. Increase volume gradually only after the plugin is open and stable.}} | ||
| Line 16: | Line 14: | ||
=== System configuration === | === System configuration === | ||
Add the following to your <code>/etc/nixos/configuration.nix</code>. This configuration is optimized for high-performance CPUs like the AMD Ryzen 7 9700X (Zen 5 architecture). | Add the following to your <code>/etc/nixos/configuration.nix</code> or your flake. This configuration is optimized for high-performance CPUs like the AMD Ryzen 7 9700X (Zen 5 architecture) running NixOS 26.05 "Yarara" or newer. | ||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"> | ||
| Line 31: | Line 29: | ||
wireplumber.enable = true; | wireplumber.enable = true; | ||
# Global low-latency defaults for native JACK clients | # Global low-latency defaults for native JACK and ALSA clients | ||
# Note: PulseAudio specific latency settings (pulse.min.req) are deprecated | |||
# in PipeWire 0.3.80+ and handled globally by default.clock.* parameters. | |||
extraConfig.pipewire."92-low-latency" = { | extraConfig.pipewire."92-low-latency" = { | ||
"context.properties" = { | "context.properties" = { | ||
"default.clock.rate" = 48000; # Fixed rate avoids resampling latency | "default.clock.rate" = 48000; # Fixed rate avoids resampling latency | ||
"default.clock.quantum" = 128; # ~5ms latency at 48kHz | "default.clock.quantum" = 128; # ~5ms latency at 48kHz | ||
"default.clock.min-quantum" = | "default.clock.min-quantum" = 32; # Allows top-tier interfaces to achieve ~1.5ms | ||
"default.clock.max-quantum" = 512; | "default.clock.max-quantum" = 512; | ||
}; | }; | ||
}; | }; | ||
# | # Disable node suspension to prevent audio pops on USB interfaces | ||
extraConfig | wireplumber.extraConfig."99-disable-suspend" = { | ||
" | "monitor.alsa.rules" = [{ | ||
" | matches = [ | ||
{ "node.name" = "~alsa_input.*"; } | |||
" | { "node.name" = "~alsa_output.*"; } | ||
}; | ]; | ||
actions = { | |||
update-props = { | |||
"session.suspend-timeout-seconds" = 0; | |||
}; | |||
}; | |||
}]; | |||
}; | }; | ||
}; | }; | ||
| Line 55: | Line 61: | ||
security.rtkit.enable = true; | security.rtkit.enable = true; | ||
# Critical: Allow unlimited memlock for real-time audio buffers | # Critical: Allow unlimited memlock and high rtprio for real-time audio buffers | ||
security.pam.loginLimits = [ | security.pam.loginLimits = [ | ||
{ domain = "@audio"; item = "memlock"; type = "-"; value = "unlimited"; } | { domain = "@audio"; item = "memlock"; type = "-"; value = "unlimited"; } | ||
{ domain = "@audio"; item = "rtprio"; type = "-"; value = " | { domain = "@audio"; item = "rtprio"; type = "-"; value = "99"; } | ||
{ domain = "@audio"; item = "nice"; type = "-"; value = "-19"; } | |||
]; | ]; | ||
| Line 64: | Line 71: | ||
# 3. Kernel and Performance Tweaks | # 3. Kernel and Performance Tweaks | ||
boot.kernelPackages = pkgs. | # Since kernel 6.12, PREEMPT_RT patches are merged into mainline, but distros | ||
# generally ship with CONFIG_PREEMPT_DYNAMIC. 'preempt=full' enables dynamic | |||
# preemption for best-effort low latency. For hard real-time requirements, | |||
# a custom kernel with CONFIG_PREEMPT_RT=y is still needed. | |||
boot.kernelPackages = pkgs.linuxPackages_latest; | |||
boot.kernelParams = [ | boot.kernelParams = [ | ||
"threadirqs" | "threadirqs" | ||
"preempt=full" | "preempt=full" | ||
"amd_pstate= | "amd_pstate=active" # Zen 4/5: active mode provides best EPP and responsiveness | ||
"usbcore.autosuspend=-1" # Prevent USB audio interface sleep | "usbcore.autosuspend=-1" # Prevent USB audio interface sleep | ||
]; | ]; | ||
# Disable power-profiles-daemon to prevent conflicts with manual cpuFreqGovernor | |||
services.power-profiles-daemon.enable = false; | |||
powerManagement.cpuFreqGovernor = "performance"; | powerManagement.cpuFreqGovernor = "performance"; | ||
| Line 79: | Line 91: | ||
# 4. Plugin Search Paths (Crucial for NixOS DAWs) | # 4. Plugin Search Paths (Crucial for NixOS DAWs) | ||
# Use | # Use environment.variables for reliable global access in Wayland/X11 sessions | ||
environment. | environment.variables = let | ||
makePluginPath = format: | makePluginPath = format: | ||
(pkgs.lib.makeSearchPath format [ | (pkgs.lib.makeSearchPath format [ | ||
| Line 90: | Line 102: | ||
LV2_PATH = makePluginPath "lv2"; | LV2_PATH = makePluginPath "lv2"; | ||
VST3_PATH = makePluginPath "vst3"; | VST3_PATH = makePluginPath "vst3"; | ||
CLAP_PATH = makePluginPath "clap"; # Modern plugin format, supported by | CLAP_PATH = makePluginPath "clap"; # Modern plugin format, supported by Bitwig/REAPER | ||
}; | }; | ||
# 5. Essential Packages | # 5. Essential Packages | ||
nixpkgs.config.allowUnfree = true; # Required for REAPER, | nixpkgs.config.allowUnfree = true; # Required for REAPER, Bitwig, etc. | ||
environment.systemPackages = with pkgs; [ | environment.systemPackages = with pkgs; [ | ||
# --- Utilities & Routing --- | # --- Utilities & Routing --- | ||
qpwgraph # Visual patchbay for PipeWire | qpwgraph # Visual patchbay for PipeWire | ||
pavucontrol # | pwvucontrol # Modern native PipeWire volume control | ||
pavucontrol # Fallback for Pro Audio profile selection | |||
pw-top # Real-time CPU usage per audio node | pw-top # Real-time CPU usage per audio node | ||
easyeffects # System-wide real-time EQ and effects | |||
# --- DAWs --- | # --- DAWs --- | ||
ardour | ardour | ||
reaper | reaper | ||
bitwig-studio # Native Linux commercial DAW, excellent CLAP support | |||
# --- Plugin Hosts --- | # --- Plugin Hosts --- | ||
| Line 115: | Line 127: | ||
# --- Plugins (LV2/CLAP) --- | # --- Plugins (LV2/CLAP) --- | ||
neural-amp-modeler-lv2 # NAM: loads .nam files from | neural-amp-modeler-lv2 # NAM: loads .nam files from tone3000.com | ||
lsp-plugins | proteus # Neural network modeling (LSTM) by GuitarML | ||
lsp-plugins # Includes latency meter, compressors, IR loader | |||
calf | calf | ||
dragonfly-reverb | dragonfly-reverb | ||
gxplugins-lv2 | gxplugins-lv2 | ||
kapitonov-plugins-pack | kapitonov-plugins-pack # Profile-based amp models (KPP) | ||
chow-centaur | chow-centaur # Klon Centaur emulation | ||
chow-phaser | chow-phaser | ||
| Line 130: | Line 143: | ||
# --- Windows VST Compatibility --- | # --- Windows VST Compatibility --- | ||
yabridge | yabridge | ||
yabridgectl | (yabridgectl.override { wine = wineWowPackages.stable; }) # Explicit Wine path | ||
wineWow64Packages.stable # Use wineWow64Packages, as wineWowPackages is deprecated | wineWow64Packages.stable # Use wineWow64Packages, as wineWowPackages is deprecated | ||
]; | ]; | ||
| Line 136: | Line 149: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
{{Note|1=For advanced users, the [https://github.com/musnix/musnix musnix] flake automates many low-level audio optimizations (such as | {{Note|1=For advanced users, the [https://github.com/musnix/musnix musnix] flake automates many low-level audio optimizations (such as <code>rtirq</code> and environment variables). In NixOS 26.05, while <code>musnix</code> kernel patches may lag behind mainline, its <code>rtirq</code> and ulimits automation remain highly useful. You can enable it with <code>musnix.enable = true;</code>.}} | ||
== Configuration == | == Configuration == | ||
| Line 146: | Line 159: | ||
# Apply PipeWire configuration changes (required after rebuild): | # Apply PipeWire configuration changes (required after rebuild): | ||
systemctl --user restart pipewire | systemctl --user restart pipewire wireplumber | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| Line 157: | Line 170: | ||
# Set your interface profile to '''Pro Audio'''. | # Set your interface profile to '''Pro Audio'''. | ||
If the "Pro Audio" profile is missing, ensure <code>pipewire-alsa</code> is installed and restart PipeWire. This profile disables software mixing and enables hardware-exclusive mode, which is critical for achieving the lowest latency. | If the "Pro Audio" profile is missing (or listed as "Digital Stereo" / "Multichannel" depending on the interface), ensure <code>pipewire-alsa</code> is installed and restart PipeWire. This profile disables software mixing and enables hardware-exclusive mode, which is critical for achieving the lowest latency. | ||
=== Dynamic buffer control === | === Dynamic buffer control === | ||
You can change latency without rebuilding the system. Note that | You can change latency without rebuilding the system. Note that this setting is temporary and will be lost after restarting PipeWire. | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
# | # Force quantum to 64 samples (pw-metadata syntax): | ||
pw- | pw-metadata -n settings 0 clock.force-quantum 64 | ||
# Verify current settings: | # Verify current settings: | ||
pw- | pw-metadata -n settings | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| Line 182: | Line 195: | ||
! Device !! Notes | ! Device !! Notes | ||
|- | |- | ||
| '''Focusrite Scarlett | | '''Focusrite Scarlett 4th Gen (Solo/2i2/4i4)''' || Plug-and-play. Requires disabling MSD Mode (hold 48V button while powering on). <code>alsa-scarlett-gui</code> works natively without extra packages. | ||
|- | |- | ||
| '''MOTU M2 / M4''' || Native ALSA kernel support | | '''Focusrite Scarlett 4th Gen (16i16/18i16/18i20)''' || Requires kernel ≥6.14, <code>fcp-support</code>, and a firmware update via <code>alsa-scarlett-gui</code>. | ||
|- | |||
| '''MOTU M2 / M4''' || Native ALSA kernel support (requires kernel ≥6.1+). Direct hardware mixer control via <code>alsamixer</code>. Exceptionally stable USB-C latency. | |||
|- | |- | ||
| '''Universal Audio Volt 276''' || Reliable USB-C class-compliant interface. | | '''Universal Audio Volt 276''' || Reliable USB-C class-compliant interface. | ||
| Line 198: | Line 213: | ||
# Use a high-quality, shielded USB cable. Audio dropouts are frequently caused by cheap cables acting as antennas for electrical interference. | # Use a high-quality, shielded USB cable. Audio dropouts are frequently caused by cheap cables acting as antennas for electrical interference. | ||
# '''Disable Bluetooth''' during live playing: <code>rfkill block bluetooth</code>. The BT audio stack can generate interrupt storms causing Xruns. | # '''Disable Bluetooth''' during live playing: <code>rfkill block bluetooth</code>. The BT audio stack can generate interrupt storms causing Xruns. | ||
# '''Limit GPU FPS''': High frame rates in 3D applications or GUI-heavy plugins (like Neural DSP) can generate PCIe interrupt storms causing DPC latency spikes. Cap your FPS or enable VSync in your compositor/games. | |||
=== Verification === | === Verification === | ||
| Line 219: | Line 235: | ||
|- | |- | ||
| '''REAPER''' || Commercial DAW, lightweight, scriptable || Uses PipeWire-JACK natively. Excellent Linux support. Unlimited trial. | | '''REAPER''' || Commercial DAW, lightweight, scriptable || Uses PipeWire-JACK natively. Excellent Linux support. Unlimited trial. | ||
|- | |||
| '''Bitwig Studio''' || Modern commercial DAW || Native Linux support. Superior CLAP format integration and modular sound design. | |||
|} | |} | ||
| Line 226: | Line 244: | ||
! Software !! Purpose !! Notes | ! Software !! Purpose !! Notes | ||
|- | |- | ||
| '''Neural Amp Modeler (NAM)''' || Loads <code>.nam</code> files — AI captures of real tube amps || No built-in GUI | | '''Neural Amp Modeler (NAM)''' || LV2 plugin. Loads <code>.nam</code> files — AI captures of real tube amps || No built-in GUI. In Carla/Ardour: look for <code>atom:Path</code> parameter and point to your <code>.nam</code> file. Models: [https://tone3000.com TONE3000] (formerly ToneHunt). | ||
|- | |||
| '''Proteus''' || LV2 plugin. Neural network modeling (LSTM) by GuitarML || Faster preset switching than NAM. Models: [https://github.com/GuitarML/Proteus GuitarML GitHub]. | |||
|- | |- | ||
| '''Kapitonov Plugins Pack (KPP)''' || Profile-based traditional amp modeling || Excellent for classic rock/metal. Lower CPU than neural nets. | | '''Kapitonov Plugins Pack (KPP)''' || Profile-based traditional amp modeling || Excellent for classic rock/metal. Lower CPU than neural nets. | ||
| Line 233: | Line 253: | ||
|} | |} | ||
{{Warning|Neural amps (NAM, KPP) only model preamp/poweramp. You must load a Cabinet IR (via LSP IR Loader or similar) to get a usable guitar tone. Without an IR, | {{Warning|Neural amps (NAM, Proteus, KPP) only model preamp/poweramp. You must load a Cabinet IR (via LSP IR Loader or similar) to get a usable guitar tone. Without an IR, the sound will be thin and unpleasant.}} | ||
=== Effects plugins === | === Effects plugins === | ||
| Line 240: | Line 260: | ||
! Plugin Pack !! Key Features | ! Plugin Pack !! Key Features | ||
|- | |- | ||
| '''LSP Plugins''' || Professional EQ, compression, gating. Includes LSP Latency Meter and LSP Impulse Response Loader (required for cabinet sims). | | '''LSP Plugins''' || Professional EQ, compression, gating. Includes LSP Latency Meter and LSP Impulse Response Loader (required for cabinet sims). Available in CLAP. | ||
|- | |- | ||
| '''Dragonfly Reverb''' || High-quality algorithmic reverb (Hall, Room, Plate). | | '''Dragonfly Reverb''' || High-quality algorithmic reverb (Hall, Room, Plate). | ||
| Line 266: | Line 286: | ||
! Tool !! Purpose | ! Tool !! Purpose | ||
|- | |- | ||
| '''yabridge + yabridgectl''' || Bridge for running Windows VST2/VST3 plugins on Linux via Wine. Essential for commercial plugins (Neural DSP, STL Tones, Amplitube). | | '''yabridge + yabridgectl''' || Bridge for running Windows VST2/VST3/CLAP plugins on Linux via Wine. Essential for commercial plugins (Neural DSP, STL Tones, Amplitube). | ||
|- | |||
| '''PipeASIO''' || [https://github.com/M0n7y5/pipeasio Experimental] ASIO-to-PipeWire driver. Bypasses JACK entirely, connecting ASIO directly to PipeWire. Early testing recommended for Windows DAWs (FL Studio, Ableton) in Proton. | |||
|} | |} | ||
| Line 278: | Line 300: | ||
=== Rocksmith 2014 === | === Rocksmith 2014 === | ||
Rocksmith 2014 runs on NixOS via Proton and PipeWire. | Rocksmith 2014 runs on NixOS via Proton and PipeWire. There are two distinct approaches depending on your preferred audio routing. '''Do not mix them''', as they are mutually exclusive. | ||
# | ==== Approach A: Declarative via nixos-rocksmith (WineASIO + JACK) ==== | ||
This method uses the [https://github.com/re1n0/nixos-rocksmith nixos-rocksmith] flake, which patches Steam to preload <code>libjack.so</code> and use <code>RS_ASIO</code> with WineASIO. | |||
# Add the module to your flake and enable it: | |||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"> | ||
programs.steam | programs.steam = { | ||
enable = true; | |||
rocksmithPatch.enable = true; | |||
}; | |||
</syntaxhighlight> | </syntaxhighlight> | ||
# '''Steam Launch Options''': | |||
<pre>LD_PRELOAD=/usr/lib32/libjack.so PIPEWIRE_LATENCY=128/48000 %command%</pre> | |||
==== Approach B: PipeASIO (Direct ASIO to PipeWire) ==== | |||
This method bypasses JACK and WineASIO entirely, connecting ASIO directly to PipeWire. It is experimental but offers excellent performance inside the Steam Runtime container. | |||
# '''Steam Launch Options''' ( | # Build and install [https://github.com/M0n7y5/pipeasio PipeASIO] under <code>$HOME/.local</code> (Proton cannot see system-wide <code>/usr/lib/wine</code>). | ||
<pre> | # Register the driver in the game's Wine prefix: | ||
<syntaxhighlight lang="bash"> | |||
env WINEPREFIX="$HOME/.steam/steam/steamapps/compatdata/221680/pfx" pipeasio-register | |||
</syntaxhighlight> | |||
# '''Steam Launch Options''' (point Proton to the local Wine libs): | |||
<pre>WINEDLLPATH=$HOME/.local/lib/wine gamemoderun %command%</pre> | |||
# Note: When using PipeASIO, buffer size is negotiated directly via the ASIO control panel inside the game or PipeASIO settings, so <code>PIPEWIRE_LATENCY</code> may not be required. | |||
{{Note|1=Rocksmith strictly requires a sample rate of 48000 Hz. Do not force 96000 Hz while playing.}} | |||
=== Measuring latency === | === Measuring latency === | ||
| Line 324: | Line 360: | ||
# 2. PipeWire buffer is set | # 2. PipeWire buffer is set | ||
pw- | pw-metadata -n settings # Should show clock.force-quantum 64 or 128 | ||
# 3. No Xruns reported | # 3. No Xruns reported (run pw-top in batch mode for clean output) | ||
pw-top | grep | pw-top -b -n 1 | grep ERR # Should show 0 or empty | ||
# 4. Pro Audio profile active | # 4. Pro Audio profile active | ||
| Line 341: | Line 377: | ||
! Symptom !! Cause & Solution | ! Symptom !! Cause & Solution | ||
|- | |- | ||
| '''Xruns (audio glitches)''' || Ensure <code>powerManagement.cpuFreqGovernor = "performance"</code> is active. Check <code>pw-top</code> for high-CPU nodes. Close browsers/heavy apps during playing. Disable Wi-Fi. As a last resort, add <code>processor.max_cstate=1</code> to <code>boot.kernelParams</code> (disables CPU sleep — | | '''Xruns (audio glitches)''' || Ensure <code>powerManagement.cpuFreqGovernor = "performance"</code> is active. Check <code>pw-top</code> for high-CPU nodes. Close browsers/heavy apps during playing. Disable Wi-Fi. As a last resort, add <code>processor.max_cstate=1</code> to <code>boot.kernelParams</code> (disables CPU sleep — results in extreme power draw and heat, use with caution). | ||
|- | |- | ||
| '''No sound''' || Check <code>qpwgraph</code> — PipeWire does not auto-connect hardware. Verify Pro Audio profile in <code>pavucontrol</code>. Run <code>sudo lsof /dev/snd/*</code> to find conflicting processes. | | '''No sound''' || Check <code>qpwgraph</code> — PipeWire does not auto-connect hardware. Verify Pro Audio profile in <code>pavucontrol</code>. Run <code>sudo lsof /dev/snd/*</code> to find conflicting processes. | ||
|- | |- | ||
| '''DAW cannot find plugins''' || Ensure <code>environment. | | '''DAW cannot find plugins''' || Ensure <code>environment.variables</code> block is applied. Log out/in after rebuild. Verify paths: <code>echo $LV2_PATH</code>. | ||
|- | |||
| '''Audio pops a few seconds after playback stops''' || WirePlumber suspends the ALSA node after 5 seconds of inactivity. Ensure <code>session.suspend-timeout-seconds = 0</code> is set in <code>wireplumber.extraConfig</code>. | |||
|- | |- | ||
| '''GPU causing audio glitches''' || Disable GPU power management. Prefer X11 over Wayland for lowest latency. | | '''GPU causing audio glitches''' || Disable GPU power management. Limit FPS in games/DAW to reduce PCIe interrupt storms (DPC latency). Prefer X11 over Wayland for lowest latency if using JUCE-based plugins that render incorrectly. | ||
|- | |- | ||
| '''Bluetooth causing Xruns''' || Disable Bluetooth stack: <code>rfkill block bluetooth</code> during live sessions. | | '''Bluetooth causing Xruns''' || Disable Bluetooth stack: <code>rfkill block bluetooth</code> during live sessions. | ||
| Line 360: | Line 398: | ||
* [https://github.com/musnix/musnix musnix] — Deep NixOS audio optimizations module | * [https://github.com/musnix/musnix musnix] — Deep NixOS audio optimizations module | ||
* [https://linuxmusicians.com/ LinuxMusicians Forum] — Community support | * [https://linuxmusicians.com/ LinuxMusicians Forum] — Community support | ||
* [https:// | * [https://tone3000.com TONE3000] — Largest library of NAM models and IRs (formerly ToneHunt) | ||
* [https://github.com/ | * [https://github.com/M0n7y5/pipeasio PipeASIO] — Experimental ASIO to PipeWire bridge for Wine/Proton | ||
* [https://codeberg.org/nizo/linux-rocksmith linux-rocksmith] — Comprehensive guide to Rocksmith on Linux | |||
[[Category:Guides]] | [[Category:Guides]] | ||
[[Category:Hardware]] | [[Category:Hardware]] | ||
[[Category:Sound]] | [[Category:Sound]] | ||