Skip to content

Keep silent bins finite when the running norm reaches zero - #718

Open
yushuosun wants to merge 1 commit into
Rikorose:mainfrom
yushuosun:fix/zero-norm-digital-silence
Open

yushuosun wants to merge 1 commit into
Rikorose:mainfrom
yushuosun:fix/zero-norm-digital-silence

Conversation

@yushuosun

Copy link
Copy Markdown

Summary

Audio hosts that flush subnormal floats to zero can drive a silent bin's running norm to zero after sustained digital silence. Both unit-normalization layouts then divide by zero. Emit zero for that bin and keep the existing calculation for nonzero norms.

Fixes #713.

Verification

  • Added two Rust tests that start from the zero state produced after flush-to-zero. Both reproduced NaNs on the base revision. They now check a silent bin and a nonzero control in each layout.
  • All three lib.rs unit tests passed on Linux in a focused Cargo build using the upstream direct dependency versions. Formatting check passed with stable rustfmt.
  • The full plugin build and live VST3 reproduction were not run.

Copilot AI balanced review requested due to automatic review settings November 28, 2026 05:58

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

gongsearch added a commit to gongsearch/DeepFilterNet that referenced this pull request Nov 28, 2026
Fixes the two causes of upstream issue Rikorose#713 (output turns to NaN after
~78 s of digital silence when the host flushes subnormals to zero):

- The silence guard in DfTract::process never fired: on silence the model
  picks the zero mask, and that branch reset skip_counter, so it went
  0, 1, 0, 1 and the network kept running on every silent frame while the
  norm states decayed towards 0. skip_counter is now driven by the RMS
  check alone; after 5 silent frames the network is skipped (output 0,
  lsnr -15) until a signal comes back. This also saves CPU while a mic is
  muted.
- band_unit_norm / band_unit_norm_t give 0 for a bin whose running norm is
  0 instead of 0/0 = NaN (as in upstream PR Rikorose#718).

Output for audio without digital silence is bit-identical (deep-filter
CLI, with and without post filter). New tests: zero norm state for both
layouts, and 3 minutes of zeros through DfTract followed by a signal
(fails with the old skip_counter reset).

Co-Authored-By: Claude Opus 5.5 <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.

Output turns to NaN after 78 s of digital silence when flush-to-zero is on

2 participants