Skip to content
fabiohlPublic

About

NAM-Plug is a CLAP plugin implementing NeuralAmpModeler-rs

Resources

Stars

3 stars

Watchers

1 watching

Forks

Latest commit

Β 

History

87 Commits

Folders and files

Repository files navigation

NAM-Plug

License Rust Format Version GUI Latency RT-Safe SIMD Models Parity

NAM-Plug is a high-performance, ultra-low latency CLAP (CLever Audio Plug-in) audio plugin for real-time Neural Amp Modeler (NAM) simulation on Linux DAWs (Bitwig Studio, REAPER, Fender Studio Pro, etc.).

Powered directly by the NeuralAmpModeler-rs neural DSP engine, NAM-Plug brings world-class guitar amplifier and pedal modeling into modern Linux music productionβ€”combining strict zero-allocation real-time safety, SIMD AVX2/FMA vectorization, sub-millisecond audio determinism, and dual-oracle bit-exact fidelity.

Whether tracking live guitar with sub-millisecond roundtrip latency or producing dense, multi-track studio sessions, NAM-Plug delivers uncompromising sonic accuracy and rock-solid stability.

🌟 Why Choose NAM-Plug?

  • Pristine Tone & Proven Parity: Validated against canonical C++ NAMCore and double-precision $f64$ oracles ($>136.4\text{ dB}$ SNR for WaveNet, $>150.3\text{ dB}$ for ConvNet).
  • Hard Real-Time Determinism: Zero heap allocations, zero locks, and zero blocking syscalls on the audio thread. No dropouts, audio glitches, or xruns.
  • Modern Linux DAW Native: Native CLAP 1.2+ implementation featuring a hardware-accelerated Slint GUI with native X11 XEmbed host panel embedding, sample-accurate automation, dynamic latency compensation (PDC), and zero-friction Flatpak extension support.

🎨 Visual Overview & Interface

NAM-Plug GUI

The hardware-accelerated Slint interface running inside a Linux DAW. Organized into five ergonomic zones:

  1. Asset Selection & Identity (Left Panel): Load .nam / .namb neural amp models in the AMP MODEL card and either .wav speaker cabinet impulse responses (IRs) or 1-in/1-out .nam / .namb neural cabinet models in the exclusive CABINET card (with selectable Peak / Preserved / Legacy IR level policy and independent ON / BYP cabinet bypass), accompanied by the SIMD badge (AVX2+FMA) and version info.
  2. Analog Gain, Gate, Calibration & Quality Stages (Center Panel): Input trim ($-20\text{ to }+20\text{ dB}$), Output level ($-40\text{ to }+20\text{ dB}$), integrated noise gate ($-90\text{ to }0\text{ dB}$, "OFF" at -90.0 dB) with selectable topology (Sil block-RMS silence gate or Mus C++-reference quadratic downward expander) and dynamic LED indicator, anti-aliasing oversampling (Off, 2Γ—, 4Γ—), activation precision (Std vs Fast), Input Calibration (CAL IN toggle + -60.0 to +60.0 dBu stepper), and Output Mode (Raw / Norm / Cal).
  3. Dual-Stage Precision Metering: Dual stereo/mono input (post-trim, pre-model) and output (post-gain) level meters with simultaneous IEC 60268-10 Type I quasi-peak ballistics, solid inner EWMA RMS cores ($\tau = 300\text{ ms}$), 2-second peak-hold bars, and independent latching IN CLIP / OUT CLIP indicators with click-to-reset.
  4. Master Bypass: Hardware toggle switch transitioning cleanly between DSP ACTIVE and BYPASS via a 64-sample click-free crossfade.
  5. Real-Time Telemetry Bar (Footer): Live status reporting sample rate (SR), buffer size (BUF), latency (LAT), channel layout (CH), DSP load percentage (% DSP with overload/XRUN alert LED and tooltip), contextual alert pill, and window backend.

⚑ Key Architectural Highlights

  • Pure Rust & Strict Real-Time Determinism: Inherits the hard real-time safety guarantees of NeuralAmpModeler-rs. The audio processing callback performs zero heap allocations, zero heap deallocations, and zero mutex locks (audited via CountingAllocator). Dropped models, IRs, and oversampling buffers retire asynchronously through a 3-tier lock-free SPSC garbage-collection cascade (SPSC queue β†’ 16-slot parking lot β†’ overflow ring buffer) with rollback guards.
  • SIMD AVX2 Vectorization & Zero-Vtable Dispatch: Enforces the x86-64-v3 (AVX2/FMA/BMI2) instruction set baseline. Compute kernels employ tap-major memory layouts and sum0..sum3 instruction-level parallelism unrolling. Static monomorphization via dispatch_simd! eliminates virtual function tables (vtables) and indirect function pointers from the audio path.
  • Dual-Oracle Numerical Parity: Formally certified against canonical C++ NAMCore ($f32$) and double-precision ($f64$) mathematical oracles across 52 baseline envelopes (defined in the core engine's docs/quality-contract_x86_zen3_laptop.json). Typical WaveNet models achieve ESR $< 2.31 \times 10^{-14}$ (SNR $> 136.4\text{ dB}$, MR-STFT $< 6.5 \times 10^{-6}$), while ConvNet achieves ESR $< 9.33 \times 10^{-16}$ (SNR $> 150.3\text{ dB}$).
  • Native CLAP 1.2+ Standard Integration: Built directly upon the clack framework, exposing a clean, translation-free CLAP implementation. Fully supports sample-accurate parameter automation across 18 host parameters, project state persistence (StateEnvelope v3 JSON serialization with SHA-256 asset verification), host latency reporting with dynamic PDC (clap_plugin_latency), 16 host extensions (audio-ports, audio-ports-config, audio-ports-config-info, audio-ports-activation, params, state, state-context, latency, track-info, remote-controls, param-indication, preset-load, render, tail, timer-support, gui), and a CLAP Preset Discovery factory supporting both Location::File and Location::Plugin.
  • Hardware-Accelerated Slint GUI with Native X11 Embedding: Declarative user interface rendered via FemtoVG / OpenGL with native X11 XEmbed host panel embedding into Bitwig Studio and REAPER, plus X11 floating and experimental Wayland floating window support. A dedicated event-loop thread polls lock-free atomic view models at 60 Hz (relaxing to 30 Hz in silence) with 0% audio thread overhead.
  • Complete Integrated Tone Pipeline: Includes a native 256-phase minimum-phase Kaiser sinc resampler ($0.7\text{–}1.3\text{ Β΅s}$ execution, $>105\text{ dB}$ stopband, 0 pre-ringing) adapting any model sample rate to host rates (44.1, 48, 96, 192 kHz), an exclusive cabinet slot supporting Uniform-Partitioned Overlap-Save (UPOLS) FFT .wav IR convolution ($1.3\text{ Β΅s}$ for 512-sample IRs) or 1-in/1-out .nam/.namb neural cabinet models with independent latency-aligned bypass, selectable Silence/Musical noise gate, input calibration/output normalization modes, a 5 Hz post-IR DC blocker, a zero-latency output safety limiter (Off/Clamp/SoftClip), polyphase half-band oversampling (2Γ—/4Γ—), and branchless crossfaded master bypass (64-sample ramp, about 1.3 ms at 48 kHz).
  • Binary .namb v2 Container Support: Loads pre-transposed binary models (Gate-Major LSTM, Interleaved-4 WaveNet) with IEEE 802.3 CRC32 integrity validation, slashing model loading and hot-swap times from $\sim 50\text{ ms}$ to $< 1\text{ ms}$.
  • Sandbox-Ready Dual-Stack Flatpak Extension: Distributed as an official Flatpak extension (org.freedesktop.LinuxAudio.Plugins.NAMPlug) targeting both 26.08 (canonical) and 25.08 (compatibility) org.freedesktop.LinuxAudio.BaseExtension branches simultaneously, providing automatic discovery in sandboxed DAWs (Fender Studio Pro, Bitwig Studio, REAPER) without compromising filesystem security.

πŸ₯Š Feature Showcase

Feature / Attribute Technical Implementation Benefit & Impact
Inference Topologies WaveNet (A1/A2), LSTM (1- & 2-layer, multi-I/O), ConvNet, Linear FIR/FFT, Sequential Comprehensive NAM model coverage with native Rust execution speed
Plugin Standard Native CLAP 1.2+ via clack-plugin & clack-extensions Zero translation layer; sample-accurate automation, dynamic PDC, and full state saving
RT Determinism Zero heap alloc/free, zero mutex locks, 3-tier lock-free GC cascade Deterministic, dropout-free audio under sub-millisecond buffer sizes (32–64 samples)
SIMD Acceleration Mandatory x86-64-v3 (AVX2/FMA) baseline; static dispatch_simd! dispatch WaveNet Standard β‰ˆ 41.8 Β΅s / LSTM 1Γ—16 β‰ˆ 6.8 Β΅s per 64-sample block (Ryzen 7 5700U)
Dual-Oracle Parity Validated against C++ NAMCore ($f32$) and double-precision $f64$ Bit-exact fidelity ($>136.4\text{ dB}$ SNR WaveNet, $>150.3\text{ dB}$ SNR ConvNet)
Native Polyphase Resampler 256 phases Γ— 64 taps Kaiser sinc resampler (minimum-phase cepstrum) Pristine multi-rate conversion (>105 dB stopband, < 0.05 dB ripple) in 0.7–1.3 Β΅s
Exclusive Cabinet Slot UPOLS FFT convolution (.wav IR) or 1Γ—1 neural cabinet (.nam/.namb); IrLevelPolicy; PARAM_CAB_BYPASS Ultra-low-overhead cabinet simulation ($1.3\text{ Β΅s}$ for 512-sample IRs) with latency-aligned bypass
Anti-Aliasing Oversampling Half-band polyphase FIR filters (Off, 2x exp., 4x exp., >100 dB stopband) Attenuates non-linear foldover; fixed-rate models shift timbre until SRI oversampling lands
Activation Precision Standard (exact Taylor minimax) vs Fast (PadΓ© polynomial approximations) User-selectable balance between floating-point precision (+89.5 dB SNR) and CPU cycles
Signal Conditioning Loudness-normalized IR policy; 5 Hz f64 DC blocker; Off/Clamp/SoftClip output limiter; smoothed gains Musical, click-free chain with explicit DC removal and safe output headroom
Graphical User Interface Slint 1.19 declarative UI (FemtoVG/OpenGL via winit) Native X11 XEmbed embedding, X11/Wayland floating fallback (Wayland experimental), 60/30 Hz dual IN/OUT VU metering
Denormal Armor Symmetric βˆ’220 dBFS dither injection + hardware MXCSR FTZ/DAZ Eliminates 10–100Γ— CPU microcode penalties during digital silence with zero net DC drift
Bypass Crossfader 64-sample crossfade ramp (about 1.3 ms at 48 kHz) with branchless FMA loop & phase compensation Smooth, pop-free transitions with zero phase cancellation
Dynamic Latency (PDC) Cold-path cached effective latency with dynamic clap_plugin_latency Instant host Plugin Delay Compensation with 0 per-block audio thread overhead
Binary .namb v2 Format Pre-transposed memory layout (Gate-Major LSTM, Interleaved-4 WaveNet) with CRC32 Reduces model loading and DAW track hot-swap time from ~50 ms to $&lt; 1\text{ ms}$
Flatpak Extension org.freedesktop.LinuxAudio.Plugins.NAMPlug (dual-stack 26.08 & 25.08) Seamless loading in sandboxed Flatpak DAWs without host filesystem holes
Release Optimization A/B ceremony (ab-opt-ceremony.sh) gating PGO / optional BOLT, codegen guard & receipt chain Empirical optimization promotion, zero-alloc/div codegen checks, and cryptographic SHA-256 certification

🧠 Supported Neural Architectures

Architecture Supported Configurations Dynamic Fallback Notes
WaveNet A1 Standard (CH=16), Lite (12), Feather (8), Nano (4) WaveNetModelDyn Dilated causal 1D convs, gated tanh/sigmoid
WaveNet A2 Full (CH=8), Lite (CH=3), Cascade WaveNetA2Dyn Headroom-optimized modern NAM architecture
LSTM 10 profiles: 1-layer (hidden 3–40), 2-layer (hidden 8–24) LstmModelDyn Pre-transposed gate-major SIMD GEMV kernels; multi-I/O
ConvNet Causal Conv1D + BatchNorm1D + activation β€” Fast feed-forward models; grouped conv & multi-I/O
Linear Direct FIR or Partitioned FFT convolution β€” Clean tone equalization & linear filters
Sequential Composite multi-stage pipeline β€” Serial composition of arbitrary supported models
Slimmable Multi-submodel bundles with runtime quality transitions β€” Adaptive compute bundles with dynamic crossfading

πŸ† Measured Audio Fidelity & Real-Time Performance

Dual-Oracle Parity & Perceptual Validation

Accuracy is strictly enforced against two co-equal reference oracles across 52 model baselines (defined in the core engine's quality-contract_x86_zen3_laptop.json):

  1. Canonical C++ NAMCore Reference ($f32$): Verifies bit-exact behavioral parity across WaveNet, LSTM, ConvNet, and Linear models.
  2. Double-Precision Reference ($f64$): Quantifies numerical ideality and eliminates floating-point rounding divergence.
Architecture / Model Error-to-Signal Ratio (ESR) Signal-to-Noise Ratio (SNR) Multi-Resolution STFT
WaveNet Standard $&lt; 2.31 \times 10^{-14}$ $&gt; 136.4\text{ dB}$ $&lt; 6.5 \times 10^{-6}$
WaveNet A2 $&lt; 2.10 \times 10^{-14}$ $&gt; 136.8\text{ dB}$ $&lt; 5.8 \times 10^{-6}$
ConvNet ReLU $&lt; 9.33 \times 10^{-16}$ $&gt; 150.3\text{ dB}$ $&lt; 1.2 \times 10^{-6}$
LSTM 1-Layer $&lt; 1.45 \times 10^{-14}$ $&gt; 138.2\text{ dB}$ $&lt; 4.1 \times 10^{-6}$

All models satisfy spectral convergence and LUFS loudness constancy invariants, ensuring identical tone and frequency response compared to reference captures.

1. Isolated DSP Engine Microbenchmarks (NeuralAmpModeler-rs)

Execution times measured per 64-sample block at 48 kHz ($1.33\text{ ms}$ real-time deadline budget) on an AMD Ryzen 7 5700U (x86-64-v3 AVX2 baseline, rustc 1.99.0):

Component / Profile Execution Time RT Budget Used Theoretical Tracks per Core
WaveNet Standard (CH=16) 41.8 Β΅s 3.1% ~31 tracks
WaveNet Lite (CH=12) 57.2 Β΅s 4.3% ~23 tracks
WaveNet Feather (CH=8) 20.1 Β΅s 1.5% ~66 tracks
WaveNet Nano (CH=4) 18.3 Β΅s 1.4% ~72 tracks
WaveNet A2 Full (CH=8) 19.8 Β΅s 1.5% ~67 tracks
WaveNet A2 Lite (CH=3) 14.0 Β΅s 1.1% ~95 tracks
LSTM 1-Layer (Hidden=16) 6.8 Β΅s 0.5% ~195 tracks
LSTM 2-Layer (Hidden=8) 7.6 Β΅s 0.6% ~175 tracks
ConvNet 9.5 Β΅s 0.7% ~140 tracks
Linear FIR (RF=4 Direct) 0.13 Β΅s 0.01% >1,000 tracks
DSP Resampler (44.1 β†’ 48 kHz) 1.3 Β΅s 0.10% >1,000 tracks
Cabinet IR Convolver (UPOLS 512) 1.3 Β΅s 0.10% >1,000 tracks
Full Pipeline Base (Model + CabSim) 42.8 Β΅s 3.2% ~31 tracks
Full Pipeline HQ (Model + CabSim + 4Γ— OS) 174.4 Β΅s 13.1% ~7 tracks

2. End-to-End CLAP Plugin Binary Certification (nam_plug.clap)

In addition to core DSP benchmarks, the distributed release artifact (~/.clap/nam_plug.clap) undergoes automated real-time certification via nam_perf_guard certify under realistic DAW host conditions (event queues, parameter smoothing, crossfading, buffer routing) using the build selected by the empirical A/B optimization ceremony (utils/ab-opt-ceremony.sh, promoting PGO / optional LLVM-BOLT only when proven):

Host Scenario / Topology Block Size p50 Latency p99 Latency Deadline Budget Budget Used (p50 / p99) Headroom Certification Status
WaveNet A1 Standard 64 samples 102.2 Β΅s 111.8 Β΅s 1.33 ms 7.7% / 8.4% 90.1% βœ… PASS (Certified)
WaveNet A1 Standard 128 samples 201.4 Β΅s 219.5 Β΅s 2.67 ms 7.6% / 8.2% 90.3% βœ… PASS (Certified)
WaveNet A2 Slimmable 64 samples 49.9 Β΅s 60.1 Β΅s 1.33 ms 3.7% / 4.5% 94.7% βœ… PASS (Certified)
LSTM 1Γ—3 64 samples 12.4 Β΅s 19.9 Β΅s 1.33 ms 0.9% / 1.5% 98.2% βœ… PASS (Certified)
CLAP Passthrough (No Model) 64 samples 2.3 Β΅s 2.4 Β΅s 1.33 ms 0.17% / 0.18% 99.8% βœ… PASS (Certified)

Tip

What This Means In Your DAW: Even under worst-case p99 spikes with a heavy WaveNet A1 amplifier model, NAM-Plug consumes less than 8.4% of a 64-sample buffer deadline ($1.33\text{ ms}$ at 48 kHz). The CLAP plugin wrapper overhead is only 2.3 Β΅s, leaving over 90% of your CPU budget free for synths, mixing consoles, and complex FX chains.


πŸŽ›οΈ Beginner's Guide & DAW Workflow

New to Neural Amp Modeler or guitar amp simulation? Here is everything you need to get up and running in minutes.

1. Understanding the Guitar Tone Signal Chain

In guitar production, an authentic recorded amp tone consists of two distinct components:

  1. The Amplifier Head (.nam / .namb file): Captures the nonlinear tube saturation, distortion harmonics, EQ tone stack, and compression of the physical guitar amp or overdrive pedal.
  2. The Speaker Cabinet (.wav Impulse Response or 1Γ—1 .nam / .namb Neural Cabinet): Captures the acoustic frequency curve, cone resonance, microphone type, and placement of the physical speaker cabinet.

Important

Pair Your Amp Model with a Cab IR! An amp model without a speaker cabinet IR will sound harsh and fizzy (like plugging an amp head directly into a PA mixer). Unless your .nam file is labeled as a "Full Rig" (which bundles both amp and cabinet), always load both a Model and a Cabinet IR.

2. Where to Find Free Community Models & IRs

  • TONE3000: Thousands of curated community captures of boutique tube amps, vintage heads, bass rigs, and overdrive pedals.
  • NeuralAmpModeler.com: The official home and model repository for the NAM ecosystem.
  • Cabinet Stage (Single Exclusive Slot): Accepts either a standard 24-bit or 32-bit float mono .wav speaker impulse response (44.1 kHz, 48 kHz, or 96 kHz) via UPOLS convolution or a 1-in/1-out neural cabinet model (.nam / .namb, at unity gain, keeping a dedicated independent bypass toggle).

3. Quick-Start Step-by-Step

[Dry Guitar DI] βž” [INPUT Gain] βž” [GATE] βž” [Neural Model (.nam)] βž” [Cab Slot (.wav | .nam/.namb)] βž” [OUTPUT Gain] βž” [DAW Track]
  1. Insert NAM-Plug: Add NAM-Plug as an audio effect on your dry guitar or bass track. Set your audio interface gain so your guitar's strongest picking hits around -18 to -12 dBFS.
  2. Load an Amp Model: Click LOAD .NAM in the AMP MODEL card and select your .nam or .namb file.
  3. Load a Cabinet (.wav or .nam/.namb): Click LOAD CAB in the CABINET card and select either a .wav speaker impulse response or a 1-in/1-out neural cabinet model (.nam / .namb) in the single exclusive slot (loading one asset atomically replaces any active cabinet asset, showing a WAV, NAM, or NAMB format badge and disambiguated parent/file.ext label, while preserving the previous cabinet on failure).
    • For .wav IRs, click the IR level policy badge (Peak / Preserved / Legacy) in the card header to choose between peak normalization (peak-normalized, default), 1:1 original WAV amplitude (preserved), or legacy C++ plugin level scaling (legacy-nam-plugin, $10^{-18/20} \times 48000 / f_s$). Neural cabinet models (.nam/.namb) ignore amp calibration and IrLevelPolicy, always running at unity gain (and add neural inference CPU/latency when active).
    • Click the cabinet ON / BYP toggle (PARAM_CAB_BYPASS) at any time to bypass only the cabinet stage with click-free 64-sample cosine crossfading and constant PDC latency.
  4. Dial in Gain Staging & Calibration:
    • Adjust INPUT ($-20\text{ to }+20\text{ dB}$, default 0.0 dB) to feed the model the right amount of drive.
    • Adjust OUTPUT ($-40\text{ to }+20\text{ dB}$, GUI default -3.0 dB, host parameter default 0.0 dB) to balance levels with your overall mix.
    • Hold Shift while dragging or scrolling any knob for 0.1Γ— fine-tuning, and double-click a knob to reset it to its default.
    • Toggle CAL IN and step the dBu reference (-60.0 to +60.0 dBu, default 12.0 dBu) to align your audio interface's 0 dBFS headroom with model metadata, and choose Out (Raw, Norm default, or Cal).
    • Watch the dual IN/OUT tricolor meters and click either IN CLIP or OUT CLIP indicator to reset it if digital clipping occurs.
  5. Set the Noise Gate: If your guitar pickups produce single-coil hum or high-gain hiss, turn the GATE knob up from -90.0 dB ("OFF" by default) until silence is reached between notes (GATE ACTIVE indicator). Use Sil (default) for CPU-skipping silence shutoff after the IR, or Mus for continuous C++-reference quadratic downward expansion applied post-model / pre-CabSim IR so cabinet impulse tails decay naturally.
  6. Choose Oversampling:
    • Off (Live Mode): Pure zero added latency, perfect for real-time tracking and monitoring.
    • 2Γ— / 4Γ— (Experimental): Attenuates non-linear aliasing foldover, but fixed-rate models shift timbre until Sample-Rate-Independent (SRI) oversampling is delivered.
  7. Select Activation Math Mode:
    • Std (Standard / Default): Exact precision Taylor minimax math (+89.5 dB SNR).
    • Fast: PadΓ© polynomial approximation, reducing CPU consumption on dense sessions.
  8. Bypass / Active: Toggle the Bypass switch at any time to audition your raw tone. Transitions use a 64-sample crossfade ramp (about 1.3 ms at 48 kHz) with no clicks or pops.

4. Reading the Real-Time Telemetry Bar (Footer)

The footer displays instantaneous DSP telemetry polled at 60 Hz (relaxing to 30 Hz in silence):

Readout What It Means Ideal Value / Behavior
SR Current host sample rate 44100 Hz, 48000 Hz, 96000 Hz
BUF Quantum block size received from DAW 64 spl, 128 spl, 256 spl
LAT Latency added by the plugin 0 spl (0.0 ms) in live mode (no IR/resampling/OS); updates dynamically for PDC
CH Negotiated audio channel layout Mono (Config 0) or Stereo (Config 1)
% DSP % of audio deadline budget consumed Typically 3% – 12%; red LED lights up if XRUN occurs
ALERT Contextual diagnostic status pill Blank in normal operation; displays fault/warning text
BACKEND Active window display backend X11 (Embedded), X11 (Floating), Wayland (Floating)

5. Metering Architecture & Ballistics

NAM-Plug features a dual-stage input and output metering system designed for precise gain-staging:

  • Input Metering (IN): Tapped post-trim / pre-model (immediately after the input gain knob and smoother, before entering the noise gate and neural model). This allows the performer to gauge the actual drive level fed into the neural network, matching the canonical C++ reference input pointer (mInputPointers).
  • Output Metering (OUT): Tapped post-gain / post-cabsim at the final stage before passing audio to the DAW host.
  • Ballistics & Visual Representation:
    • Peak Bar: Quasi-peak level with responsive exponential release (BALLISTICS_DECAY_RATE = 0.962 at 60 Hz, β‰ˆ 20 dB decay in ~1.0 s, tuned from IEC 60268-10 Type I ballistics), rendered as a semi-transparent outer bar.
    • RMS Core: Continuous energy level smoothed via a single-pole leaky EWMA integrator with $\tau = 300\text{ ms}$ (matching IPeakAvgSender ballistics), rendered as a solid high-contrast inner bar.
    • Peak Hold: 2-second (120 frames at 60 Hz) floating marker with instant attack and smooth linear drop.
    • Digital Clip Indicators: Separate, latching IN CLIP and OUT CLIP warning buttons lighting up at $\ge 0.0\text{ dBFS}$ with touch/click reset.

πŸŽ›οΈ DSP Design Boundaries & Deliberate Architectural Decisions

To maintain uncompromising real-time determinism, pristine modularity, and zero-allocation execution, certain features from legacy guitar plugins are omitted by deliberate engineering design:

  1. Omission of Integrated Tone Stack (EQ): Unlike all-in-one plugin suites, NAM-Plug deliberately omits an internal 3-band post-model tone stack (Bass/Mid/Treble). In professional digital audio workstation (DAW) workflows, tone shaping, parametric equalization, and dynamic notch filtering are best handled by dedicated, high-resolution EQ plugins (e.g., FabFilter Pro-Q, ReaEQ, or Bitwig EQ+) placed before or after NAM-Plug. Neural models captured from physical amplifiers already embody the exact tone stack settings dialed in during the capture session.
  2. Post-Cabinet DC Blocker (now included): Starting with 1.3.0 (state v3) NAM-Plug inserts a transparent 5 Hz f64 TDF-II DC blocker after the cabinet and before output calibration, enabled by default and exposed as the DC Blocker CLAP parameter. It removes speaker/room DC without audible bass loss and without consuming host PDC. Output Limit (default Off) additionally offers a zero-latency SoftClip/Clamp safety stage; true-peak look-ahead remains a NAM-Audio-Pipe-only option so the plug-in never introduces hidden latency.

πŸ› οΈ System Prerequisites

Requirement Specification Verification Command
Operating System Linux (Kernel $\ge 5.10$) uname -r
CPU Architecture x86_64 with AVX2/FMA/BMI2 (x86-64-v3 baseline); aarch64 (NEON) CI-validated lscpu
Rust Toolchain $\ge 1.99.0$ (Edition 2024) rustc --version
CLAP Host / DAW Bitwig Studio, REAPER, Fender Studio Pro, etc. Host application
System Libraries Build tools, CMake, X11, OpenGL development headers See command below

MSRV Policy: rust-version = "1.99.0" in Cargo.toml is the guaranteed public MSRV promise. The project builds and validates on stable Rust.

Install System Dependencies (Debian / Ubuntu / Pop!_OS)

sudo apt update && sudo apt install -y build-essential pkg-config cmake libgl1-mesa-dev libx11-dev libxcursor-dev libxcb1-dev libxkbcommon-dev

For running the full local lint, AppStream metadata, and headless GUI test suites (utils/lints.sh and utils/tests-long.sh), also install:

sudo apt install -y libxkbcommon-x11-dev libfontconfig1-dev binutils appstream xvfb

πŸš€ Installation & Setup

Method 1: Flatpak Plugin Extension (Recommended for Flatpak DAWs)

NAM-Plug supports a dual-stack packaging architecture targeting both 26.08 and 25.08 runtime branches simultaneously:

# For modern DAWs on runtime 26.08 (e.g., Fender Studio Pro 8):
flatpak install --user --reinstall target/dist/nam-plug-1.3.0-linux-x86_64.flatpak

# For stable DAWs on runtime 25.08 (e.g., Bitwig Studio, REAPER):
flatpak install --user --reinstall target/dist/nam-plug-1.3.0-linux-x86_64-25.08.flatpak

Both branches can coexist side by side without conflicts:

flatpak list --runtime | grep NAMPlug

Compatible DAWs automatically mount the matching branch at /app/extensions/Plugins/clap/nam_plug.clap on startup β€” no manual filesystem permissions or sandbox holes required.

To inspect the installed files per branch:

ls -la ~/.local/share/flatpak/runtime/org.freedesktop.LinuxAudio.Plugins.NAMPlug/x86_64/26.08/active/files/clap/
ls -la ~/.local/share/flatpak/runtime/org.freedesktop.LinuxAudio.Plugins.NAMPlug/x86_64/25.08/active/files/clap/

To uninstall:

flatpak uninstall --user org.freedesktop.LinuxAudio.Plugins.NAMPlug

Method 2: Direct Build from Source (cargo build)

Note

Host Memory Management: On systems with constrained RAM, configure CARGO_BUILD_JOBS in your host shell profile (e.g. ~/.bashrc) to prevent memory exhaustion during parallel codegen.

[!NOTE] Engine Dependency & Optional C++ Parity Checkout: NAM-Plug consumes NeuralAmpModeler-rs (4.1.0) directly from crates.io via Cargo.toml. No sibling checkout is needed to build or run cargo test --features testing. When running full C++ NAMCore parity tests (utils/tests-long.sh) without an external NAM_CORE_RENDER_BIN, clone the engine next to this repository at the commit pinned in variables.env (ENGINE_COMMIT):

git clone https://github.com/fabiohl/NeuralAmpModeler-rs ../NeuralAmpModeler-rs
git -C ../NeuralAmpModeler-rs checkout "$(sed -n 's/^ENGINE_COMMIT="\(.*\)"/\1/p' variables.env)"

For native DAWs installed directly on your system:

# 1. Build the release shared library
cargo build --release

# 2. Install to your local user CLAP directory
mkdir -p ~/.clap
cp target/release/libnam_plug.so ~/.clap/nam_plug.clap

To preview the GUI standalone without opening a DAW:

cargo run --bin ui_preview

Method 3: Hyper-Optimized Build (./utils/build-release.sh)

For maximum performance in live and studio environments, compile using the automated release pipeline, which follows the empirical A/B optimization ceremony (utils/ab-opt-ceremony.sh, applying PGO and optional LLVM-BOLT only when proven) and delivers canonical artifacts into target/dist/:

./utils/build-release.sh
Canonical Option Purpose
--package Generates distribution archive (.tar.zst) and dual-stack Flatpak bundles (26.08 & 25.08)
--install Only with --certify: installs the verified nam_plug.clap to ~/.clap/ and declared Flatpak bundles
--strict Enforces fail-closed mode: any optimization or verification gap aborts with exit code 1
--certify Does not compile; strictly validates and certifies canonical artifacts via receipts
-h, --help Displays command-line help screen and exits

🎚️ Host Compatibility & DAW Notes

The table below summarizes verified GUI presentation and host integration behavior across Linux host environments:

Host / Session Plugin GUI Support Notes & Operational Behavior
Bitwig Studio (X11) βœ… Embedded (XEmbed) Native X11 embedded GUI panel (default), sample-accurate automation, state save/restore, and offline bouncing.
REAPER (Native Linux, X11) βœ… Embedded (XEmbed) Native X11 embedded GUI panel (default), parameter automation, dynamic PDC, and ultra-low latency playback.
X11 Hosts in General βœ… Embedded / Floating Embedded via XEmbed or floating window, depending on host window negotiation (is_floating).
Fender Studio Pro 8.2 (Linux, Wayland) ⚠️ Generic Host Controls Plugin GUI not available (host design decision): the host exclusively requests embedded Wayland (is_floating = false), does not negotiate floating windows for CLAP plugins, and uses its native generic parameter editor. Model selection and state restore work natively via CLAP_PRESET_DISCOVERY_LOCATION_PLUGIN and clap.state.
Wayland Hosts Requesting Floating Windows πŸ§ͺ Floating Window (Experimental) Standalone floating window supported by the plugin code (is_floating = true), but classified as experimental due to the absence of a verified test host negotiating floating windows under Wayland.

Using Without a Graphical Interface

When running in a host or display server environment where the custom graphical interface is not displayed (such as Fender Studio Pro under native Wayland), NAM-Plug remains fully operational via the host's generic parameter controls and CLAP preset discovery:

  • DSP Parameter Control (18 Parameters): All continuous, discrete, and bypass parameters are exposed to the host and can be automated, adjusted, or modulated directly from the generic parameter panel:
    • Core Gain, Gate & Routing: Input Gain (-24…+24 dB), Output Gain (-48…+24 dB), Gate Active, Gate Threshold (-70 dB default), Gate Mode (Musical default), Bypass, and Active Model (read-only indicator).
    • Quality & Adaptive Compute: Adaptive Compute, Slim Override, Oversampling, Activation Precision, DC Blocker (default on) and Output Limit (default off).
    • Calibration & Cabinet Control: Calibrate Input, Input Cal Level (0.1 dBu resolution), Output Mode, IR Level Policy (LoudnessNormalized default), and Cabinet Bypass.
  • Remote-Control Pages: Hosts without the GUI get three eight-slot pages β€” Gain & Gate, Calibration & Cabinet and Quality & Protection.
  • Model Selection in Generic Hosts:
    • Place .nam or .namb model files (or symlinks) inside ~/.nam/models.
    • NAM-Plug's CLAP preset discovery provider automatically adapts to the host indexer: hosts identifying as PreSonus/Fender receive CLAP_PRESET_DISCOVERY_LOCATION_PLUGIN entries with per-file load_key metadata, whereas Bitwig Studio and other standard hosts receive CLAP_PRESET_DISCOVERY_LOCATION_FILE. Both location kinds are supported identically by clap_plugin_preset_load.
    • In Fender Studio Pro 8.2, all models in ~/.nam/models appear in the FX Browser (Effects > Fabio Lima > NAM-Plug) and in the generic editor's preset selector, and load asynchronously on selection. Adding new .nam/.namb files to ~/.nam/models is picked up automatically when reopening the host (or immediately via Plug-in Manager β†’ Update Plug-in List).
  • Session Persistence & State Restores:
    • When a DAW project (.song), track template, or host preset (.clappreset) is saved, the host serializes the full plugin state (StateEnvelope v3, including the active amp model path, basename, and 64-character SHA-256 hash).
    • Upon reloading the session or track, NAM-Plug restores the exact model instance and parameters: it first checks the recorded absolute path, and if relocated, automatically searches ~/.nam/models for a matching filename and SHA-256 checksum.
    • Full model-bearing session persistence (.song save, close, reopen, and embedded .clappreset state with populated model_path, model_basename, and model_hash) is verified in both X11 hosts and Fender Studio Pro 8.2.
  • Important Operational Boundaries:
    • No Cross-DAW State Transfer (GAP-13): Serialized device presets or saved session chunks should not be expected to transfer seamlessly across different DAW hosts.
    • Cabinet Slot Requires GUI (GAP-10): Selecting or swapping the file inside the exclusive Cabinet slot (a speaker cabinet .wav impulse response or a 1-in/1-out .nam/.namb neural cabinet model) still requires the custom graphical interface, because CLAP Preset Discovery selects the primary amp model. Sessions loaded without GUI preserve any previously serialized cabinet asset, and the independent Cabinet Bypass parameter remains fully controllable and automatable from the generic host panel.
    • Model Directory Convention (~/.nam/models): The ~/.nam/models directory is a local user storage and symlink location for model files; the plugin does not crawl arbitrary directories on the host filesystem.
    • Flatpak Environments: When running sandboxed Flatpak DAWs, ensure models and cabinet assets are stored in directories accessible within the DAW's sandbox boundary (such as the user's home directory or ~/.nam/models).

πŸ§ͺ CI & QA Automation Suite (./utils/)

The ./utils/ suite automates formatting, static analysis, parity verification, and release certification:

Script Purpose & Scope
utils/lints.sh Static Analysis Gate: Runs cargo fmt, cargo check matrix, strict clippy, bidirectional cross-target clippy, doc, SPDX headers, RT allocation scan, AppStream validation, and script budgets (~8s warm).
utils/tests-quick.sh Agile QA Suite: Fast test run (≀ 5 min budget) covering unit/integration tests and real-time allocation heap audit (heap-audit).
utils/tests-long.sh Pre-Release Audit: Heavy stress testing (GC model swaps, off-RT drain, RT priority/latency, Xvfb GUI). Supports --strict, --artifact, and --only.
utils/ab-opt-ceremony.sh A/B Optimization Ceremony: Empirical performance comparison (plain vs. pgo vs. pgo+bolt) on an isolated core prior to canonical build.
utils/build-release.sh Release Pipeline & Certification: Compiles release artifacts (target/dist/), packages bundles, and certifies canonical receipts (--certify).
utils/verify_rt_codegen.sh Static Codegen Guard: Disassembles the CLAP .so and asserts zero malloc/free, zero div/idiv, and bounded TLS access.
utils/miri-audit.sh Optional UB/Aliasing Audit: Runs cargo +nightly miri over retired_box, GuiHostBridge, and quiescence teardown protocols.
utils/mod-update.sh Dependency Maintenance: Manual toolchain and Cargo dependency upgrade utility.

Script Contract & Release Chain

All automation scripts adhere to a unified execution contract (Class A interactive, Class B decoupled audit, Class C build, Class D manual tool) with deterministic PHASE: and RESULT: output streams.

The official release sequence strictly decouples compilation from certification:

# 1. Run the A/B optimization ceremony (Plain vs. PGO vs. PGO+BOLT)
./utils/ab-opt-ceremony.sh --runs 3

# 2. Build canonical release artifact (nam_plug.clap) and packages into target/dist/
./utils/build-release.sh --strict --package

# 3. Audit the canonical artifact under heavy stress
./utils/tests-long.sh --strict --artifact

# 4. Certify release evidence atomically without recompilation and install
./utils/build-release.sh --strict --certify --install

For full details on script classes, exit codes, interface variables, and measured execution budgets, see docs/testing.md.


πŸ“š Architectural & Technical Documentation

For in-depth architectural specifications and engineering guides, consult the docs/ directory and core engine references:

Document Description
CHANGELOG.md Release history, version notes, and architectural milestones
docs/architecture.md Full CLAP architecture, SPSC GC thread model, Slint GUI lifecycle, and lock-free state synchronization
docs/architecture.md#21-link-time-symbol-hardening--elf-interposition-defense Link-time ELF symbol hardening and dynamic linker interposition defense (.cargo/hide-libm-shadow.map)
docs/architecture.md#12-host-vs-plugin-real-time-boundary--rt-hardening-delegation Real-time boundary demarcation: process-level hardening delegation vs. local plugin safety
docs/architecture.md#105-appstream-catalog-dynamics--bundle-semantics AppStream catalog indexing, Flatpak bundle semantics, and diagnostic invariants
docs/testing.md Test suite structure, host-harness verification phases, and CLAP test policies
docs/functional-tests.md Functional test matrix, DAW verification procedures, and release certification checklists
NeuralAmpModeler-rs: Architecture Core engine DSP architecture, SIMD kernels, memory layout, and resampler design
NeuralAmpModeler-rs: Audio Fidelity Map DSP decision matrix, frequency response analysis, and quality modes (Live vs HQ)
NeuralAmpModeler-rs: Libm Postmortem In-depth postmortem on ELF libm symbol interposition hang investigation

🀝 Contributing

We welcome community contributions, bug reports, and feedback!

  • Test in Your DAW: Try NAM-Plug in your favorite Linux DAW (Bitwig Studio, REAPER, Fender Studio Pro, etc.) with different buffer sizes (32, 64, 128, 256) and sample rates.
  • Model & IR Compatibility: Test your favorite .nam models and speaker IRs, and share your experience or benchmarks.
  • Issue Reporting: Submit detailed bug reports, questions, or feature requests via GitHub Issues.

πŸ™ Credits & Acknowledgments

  • Steven Atkinson β€” Creator of Neural Amp Modeler (NAM) for pioneering deep learning guitar amplifier modeling and generously open-sourcing the ecosystem.
  • Clack Framework & CLAP Community β€” For providing the Rust clack library and spearheading the open, modern CLever Audio Plug-in standard.
  • Slint Team & Community β€” For the declarative GUI framework and high-performance FemtoVG/OpenGL renderer.

βš–οΈ License & AI Transparency

AI Transparency Note

The system architecture, real-time safety guarantees, CLAP state management, DSP pipeline design, and GUI implementation represent the creative and technical direction of the author (FΓ‘bio Henrique de Lima Silva). Implementation and iterative development were accelerated through human-directed AI pair programming within Google Antigravity IDE.

License

This project is licensed under the GNU General Public License v3.0 or later (GPL-3.0-or-later). See LICENSE.txt for details. Third-party attribution for the Apache-2.0 NeuralAmpModeler-rs engine is in NOTICE, which is included in the distributed tarball and Flatpak bundle.

About

NAM-Plug is a CLAP plugin implementing NeuralAmpModeler-rs

Resources

Stars

3 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages