2

The quality property appears to be undefined on all of the provided voices (AVSpeechSynthesisVoice). The enum has only two cases, default, and enhanced, which have raw values 1 and 2. I notice some voices are much better than others, and I was hoping I could use this property to programmatically find the better ones. But...

extension AVSpeechSynthesisVoiceQuality: CustomStringConvertible {
    public var description: String {
        switch self {
        case .default: return "default"
        case .enhanced: return "enhanced"
        default: return "??? (rawValue=\(rawValue))"
        }
    }
}

print(AVSpeechSynthesisVoiceQuality.default)
print(AVSpeechSynthesisVoiceQuality.enhanced)
let all = AVSpeechSynthesisVoice.speechVoices()
print("\(all.count) voices")
for voice in all {
    print("\(voice.language) -> \(voice.quality)")
}

Output look like:

default
enhanced
52 voices
en-US -> ??? (rawValue=0)
it-IT -> ??? (rawValue=0)
sv-SE -> ??? (rawValue=0)
fr-CA -> ??? (rawValue=0)
es-MX -> ??? (rawValue=0)
...

Anyone know what's going on?

Rob N
  • 15,024
  • 17
  • 92
  • 165

0 Answers0