Reputation: 354
I need to use some kind of text-to-speech tool for pronouncing multiple languages. i've tried this code:
AVSpeechUtterance *utterance = [AVSpeechUtterance speechUtteranceWithString:text];
AVSpeechSynthesizer *syn = [[[AVSpeechSynthesizer alloc] init]autorelease];
[syn speakUtterance:utterance];
Which works fine, but since i want to use multiple languages it does not seem to have this function or what? How can i choose the language?
If the above is not possible i would like to use the Google api
How can i play this
http://translate.google.com/translate_tts?tl=en&q=Hello
In my viewcontroller?
Upvotes: 0
Views: 464
Reputation: 3765
This is really simple and the definetely has the function, try the following:
utterance.voice = [AVSpeechSynthesisVoice voiceWithLanguage:@"en-gb"];
If you need to know all the languages avalible, put the following code somewhere:
NSArray* voices = [AVSpeechSynthesisVoice speechVoices];
NSLog(@"Voices: (%d) %@", voices.count, voices);
If you need further documentation on AVSpeechSynthesisVoice
, then look at the following link:
Upvotes: 1