I am having the same problem as Will. I have expanded his code as follows:
print("after let synthesizer")
let utterance = AVSpeechUtterance(string: "Hello, testing speech synthesis on macOS.")
print("after let utterance")
if let voice = AVSpeechSynthesisVoice(identifier: "com.apple.voice.compact.en-GB.Daniel") {
print("after let voice")
utterance.voice = voice
print("Using voice: \(voice.name), \(voice.language)")
} else {
print("Daniel voice not found on macOS.")
}
print("before synthesizer.speak")
synthesizer.speak(utterance)
print("after synthesizer.speak")
The error message "Error reading languages in for local resources" appears at the if let voice… call. Also at synthesizer.speak(utterance) there are three of these:
_-[AFPreferences languageCodeWithFallback:] No language code saved, but Assistant is enabled - returning: en-GB
I am also getting:
#FactoryInstall Unable to query results, error: 5
This is just MacOS (15.3ß), using Xcode 16.2 - I am not getting any of this for the identical code running in my iOS app.
Topic:
Media Technologies
SubTopic:
Audio
Tags: