为了改变声音,nsspeechsynthesizer voice Name 属性 可接受的字符串是什么?

What are the acceptable strings for nsspeechsynthesizer's voiceName property in order to change the voice?

我正在结合 Apple 文档学习教程,我正在尝试更改 NSSpeechSynthesizer 的 voiceName,但是它的初始化函数说它接受字符串,但我不确定如何在文档以查找可接受的字符串以更改语音。 Apple NSSpeechSynthesizer Initialization Documentation

您应该在系统中获得可用名称

class var availableVoices: [NSSpeechSynthesizer.VoiceName] { get }

来自Here 并通过其中任何一个

通过

获取可用语音
NSSpeechSynthesizer.availableVoices

它 returns 一个 字符串数组,表示系统上可用的每个语音的标识符。