How to programmatically use iOS voice synthesizers? (text to speech)

Starting from iOS 7, Apple provides this API. Objective-C #import <AVFoundation/AVFoundation.h> … AVSpeechUtterance *utterance = [AVSpeechUtterance speechUtteranceWithString:@”Hello World!”]; AVSpeechSynthesizer *synth = [[AVSpeechSynthesizer alloc] init]; [synth speakUtterance:utterance]; Swift import AVFoundation … let utterance = AVSpeechUtterance(string: “Hello World!”) let synth = AVSpeechSynthesizer() synth.speakUtterance(utterance)

Getting the list of voices in speechSynthesis (Web Speech API)

According to Web Speech API Errata (E11 2013-10-17), the voice list is loaded async to the page. An onvoiceschanged event is fired when they are loaded. voiceschanged: Fired when the contents of the SpeechSynthesisVoiceList, that the getVoices method will return, have changed. Examples include: server-side synthesis where the list is determined asynchronously, or when client-side … Read more