使用Google TTS在iPhone应用程序中开发,我已经发了一些请求,然后我使用AVAudioPlayer播放音频数据。
我发送了一个请求作为更多单词,然后数据为空。谷歌TTS只支持转换音频数据的小词,我想知道,请帮助我。
先谢谢
我试过了:
NSString *linkTTS = [NSString stringWithFormat:@"http://translate.google.com/translate_tts?tl=en&q=I+am+new+to+IPhone+development+I+am+working+on+Audio+player+i+have+to+show+the+current+time+and+estimated+time"];
NSData *dataTTS = [NSData dataWithContentsOfURL:[NSURL URLWithString:linkTTS]];
NSLog(@"dataTTS:%@",dataTTS);
_googlePlayer = [[AVAudioPlayer alloc] initWithData:dataTTS error:nil];
[_googlePlayer play];
答案 0 :(得分:0)
我也遇到了这个问题我得到了这个link的帮助(链接页面的右侧包含24.0 MB(下载)文件)可能是帮助你
[fliteEngine stopTalking]; //如果你想播放文字,请在你的代码中注明这一行。
[fliteEngine speakText:@"What ever you want to speech"]; // Make it talk
[fliteEngine setPitch:100.0 variance:50.0 speed:1.0]; // Change the voice properties
[fliteEngine setVoice:@"cmu_us_awb"]; // Switch to a different voice
[fliteEngine stopTalking];// ignore the last line
快乐编码
答案 1 :(得分:0)
Google TTS仅适用于短文本(不超过100个字符)。
因此,您必须手动拆分与文本长度相关的文本,并将子文本提供给Google TTS。