WASAPI: Track the total number of frames buffered so far rather than the duration of audio.#15745
Merged
Merged
Conversation
…the duration of audio.
seanbudd
approved these changes
Nov 6, 2023
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 #15739.
Summary of the issue:
When there are several consecutive utterances of speech such as during say all or spelling, the pauses between utterances gradually decrease over time.
Description of user facing changes
When using say all or commands which spell text, pauses between sentences or characters no longer gradually decrease over time.
Description of development approach
Previously, the WASAPI code accumulated the total duration of ms buffered so far. To do this, we converted from the number of frames sent to ms and added that to the total ms. This conversion isn't perfect, which meant we continually accumulated conversion errors. This resulted in the callbacks gradually getting ever more inaccurate (earlier) until the stream was stopped and reset.
Instead, we now accumulate the total number of frames sent. We still convert to ms, since the current playback position is time-based. However, we only convert to ms on demand, so we don't accumulate conversion errors.
Testing strategy:
Set synth to eSpeak, rate boost enabled, rate 40.
Spelled the following line of text:
Another way to detect if this issue will occur is, at the noted rate values I posted above, spell aBefore this change, the pauses between characters would get faster and faster. After this change, the pauses are consistent.
Known issues with pull request:
None.
Code Review Checklist: