Fix silence detection default threshold#18649
Merged
seanbudd merged 2 commits intonvaccess:masterfrom Aug 10, 2025
Merged
Conversation
8734f87 to
ccccdf6
Compare
seanbudd
approved these changes
Aug 10, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Link to issue number:
Fixes #18003.
Summary of the issue:
The default threshold values for signed integer types are incorrect, becoming twice as large, causing more parts to be trimmed than expected.
Description of user facing changes:
The excessive trimming will be fixed.
Description of developer facing changes:
None.
Description of development approach:
WaveFormat::defaultThresholdshould use 1 / 2^10 or 0.0009765625 as the threshold value for all types.The current implementation handles floating points and unsigned integers correctly, but fails to differentiate the signedness, so signed integer types will have a threshold value that's twice as large.
The solution is to replace the case-by-case implementation to a more general and correct
max() / (1 << 10).Testing strategy:
I wrote a C++ program to run the silence detection algorithm on the user-provided wave data. Now the algorithm detects a consistent duration of silence for 16-bit, 24-bit, and 32-bit float formats.
Known issues with pull request:
Code Review Checklist:
@coderabbitai summary