fix(tts): prefer an installed voice for locale-only tags#21378
Open
criticalAY wants to merge 1 commit into
Open
fix(tts): prefer an installed voice for locale-only tags#21378criticalAY wants to merge 1 commit into
criticalAY wants to merge 1 commit into
Conversation
For a locale-only tag such as {{tts fr_FR:Front}}, voiceForTag fell
back on the first voice matching the language without checking
availability. Android can list voices flagged KEY_FEATURE_NOT_INSTALLED,
so an uninstalled voice could be chosen and fail on playback with
ERROR_NOT_INSTALLED_YET even when an installed voice for that language
was available.
The language fallback now prefers an installed voice, only settling for
an unavailable one when nothing else matches.
Assisted-by: Claude Opus 4.8 - Writing tests
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.
Note
Assisted-by: Claude Opus 4.8- Writing tests
Purpose / Description
When a card template uses a locale-only native TTS tag such as
{{tts fr_FR:Front}}(no explicitvoices=), AnkiDroid could pick a voice that is not installed and fail playback withERROR_NOT_INSTALLED_YET, even when an installed voice for that language was available. So I am fixing that in this PRFixes
Approach
See commit
How Has This Been Tested?
Unit tests and verified on Pixel 10 (reproduced the issue then build again on fix - works fine)
Learning (optional, can help others)
NA
Checklist
Please, go through these checks before submitting the PR.