Skip to content

Fix silence detection default threshold#18649

Merged
seanbudd merged 2 commits intonvaccess:masterfrom
gexgd0419:fix-silencedetect
Aug 10, 2025
Merged

Fix silence detection default threshold#18649
seanbudd merged 2 commits intonvaccess:masterfrom
gexgd0419:fix-silencedetect

Conversation

@gexgd0419
Copy link
Copy Markdown
Contributor

@gexgd0419 gexgd0419 commented Aug 8, 2025

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::defaultThreshold should 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:

  • Documentation:
    • Change log entry
    • User Documentation
    • Developer / Technical Documentation
    • Context sensitive help for GUI changes
  • Testing:
    • Unit tests
    • System (end to end) tests
    • Manual testing
  • UX of all users considered:
    • Speech
    • Braille
    • Low Vision
    • Different web browsers
    • Localization in other languages / culture than English
  • API is compatible with existing add-ons.
  • Security precautions taken.

@coderabbitai summary

@gexgd0419 gexgd0419 marked this pull request as ready for review August 8, 2025 09:36
@gexgd0419 gexgd0419 requested a review from a team as a code owner August 8, 2025 09:36
@gexgd0419 gexgd0419 requested a review from seanbudd August 8, 2025 09:36
@seanbudd seanbudd merged commit 830e02f into nvaccess:master Aug 10, 2025
30 checks passed
@gexgd0419 gexgd0419 deleted the fix-silencedetect branch August 12, 2025 02:48
@SaschaCowley SaschaCowley added this to the 2025.3 milestone Aug 18, 2025
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.

SAPI 5 Eloquence does not speak the first character in German

3 participants