2012-11-02 56 views
0

使用Google TTS在iPhone應用程序中開發,我發送了一些請求,然後我使用AVAudioPlayer播放音頻數據。iPhone中谷歌TTS中的問題?

我發送了一個請求作爲更多的單詞,然後數據爲空。谷歌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

上午也面臨這個問題,我得到的幫助來自這個link(該鏈接頁面的右側包含24.0 MB(下載)文件)可以behelp爲你

[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 

編碼快樂

0

谷歌TTS僅適用於短文本(在100個字符)。

因此,您必須手動分割與您的文字長度相關的文本,並將子文本提供給Google TTS。