I am using Google Text To Speech Services in iOS.
I am ok in English TTS with following codes.
NSString *queryTTS = [text stringByReplacingOccurrencesOfString:@" " withString:@"+"];
NSString *linkTTS = [NSString stringWithFormat:@"http://translate.google.com/translate_tts?tl=en&q=%@",queryTTS];
NSData *dataTTS = [NSData dataWithContentsOfURL:[NSURL URLWithString:linkTTS]];
_googlePlayer = [[AVAudioPlayer alloc] initWithData:dataTTS error:nil];
[_googlePlayer play];
So i changed url address to speech thailand TTS like following link.
NSString *queryTTS = [text stringByReplacingOccurrencesOfString:@" " withString:@"+"];
NSString *linkTTS = [NSString stringWithFormat:@"http://translate.google.com/translate_tts?tl=th&q=%@",queryTTS];
NSData *dataTTS = [NSData dataWithContentsOfURL:[NSURL URLWithString:linkTTS]];
_googlePlayer = [[AVAudioPlayer alloc] initWithData:dataTTS error:nil];
[_googlePlayer play];
After I changed that link into "th"
, that google TTS services not speech my thai text.
Am I wrong in my codes?
Or If no , how can I change languages in Google Text To Speech API?
Thanks you for reading.