Reputation: 101
All I use my project AVSpeechUtterance for text to speech when I run in a simulator is work fine but when I run in my device speech volume is very slow here my code ...
let utterance = AVSpeechUtterance(string: "Good night all")
if UserDefaults.standard.string(forKey: "LNG") == "Eng"
{
utterance.voice = AVSpeechSynthesisVoice(language: "en-US")
}
else
{
utterance.voice = AVSpeechSynthesisVoice(language: "de-DE")
}
utterance.rate = AVSpeechUtteranceDefaultSpeechRate
utterance.volume = 1
let synth = AVSpeechSynthesizer()
synth.speak(utterance)
Upvotes: 1
Views: 857