Skip to content

Add DFNR (DeepFilterNet3) AI noise reduction#977

Merged
ten9876 merged 1 commit into
aethersdr:mainfrom
boydsoftprez:feature/dfnr-deepfilter
Apr 8, 2026
Merged

Add DFNR (DeepFilterNet3) AI noise reduction#977
ten9876 merged 1 commit into
aethersdr:mainfrom
boydsoftprez:feature/dfnr-deepfilter

Conversation

@boydsoftprez

@boydsoftprez boydsoftprez commented Apr 7, 2026

Copy link
Copy Markdown
Collaborator

Summary

Integrates DeepFilterNet3 as a fifth client-side noise reduction option (DFNR), addressing the proposal in #970.

DeepFilterNet3 is an AI-powered speech enhancement model that offers significantly higher fidelity than RNNoise (RN2) in high-noise HF environments. It runs CPU-only with ~10ms latency at 48kHz — no GPU required.

What's included

Core DSP:

  • DeepFilterFilter class mirroring the RNNoiseFilter pattern (48kHz mono, 480-sample frames, accumulator-based I/O)
  • 5-way mutual exclusion with NR2/RN2/NR4/BNR in AudioEngine
  • Configurable attenuation limit (0–100 dB) and post-filter beta
  • Model loaded from external file (DeepFilterNet3_onnx.tar.gz, 7.7MB) — bundled in build output

UI (follows NR4 pattern exactly):

  • DFNR button in VfoWidget DSP tab (row 4) and SpectrumOverlayMenu panel
  • Right-click parameter popup with attenuation limit and post-filter beta sliders
  • DFNR tab in AetherDSP Settings dialog with meaningful tooltips
  • NR cycle shortcut extended: Off → NR → NR2 → NR4 → DFNR → Off
  • MIDI controller mapping (toggle + attenuation knob)

Build system:

  • setup-deepfilter.sh (Linux/macOS) and setup-deepfilter.ps1 (Windows) — build libdf from Rust source via cargo-c
  • CMakeLists.txt: HAVE_DFNR conditional compilation, platform-specific link deps, DLL + model post-build copy
  • Graceful fallback: DFNR disabled when library not found (same as HAVE_BNR)

CI (all platforms):

  • Rust toolchain + cargo-c + setup-deepfilter added to ci.yml, appimage.yml, macos-dmg.yml, windows-installer.yml
  • Model file bundled into AppImage (AppDir/usr/bin/), macOS app bundle (Contents/MacOS/), and Windows deploy directory

Settings persistence:

  • ClientDfnrEnabled, DfnrAttenLimit, DfnrPostFilterBeta via AppSettings
  • Band stack save/restore, session restore on launch
  • Digital/CW mode auto-disable

Comparison with existing NR methods

Feature NR2 (Spectral) RN2 (RNNoise) NR4 (Specbleach) DFNR (DeepFilter) BNR (NVIDIA)
Algorithm Ephraim-Malah MMSE Neural RNN Spectral bleach Neural deep filtering GPU neural
CPU-only Yes Yes Yes Yes No (RTX 4000+)
Latency ~11ms ~20ms ~40ms ~10ms ~50ms
Quality (high noise) Fair Good Good Excellent Excellent
Dependencies FFTW3 Bundled C libspecbleach+FFTW3f libdf (Rust) gRPC+Docker

Architecture notes

  • libdf is a Rust library with a C FFI (extern "C"). The setup scripts build it from source using cargo-c, producing:
    • Linux/macOS: static library (libdeepfilter.a) linked directly
    • Windows: DLL (deepfilter.dll) — Rust static libs have CRT init issues with MinGW
  • Model file (DeepFilterNet3_onnx.tar.gz) is loaded at runtime via QCoreApplication::applicationDirPath()
  • Pinned to DeepFilterNet commit d375b2d8 for reproducible builds

Test plan

  • Linux x86_64: CI builds clean, DFNR button visible, toggle on/off works
  • Linux aarch64: AppImage builds, DFNR functional
  • macOS Apple Silicon: DMG builds, DFNR functional
  • macOS Intel: DMG builds, DFNR functional
  • Windows: DFNR button toggles, denoising audible on noisy HF band
  • Mutual exclusion: enabling DFNR disables NR2/RN2/NR4/BNR and vice versa
  • Right-click popup: attenuation slider 0–100 dB adjusts denoising strength
  • Settings persist across restart (enable DFNR, set atten=50, restart, verify)
  • Band stack: enable on 40m, switch to 20m, back to 40m — state restored
  • TX bypass: DFNR disabled during transmit, re-enables after
  • NR cycle shortcut: cycles through Off/NR/NR2/NR4/DFNR/Off
  • Build without DFNR: -DENABLE_DFNR=OFF compiles clean, no regressions

JJ Boyd ~KG4VCF
🤖 Co-Authored with Claude Code

@boydsoftprez boydsoftprez requested a review from ten9876 as a code owner April 7, 2026 23:21
@boydsoftprez boydsoftprez force-pushed the feature/dfnr-deepfilter branch from d1b85f2 to 9240dc0 Compare April 7, 2026 23:37
@boydsoftprez boydsoftprez reopened this Apr 7, 2026
@boydsoftprez boydsoftprez force-pushed the feature/dfnr-deepfilter branch 3 times, most recently from 03583a6 to ae058b9 Compare April 8, 2026 02:46
Integrate DeepFilterNet3 as a fifth client-side noise reduction option
alongside NR2, RN2, NR4, and BNR. DeepFilterNet3 offers higher speech
fidelity than RNNoise in high-noise HF environments, runs CPU-only with
10ms latency at 48kHz.

Core:
- DeepFilterFilter class (48kHz mono, accumulator-based frame processing,
  [-1,1] float normalization, configurable attenuation limit and post-filter)
- AudioEngine: 5-way mutual exclusion, feedAudioData processing branch,
  thread-safe parameter setters, RADE/digital mode auto-disable
- Bundled libdf C API header + DeepFilterNet3 ONNX model (7.7MB)

UI:
- DFNR button in VfoWidget DSP tab and SpectrumOverlayMenu panel
- Right-click parameter popup (attenuation limit 0-100dB, post-filter beta)
- DFNR tab in AetherDSP Settings dialog with tooltips
- NR cycle keyboard shortcut extended: Off → NR → NR2 → NR4 → DFNR → Off
- MIDI controller mapping (toggle + attenuation)

Build:
- setup-deepfilter.sh/ps1 download pre-built libraries from GitHub Release
  (tagged dfnr-libs), falling back to Rust source build if unavailable
- CMakeLists.txt: HAVE_DFNR conditional, platform-specific link deps
- CI workflows simplified: no Rust toolchain needed, ~150s savings per workflow
- Dockerfile: add libssl-dev for future Rust needs

Settings: ClientDfnrEnabled, DfnrAttenLimit, DfnrPostFilterBeta persisted
via AppSettings. Band stack save/restore included.

Resolves aethersdr#970

JJ Boyd ~KG4VCF
🤖 Co-Authored with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@boydsoftprez boydsoftprez force-pushed the feature/dfnr-deepfilter branch from ae058b9 to 622d21d Compare April 8, 2026 02:54
@boydsoftprez boydsoftprez enabled auto-merge (squash) April 8, 2026 05:21
@ten9876 ten9876 merged commit e513e43 into aethersdr:main Apr 8, 2026
5 checks passed
aethersdr-agent Bot pushed a commit that referenced this pull request Apr 10, 2026
Integrate DeepFilterNet3 as a fifth client-side noise reduction option
alongside NR2, RN2, NR4, and BNR. DeepFilterNet3 offers higher speech
fidelity than RNNoise in high-noise HF environments, runs CPU-only with
10ms latency at 48kHz.

Core:
- DeepFilterFilter class (48kHz mono, accumulator-based frame processing,
  [-1,1] float normalization, configurable attenuation limit and post-filter)
- AudioEngine: 5-way mutual exclusion, feedAudioData processing branch,
  thread-safe parameter setters, RADE/digital mode auto-disable
- Bundled libdf C API header + DeepFilterNet3 ONNX model (7.7MB)

UI:
- DFNR button in VfoWidget DSP tab and SpectrumOverlayMenu panel
- Right-click parameter popup (attenuation limit 0-100dB, post-filter beta)
- DFNR tab in AetherDSP Settings dialog with tooltips
- NR cycle keyboard shortcut extended: Off → NR → NR2 → NR4 → DFNR → Off
- MIDI controller mapping (toggle + attenuation)

Build:
- setup-deepfilter.sh/ps1 download pre-built libraries from GitHub Release
  (tagged dfnr-libs), falling back to Rust source build if unavailable
- CMakeLists.txt: HAVE_DFNR conditional, platform-specific link deps
- CI workflows simplified: no Rust toolchain needed, ~150s savings per workflow
- Dockerfile: add libssl-dev for future Rust needs

Settings: ClientDfnrEnabled, DfnrAttenLimit, DfnrPostFilterBeta persisted
via AppSettings. Band stack save/restore included.

Resolves #970

JJ Boyd ~KG4VCF
🤖 Co-Authored with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants