0

这让我发疯了,所以我想我会在这里记录答案。

要选择一种声音,你给 -[NSSpeechSynthesizer initWithVoice] 反向 DNS 格式的标识符,例如 com.apple.speech.synthesis.voice.Agnes 但是如果用户下载了一个,比如 Paolo,你就不能得到它一样的方法。

4

1 回答 1

0

答案是 Apple 将其命名为“voice.premium”,因此您可以通过 com.apple.speech.synthesis.voice.paolo.premium 访问 Paolo。因此,即使我得到了 [NSSpeechSynthesizer availableVoices] 的列表,我也只打印了最后一个单词,并没有注意到列表中添加了溢价。要在avalabVoices 中获取voiceIdentifier 的真实可打印名称(而不是查看最后一个单词),请使用:

[[NSSpeechSynthesizer attributesForVoice:voiceIdentifier] 
    valueForKey: NSVoiceName] 
于 2012-05-22T00:15:47.897 回答