Skip to content

Instantly share code, notes, and snippets.

@myrickchow32
Last active February 13, 2019 02:54
Show Gist options
  • Save myrickchow32/e8359bfdb5529b1014431aac8210ac31 to your computer and use it in GitHub Desktop.
Save myrickchow32/e8359bfdb5529b1014431aac8210ac31 to your computer and use it in GitHub Desktop.
let utterance = AVSpeechUtterance(string: "Hello world")
// Method 1: Directly by identifier
utterance.voice = AVSpeechSynthesisVoice(identifier: "com.apple.ttsbundle.Karen-compact")
// Method 2: By langauge code
utterance.voice = AVSpeechSynthesisVoice(language: "en-AU")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment