Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var avSpeechSynthesizer = AVSpeechSynthesizer()
- let utterance = AVSpeechUtterance(string: "Hello world")
- utterance.rate = ...
- utterance.pitchMultiplier = ...
- utterance.volume = ...
- utterance.preUtteranceDelay = ...
- utterance.postUtteranceDelay = ...
- // Common 4 operations
- avSpeechSynthesizer.speak(utterance) // Start speech
- avSpeechSynthesizer.pauseSpeaking(at: .immediate) // Pause even in the middle of a vocabulary
- avSpeechSynthesizer.pauseSpeaking(at: .word) // Pause after the current vocabulary has been voiced out completely
- avSpeechSynthesizer.stopSpeaking(at: .immediate) // Similar to the `pauseSpeaking`
- avSpeechSynthesizer.stopSpeaking(at: .word) // Similar to the `pauseSpeaking`
- avSpeechSynthesizer.continueSpeaking() // Resume a paused speech
Add Comment
Please, Sign In to add comment