Noise suppression: DeepFilterNet runs, and says why when it cannot (#868) #877

Closed
charles wants to merge 0 commits from fix-868-deepfilternet-start into textchat
Owner

Closes #868

Cause

The native client never had DeepFilterNet. NoiseSuppressionBackend::DeepFilter resolved to RNNoise (settings.rs resolve), and the settings page printed the fixed text "DeepFilterNet could not start. Using RNNoise instead." for every backend except None and RNNoise (processing.rs, based on is_implemented()). Nothing was ever tried, so nothing could fail and nothing was logged. It was not a packaging, path, or sample-rate problem.

Reproduced in the packaged build: I extracted the nightly Flaxative-2026.1118.373-linux-x86_64.AppImage with --appimage-extract. Its usr/bin/flaxative contains no model (DeepFilterNet3_onnx/enc.onnx not present) and no inference code. The notice string is the only DeepFilterNet text in it.

Fix

  • third_party/deep_filter: DeepFilterNet's libDF 0.5.6 (crates.io stops at 0.2.5), trimmed to its tract (pure-Rust ONNX) inference. It is a path dependency, not a member. The DFN3 model is compiled in, and it is the same file the original ships (SHA-256 c94d91f7…). It is moved from tract 0.19 to 0.23.10, because 0.19 fails cargo deny: RUSTSEC-2026-0217 in tract-nnef, anymap2 unmaintained, and psm's licence. PATCHES.md lists every change. The first commit holds only the upstream files.
  • fluxer-audio: adds Denoiser::DeepFilter, using the original's settings (30 dB attenuation limit, df threshold 30 dB, 60 Hz high-pass, input ×10 / output ×0.1, 8 warm-up frames, 3 broken frames before giving up).
    • It loads and runs on a thread of its own, because tract's state is not Send. RNNoise stands in while it loads and after a failure.
    • DenoiseStatus / EngineEvent::Denoise report what runs and why.
    • Failure reasons are written in plain words: the model could not be read, the network could not be set up, the format does not match, it crashed, it is too slow, or it produced broken output.
  • fluxer-core: adds Denoise::DeepFilter, AudioEvent::Denoise(DenoiseStatus) and Voice::denoise_status.
  • fluxer-ui: the notice now follows the engine.
    • While loading: "Using RNNoise until DeepFilterNet is ready." (the original's text).
    • On failure: "DeepFilterNet could not start: . Using RNNoise instead."
    • While DeepFilterNet runs: nothing.
    • Backends the client does not have keep the original's wording, so no goldens change.
  • App:
    • Logs at INFO voice: noise suppression: <backend> in use / … is loading, RNNoise in use until it is ready.
    • Logs at WARN voice: noise suppression: DeepFilterNet could not start: <reason>; RNNoise in use instead.
    • New --check-noise-suppression: runs DeepFilterNet through the capture chain on white noise with no sound device and no window, then exits 0 or 1.
  • xtask package:
    • Fails unless the release binary contains the model byte for byte (both targets).
    • Runs --check-noise-suppression on the finished AppImage (extract-and-run) and on the Windows app folder's exe.
    • xtask/tests/package.rs checks both packages (appimage_carries_and_starts_deep_filter, windows_exe_carries_and_starts_deep_filter).
  • Dev/test profiles: tract, ndarray and rustfft are built at opt-level 3, because unoptimised tract is too slow for 10 ms frames.

Verification

  • Packaged build (cargo xtask package --target linux, through the packaging test): Flaxative-2026.1111.0-linux-x86_64.AppImage --check-noise-suppression →
    noise suppression: DeepFilterNet ok: started in 79 ms, 88.081µs per 10 ms frame, white noise lowered by 30.0 dB (exit 0).
    The 2026.1118.373 nightly rejects the flag and has no model.
  • Tests:
    • fluxer-audio/tests/deep_filter.rs: model compiled in; mono starts and lowers white noise by 30 dB; a tone survives; stereo frames; a broken model says why; the chain runs RNNoise until DeepFilterNet is ready; a loader failure falls back to RNNoise with its reason.
    • audio_rt::tests::noise_suppression_status_is_logged: INFO/WARN lines and the store event.
    • audio_rt::tests::deep_filter_check_passes.
    • fluxer-ui deep_filter_notice_says_why_it_could_not_start.
    • fluxer-core the_engine_s_noise_suppression_status_is_kept.
    • xtask deep_filter_model_is_the_original_s, contains_finds_a_slice_anywhere.
    • Packaging test appimage_carries_and_starts_deep_filter.
  • Gate: FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci → ==> xtask ci: all steps passed (fmt, clippy, deny, tests, vendored tests, screenshots).

Not verified here

  • Windows (it cannot be run here):
    • tract 0.23 building with MSVC.
    • The model being in flaxative.exe. xtask package checks it, as it does on Linux.
    • --check-noise-suppression from the app folder on the runner. A GUI-subsystem exe writes through output_to_terminal, like --debug-info.
    • The Windows CI run of this PR will show these.
  • Original issue's machine: a live call on the reporter's machine (48 kHz stereo mic). Capture is downmixed to 48 kHz mono before the chain whenever noise suppression is on, so the device's layout does not reach DeepFilterNet.

Size

The release binary grows by about 28 MB (105 → 133 MB): 8 MB of model plus tract.

🤖 Generated with Claude Code

Closes #868 ## Cause The native client never had DeepFilterNet. `NoiseSuppressionBackend::DeepFilter` resolved to RNNoise (`settings.rs` `resolve`), and the settings page printed the fixed text "DeepFilterNet could not start. Using RNNoise instead." for every backend except None and RNNoise (`processing.rs`, based on `is_implemented()`). Nothing was ever tried, so nothing could fail and nothing was logged. It was not a packaging, path, or sample-rate problem. **Reproduced in the packaged build:** I extracted the nightly `Flaxative-2026.1118.373-linux-x86_64.AppImage` with `--appimage-extract`. Its `usr/bin/flaxative` contains no model (`DeepFilterNet3_onnx`/`enc.onnx` not present) and no inference code. The notice string is the only DeepFilterNet text in it. ## Fix - **`third_party/deep_filter`**: DeepFilterNet's `libDF` 0.5.6 (crates.io stops at 0.2.5), trimmed to its tract (pure-Rust ONNX) inference. It is a path dependency, not a member. The DFN3 model is compiled in, and it is the same file the original ships (SHA-256 `c94d91f7…`). It is moved from tract 0.19 to **0.23.10**, because 0.19 fails `cargo deny`: RUSTSEC-2026-0217 in tract-nnef, `anymap2` unmaintained, and `psm`'s licence. `PATCHES.md` lists every change. The first commit holds only the upstream files. - **fluxer-audio**: adds `Denoiser::DeepFilter`, using the original's settings (30 dB attenuation limit, df threshold 30 dB, 60 Hz high-pass, input ×10 / output ×0.1, 8 warm-up frames, 3 broken frames before giving up). - It loads and runs on a thread of its own, because tract's state is not `Send`. RNNoise stands in while it loads and after a failure. - `DenoiseStatus` / `EngineEvent::Denoise` report what runs and why. - Failure reasons are written in plain words: the model could not be read, the network could not be set up, the format does not match, it crashed, it is too slow, or it produced broken output. - **fluxer-core**: adds `Denoise::DeepFilter`, `AudioEvent::Denoise(DenoiseStatus)` and `Voice::denoise_status`. - **fluxer-ui**: the notice now follows the engine. - While loading: "Using RNNoise until DeepFilterNet is ready." (the original's text). - On failure: "DeepFilterNet could not start: <why>. Using RNNoise instead." - While DeepFilterNet runs: nothing. - Backends the client does not have keep the original's wording, so no goldens change. - **App**: - Logs at INFO `voice: noise suppression: <backend> in use` / `… is loading, RNNoise in use until it is ready`. - Logs at WARN `voice: noise suppression: DeepFilterNet could not start: <reason>; RNNoise in use instead`. - New `--check-noise-suppression`: runs DeepFilterNet through the capture chain on white noise with no sound device and no window, then exits 0 or 1. - **`xtask package`**: - Fails unless the release binary contains the model byte for byte (both targets). - Runs `--check-noise-suppression` on the finished AppImage (extract-and-run) and on the Windows app folder's exe. - `xtask/tests/package.rs` checks both packages (`appimage_carries_and_starts_deep_filter`, `windows_exe_carries_and_starts_deep_filter`). - **Dev/test profiles**: tract, ndarray and rustfft are built at opt-level 3, because unoptimised tract is too slow for 10 ms frames. ## Verification - **Packaged build** (`cargo xtask package --target linux`, through the packaging test): `Flaxative-2026.1111.0-linux-x86_64.AppImage --check-noise-suppression` → `noise suppression: DeepFilterNet ok: started in 79 ms, 88.081µs per 10 ms frame, white noise lowered by 30.0 dB` (exit 0). The 2026.1118.373 nightly rejects the flag and has no model. - **Tests**: - `fluxer-audio/tests/deep_filter.rs`: model compiled in; mono starts and lowers white noise by 30 dB; a tone survives; stereo frames; a broken model says why; the chain runs RNNoise until DeepFilterNet is ready; a loader failure falls back to RNNoise with its reason. - `audio_rt::tests::noise_suppression_status_is_logged`: INFO/WARN lines and the store event. - `audio_rt::tests::deep_filter_check_passes`. - `fluxer-ui` `deep_filter_notice_says_why_it_could_not_start`. - `fluxer-core` `the_engine_s_noise_suppression_status_is_kept`. - xtask `deep_filter_model_is_the_original_s`, `contains_finds_a_slice_anywhere`. - Packaging test `appimage_carries_and_starts_deep_filter`. - **Gate**: `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` → `==> xtask ci: all steps passed` (fmt, clippy, deny, tests, vendored tests, screenshots). ## Not verified here - **Windows** (it cannot be run here): - tract 0.23 building with MSVC. - The model being in `flaxative.exe`. `xtask package` checks it, as it does on Linux. - `--check-noise-suppression` from the app folder on the runner. A GUI-subsystem exe writes through `output_to_terminal`, like `--debug-info`. - The Windows CI run of this PR will show these. - **Original issue's machine**: a live call on the reporter's machine (48 kHz stereo mic). Capture is downmixed to 48 kHz mono before the chain whenever noise suppression is on, so the device's layout does not reach DeepFilterNet. ## Size The release binary grows by about 28 MB (105 → 133 MB): 8 MB of model plus tract. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Upstream files only (Rikorose/DeepFilterNet tag v0.5.6, libDF/ and
models/DeepFilterNet3_onnx.tar.gz), so the next commit shows the changes
PATCHES.md lists.

Refs #868

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Cause: the native client never had DeepFilterNet. NoiseSuppressionBackend::DeepFilter
resolved to RNNoise and the settings page showed the fixed text "DeepFilterNet could not
start. Using RNNoise instead." for every backend other than None and RNNoise, so nothing
was ever tried, failed or logged. The nightly AppImage (2026.1118.373) contains no model
and no inference code.

- third_party/deep_filter: libDF 0.5.6 (tract inference only) with the DFN3 model compiled
  in, the file the original ships (same SHA-256). Path dependency; PATCHES.md.
- fluxer-audio: Denoiser::DeepFilter with the original's settings (30 dB limit, df thresh
  30 dB, 60 Hz high-pass, x10 in / x0.1 out). It loads and runs on its own thread (tract
  state is not Send); RNNoise stands in while it loads and when it fails;
  DenoiseStatus / EngineEvent::Denoise say what runs and why.
- fluxer-core: Denoise::DeepFilter, AudioEvent::Denoise, Voice::denoise_status.
- fluxer-ui: the notice follows the engine: "Using RNNoise until DeepFilterNet is ready.",
  "DeepFilterNet could not start: <why>. Using RNNoise instead.", nothing while it runs.
- app: logs the backend in use at INFO and why one could not start at WARN;
  --check-noise-suppression runs DeepFilterNet through the chain on a test signal.
- xtask package: checks the binary contains the model and runs --check-noise-suppression
  on the AppImage and on the Windows app folder; the packaging test checks both.
- Dev/test profiles optimise tract (too slow unoptimised for 10 ms frames).

Closes #868

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Refs #868

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tract 0.19's tract-nnef has RUSTSEC-2026-0217, and its build brings liquid
(anymap2 unmaintained) and psm (ar_archive_writer, Apache-2.0 WITH
LLVM-exception). 0.23.10 has none of them and shares one ndarray with the
API. The API changes are listed in PATCHES.md; same graph and output
(tests: 30 dB on white noise, tone kept).

Refs #868

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Author
Owner

Merged into textchat by hand (the merge API returns 405); the commits are in the branch.

Merged into `textchat` by hand (the merge API returns 405); the commits are in the branch.
charles closed this pull request 2026-11-18 07:43:53 +00:00
charles referenced this pull request from a commit 2026-11-18 07:45:41 +00:00

Pull request closed

Sign in to join this conversation.
No description provided.