Repository navigation
Conversation
Keep the opt-in spacing behavior tested on the Oppo with Google TTS and Vocalizer Tessa. Align the setting summary with the adjacent letters, currency symbols and numeric punctuation it separates. Move this feature's own helper and tests to Kotlin without changing the algorithm, add preference and engine-submission tests, and retain all original regression cases. Leave Google's Java files unchanged. Native digits spans worked in the standalone Google test but did not reliably give individual digits with the tested Tessa setup. Spacing was more predictable in those tests; neither approach promises identical pronunciation across engines, punctuation settings or voices.
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.
Summary
Implements the Speak numbers as digits feature discussed in #418.
The feature adds an optional setting under Verbosity, disabled by default, allowing consecutive digits to be spoken individually rather than as whole numbers.
For example,
283482is prepared for speech as2 8 3 4 8 2.Existing digit groupings are preserved. The transformation affects only speech; the original text, copied content and accessibility navigation remain unchanged.
Implementation
Following Quin's suggestion in #418, I investigated Android's
TtsSpan.DigitsBuilder.Testing with Vocalizer Tessa showed that this approach did not produce the desired digit-by-digit pronunciation. However, inserting ordinary spaces between digits worked.
The implementation therefore prepares a speech-only representation while preserving the original text.
Because inserting spaces changes text length, the implementation also handles speech-position mapping, chunking, existing text spans and pause/resume behaviour.
The feature is disabled by default, preserving existing speech behaviour.
Testing
Tested on:
The feature successfully reads numbers as individual digits when enabled and returns to normal number pronunciation when disabled.
The corrected APK was installed and tested on the physical device.
Automated verification:
Known limitations
Punctuation pronunciation depends partly on the speech synthesizer. With Vocalizer Tessa, punctuation such as commas and decimal points required Vocalizer's own punctuation-processing option to be enabled before being announced.
If an app-supplied speech replacement crosses a speech-chunk or resume boundary, the incomplete replacement is discarded for that portion, allowing the visible text to be spoken instead.
Setting placement and quick access
In issue #418, I originally proposed implementing this as a reading control so users could toggle digit reading quickly using the existing navigation gestures.
The current implementation places the option under Verbosity instead. After testing it, I'm comfortable with that location, although switching the feature on or off requires navigating through Settings.
For time-sensitive situations such as entering OTPs, a quicker toggle would be useful.
I'd appreciate your thoughts on whether the current placement is appropriate or whether the feature would be better implemented as a reading control. I'm happy to follow your preference on this.
Feedback welcome
I'm not entirely convinced that inserting spaces is the best possible approach, and I suspect there may be a cleaner way to achieve the same result.
However, this is an approach I've found that works with my speech synthesizer.
I'd particularly appreciate feedback on whether the speech transformation and its handling of offsets and spans fit appropriately within BackTalk's architecture.
I'm very open to suggestions for a simpler or more suitable implementation.