是否可以使用增强的/高质量的声音(美国的Alex)用语音合成器?我已经下载了声音,但没有办法告诉合成器使用它,而不是默认的声音。
由于语音通常由BCP-47代码选择,而美国英语只有on,因此似乎无法进一步区分语音。我是不是遗漏了什么?(有人可能会认为苹果可能会考虑使用不同的方言,但我没有看到这一点)。
蒂娅。
发布于 2016-11-07 17:52:11
是的,可以从我的系统上可用的两个选项中选择,如下所示:
class Speak {
let voices = AVSpeechSynthesisVoice.speechVoices()
let voiceSynth = AVSpeechSynthesizer()
var voiceToUse: AVSpeechSynthesisVoice?
init(){
for voice in voices {
if voice.name == "Samantha (Enhanced)" && voice.quality == .enhanced {
voiceToUse = voice
}
}
}
func sayThis(_ phrase: String){
let utterance = AVSpeechUtterance(string: phrase)
utterance.voice = voiceToUse
utterance.rate = 0.5
voiceSynth.speak(utterance)
}
}然后,在您的应用程序中的某个位置,执行以下操作:
let voice = Speak()
voice.sayThis("I'm speaking better Seppo, now!")发布于 2016-10-20 18:11:44
这是iOS以前版本中的一个错误,使用合成器的应用程序没有使用增强的声音。此错误已在iOS10中修复。iOS10现在使用增强的声音。
https://stackoverflow.com/questions/31361645
复制相似问题