gpt4 book ai didi

iphone - Objective-c iPhone 中的文字转语音

转载 作者:太空狗 更新时间:2023-10-30 03:46:16 27 4
gpt4 key购买 nike

我正在开发一个应用程序,我必须在其中播放字符串作为音频。

我正在使用 http://translate.google.com/translate_tts?tl=en&q=Hello读取字符串的 API,但速度有点慢。

objective-c 中是否有任何库可以将字符串作为音频“Text To Speech”播放。

最佳答案

查看 io7 中的类 AVSpeechUtterance 和 AVSpeechSynthesizer。基本上您可以执行以下操作。

     AVSpeechUtterance *utterance = [AVSpeechUtterance speechUtteranceWithString:text];
AVSpeechSynthesizer *syn = [[[AVSpeechSynthesizer alloc] init]autorelease];
[syn speakUtterance:utterance];

关于iphone - Objective-c iPhone 中的文字转语音,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17466474/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com