iOS AVSpeechSynthesizer 是否支持嵌入式语音命令

Does iOS AVSpeechSynthesizer support Embedded Speech Commands

Mac OS 语音合成器有一组嵌入式命令,可让您执行更改音高、语速、强调程度等操作。例如,您可以使用

That is [[emph +]]not[[emph -]] my dog!

在短语

中强调单词 "not"

That is not my dog!

iOS 语音合成器是否有这样的支持?看起来没有,但我希望有人知道这样做的方法。

作为后续问题,有没有办法对给定区域设置的 "Stock" 语音进行全局更改?”在 Siri 的设置中,您可以 select 语言和国家以及性别。然而,AVSpeechSynthesizer 似乎只为每个 language/country 提供一个单一的半随机性别。(例如,en-US 的声音是女性,en-GB 是男性,en -AU 是女性,没有明显的方法可以改变它。)

我同意这似乎不可能。 From the docs,Apple 似乎打算让您创建单独的话语并手动调整 pitch/rate:

Because an utterance can control speech parameters, you can split text into sections that require different parameters. For example, you can emphasize a sentence by increasing the pitch and decreasing the rate of that utterance relative to others, or you can introduce pauses between sentences by putting each one into an utterance with a leading or trailing delay. Because the speech synthesizer sends messages to its delegate as it starts or finishes speaking an utterance, you can create an utterance for each meaningful unit in a longer text in order to be notified as its speech progresses.

我正在考虑为 AVSpeechUtterance 创建一个类别扩展来解析嵌入式命令(如您的示例所示)并自动创建单独的话语。如果其他人已经这样做了,或者想提供帮助,请告诉我。我会在这里更新。