Add option to replace underscores in author names for TTS#1363
Add option to replace underscores in author names for TTS#1363LeMyst wants to merge 1 commit intomuxable:mainfrom
Conversation
Introduces a new setting to replace underscores with spaces in author names when generating TTS prelude. Adds a toggle in the TTS settings screen and persists the setting in the TtsModel.
There was a problem hiding this comment.
Pull request overview
This pull request adds a user-configurable option to replace underscores with spaces in author names when they are spoken by the Text-to-Speech system, improving pronunciation of usernames containing underscores.
Changes:
- Added a new boolean property
_isUnderscoreReplacementEnabledto theTtsModelwith getter/setter methods - Implemented underscore replacement logic in the
getVocalizationmethod for TwitchMessageModel author names - Added persistence support through JSON serialization/deserialization
- Added a UI toggle switch in the TTS settings screen to control this feature
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| lib/models/tts.dart | Added the _isUnderscoreReplacementEnabled property, implemented the underscore replacement logic for author names, and included the property in JSON serialization/deserialization |
| lib/screens/settings/tts.dart | Added a new SwitchListTile to allow users to toggle the underscore replacement feature |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| var author = model.author.displayName ?? model.author.login; | ||
| if (_isUnderscoreReplacementEnabled) { | ||
| author = author | ||
| .replaceAll("_", " ") | ||
| .replaceAll(RegExp(r'\s+'), ' ') | ||
| .trim(); | ||
| } |
There was a problem hiding this comment.
The underscore replacement is only applied to author names in TwitchMessageModel, but not to other event types that also use display names, such as TwitchRaidEventModel (line 169) and TwitchFollowEventModel (line 184). This creates an inconsistent user experience where some spoken names will have underscores replaced and others won't. Consider applying the same transformation to all user display names for consistency.
kevmo314
left a comment
There was a problem hiding this comment.
This seems reasonable but we should always replace underscores if it sounds better, it doesn't need to be a setting.
Maybe set it as true as default ? I don't know if there is many users that compained about this; |
This pull request adds a new feature to the Text-to-Speech (TTS) system that allows users to replace underscores in author names with spaces, improving the readability of spoken names. The change includes UI, model, and persistence updates to support this new option.
New feature: Underscore replacement in author names
_isUnderscoreReplacementEnabledproperty toTtsModel, with associated getter and setter, and included it in model serialization/deserialization to persist the setting. [1] [2] [3] [4]TtsModelto replace underscores with spaces in author names when the new setting is enabled.User interface updates
TextToSpeechScreen) to allow users to toggle the underscore replacement feature.