Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import AVKit
- func saySomething(utterance: String!) {
- let synthesizer = AVSpeechSynthesizer()
- let utterance = AVSpeechUtterance(string: utterance)
- let voice = AVSpeechSynthesisVoice(language: "en-US")
- synthesizer.speak(utterance)
- utterance.voice = voice
- }
- saySomething(utterance: "Hello I am a robot")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement