dilluns, 20 de gener del 2014

New features of iOS 7: multilanguage text to speech




Now you can make your app speech !
 iOS7 introduces the classes AVSpeechSynthesizer and AVSpeechUtteranceUsing this two classes to provide speech synsthesis on your app is very easy. See the following code:


AVSpeechSynthesizer *synthesizer = [[AVSpeechSynthesizer alloc] init];
AVSpeechUtterance *utterance = 
  [AVSpeechUtterance speechUtteranceWithString:@"Wow, I have such a nice voice!"];
utterance.rate = AVSpeechUtteranceMaximumSpeechRate / 4.0f;
utterance.voice = [AVSpeechSynthesisVoice voiceWithLanguage:@"en-US"]; // defaults to your system language
[synthesizer speakUtterance:utterance];


That is! Only takes five lines of code to add speech to your app.


Cap comentari:

Publica un comentari a l'entrada