Guest User

Untitled

a guest
Jan 22nd, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. var avSpeechSynthesizer = AVSpeechSynthesizer()
  2. let utterance = AVSpeechUtterance(string: "Hello world")
  3. utterance.rate = ...
  4. utterance.pitchMultiplier = ...
  5. utterance.volume = ...
  6. utterance.preUtteranceDelay = ...
  7. utterance.postUtteranceDelay = ...
  8.  
  9. // Common 4 operations
  10. avSpeechSynthesizer.speak(utterance) // Start speech
  11.  
  12. avSpeechSynthesizer.pauseSpeaking(at: .immediate) // Pause even in the middle of a vocabulary
  13. avSpeechSynthesizer.pauseSpeaking(at: .word) // Pause after the current vocabulary has been voiced out completely
  14.  
  15. avSpeechSynthesizer.stopSpeaking(at: .immediate) // Similar to the `pauseSpeaking`
  16. avSpeechSynthesizer.stopSpeaking(at: .word) // Similar to the `pauseSpeaking`
  17.  
  18. avSpeechSynthesizer.continueSpeaking() // Resume a paused speech
Add Comment
Please, Sign In to add comment