【发布时间】:2019-04-14 11:38:36
【问题描述】:
我正在尝试使用 Swift 中的 AVFoundation Text to Speech 功能说出一个自定义字符串,该字符串会根据参数发生变化。如何实现单词之间的停顿?
假设这是我的字符串:
var spokenSentence = "I like Toast with lots of Butter, but banana is nice"
如何让 TTS 在“Butter”后暂停 3 秒?
这是我关于 TTS 的代码:
var spokenSentence = "I like Toast with lots of Butter, but banana is nice"
let synth = AVSpeechSynthesizer()
var utterance = AVSpeechUtterance(string: spokenSentence)
以后
synth.speak(utterance)
在 MacOS 上的 swift 之外我听说你可以使用 [[slnc 1000]] Swift 中有没有类似的功能?
【问题讨论】:
-
我认为没有办法,我建议将此作为增强请求提交给 Apple。曾经可以让语音合成器服从各种元命令(你甚至可以让它唱歌),但现在已经不可能了。
-
你可以引入自己的延迟,比如I did here
标签: swift avfoundation text-to-speech