-
Notifications
You must be signed in to change notification settings - Fork 179
Add sorting and filtering of TTS voices #663
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds filtering and sorting capabilities for TTS voices, introducing two new extension methods to help manage and organize available voices by language, region, quality, and gender.
- Adds
[TTSVoice].filterByLanguage(_:)to filter voices by language with support for both base language and region-specific filtering - Adds
[TTSVoice].sorted()to sort voices by multiple criteria: region priority, quality, gender, and name - Updates
TTSVoice.Qualityenum to includelowerandhighercases and changesnamefrom optional to non-optional
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| Sources/Navigator/TTS/TTSVoice.swift | Moves TTSVoice to dedicated file and adds filtering and sorting extension methods |
| Sources/Navigator/TTS/TTSEngine.swift | Removes TTSVoice definition (moved to separate file) |
| Sources/Shared/Toolkit/Language.swift | Adds Region struct to support region-based operations |
| Tests/NavigatorTests/TTS/TTSVoiceTests.swift | Comprehensive test suite covering filtering, sorting, and edge cases |
| CHANGELOG.md | Documents the new public API additions |
Comments suppressed due to low confidence (1)
Sources/Navigator/TTS/TTSVoice.swift:1
- The mapping from AVSpeechSynthesisVoice.quality to TTSVoice.Quality is incomplete. The new
lowerandhigherquality cases are never assigned. Consider mapping.premiumto.higherinstead of.high, and review whether.defaultshould map to.lowor.lowerinstead of.mediumfor better utilization of the new quality levels.
//
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…pact/super-compact identifiers
Added
Navigator
[TTSVoice].filterByLanguage(_:)to filter TTS voices by language and region.[TTSVoice].sorted()to sort TTS voices by region, quality, and gender.Changed
Navigator
PublicationSpeechSynthesizerAPI, as they are not a good fit to read publications.