在iOS8中,AVSpeechUtterance不工作。每次我将AVSpeechSynthesizer和AVSpeechUtterance一起使用时,我都会收到"Speech initialization error: 2147483665“。同样的代码适用于IOS 7.1,我有一个非常大的文本要转换成语音,使用Google TTS不允许我一次使用超过100个字符。如何在IOS 8中实现文本到语音转换?任何帮助都将不胜感激。
发布于 2014-10-14 16:56:47
另请参阅此主题和链接的问题:AVSpeechSynthesizer iOS 8 Issues
对我来说,iOS上的TTS只能在真实设备上工作,不能在模拟器上工作。但iOS8在语音方面仍然有一些问题,上面的问题中提到了一些解决方法。
另外,请注意这一点(用户应该设置一些设置):Using AVSpeechSynthesizer/AVSpeechUtterance for Text-To-Speech will not work if SpeakSelection is not enabled in device's Accessiblity settings
发布于 2017-02-09 13:19:04
第一个导入语音
import Speech其次,为AVSpeechSynthesizer定义全局变量
let speakTalk = AVSpeechSynthesizer() 创建函数音频以将输入作为字符串
func Audio(Input : String)
{
let speakText = AVSpeechUtterance(string: "\(Input)")
speakText.rate = 0.5
speakText.pitchMultiplier = 1.7
speakTalk.speak(speakText)
}调用func Audio()
Audio(Input : "Hello")https://stackoverflow.com/questions/26353076
复制相似问题