daily pastebin goal
95%
SHARE
TWEET

Untitled

a guest Jan 22nd, 2019 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top