Created
November 1, 2022 10:17
-
-
Save wizard1066/8d1c73fef483f180959ae3a2c4254185 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class speaking: NSObject, AVSpeechSynthesizerDelegate { | |
var synth:AVSpeechSynthesizer! | |
override init() { | |
super.init() | |
synth = AVSpeechSynthesizer() | |
} | |
func speaker(words:[String]) { | |
for word in words { | |
let utterance = AVSpeechUtterance(string: word) | |
utterance.voice = AVSpeechSynthesisVoice(language: "en-US") | |
synth.speak(utterance) | |
synth.delegate = self | |
} | |
} | |
func speechSynthesizer(_ synthesizer: AVSpeechSynthesizer, | |
didFinish utterance: AVSpeechUtterance) { | |
print("fini") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment