System.Speech 选项中未显示已安装的文本转语音语音,Windows 10 Powershell

Installed Text-To-Speech Voices Not Showing Up in System.Speech Options, Windows 10 Powershell

我在 Windows 10 Powershell 中使用 System.Speech 对象进行 Text to Speech 项目,我正在尝试安装新的声音。

我按照以下说明安装了新的系统语音:

On any edition of Windows 10, click Start > Settings, and then follow these steps:

Select the Start button, then select Settings > Time & Language > Region & Language.

Select Add a language and choose the language you want from the list. Only languages listed in the table below will have Text-to-Speech capabilities.

After the new language has been installed (this may take a few moments), select it in the Region & Language list, and then select Options.

Under Language options > Speech, select Download.

Restart your computer. The Text-to-Speech voices will be installed when your machine turns back on.

我可以在设置中看到这些声音,它们也出现在 Windows10 文本到语音程序中。但是,当我 运行 在 Powershell 中使用 GetInstalledVoices().VoiceInfo 命令时,这些声音不会出现。

我需要做一些额外的设置才能System.Speech识别这些新声音吗?

问题出在这个post的第一个答案:

Windows 10 has two different TTS engines installed by default. There are the WinRT speech synthesis APIs (in the Windows.Media.SpeechSynthesis namespace), and the SAPI speech synthesis APIs (in the System.Speech.Synthesis namespace, and the COM ISpVoice interface).

David and Zira are SAPI voices; the language packs install WinRT voices.

The SAPI APIs and voices are legacy APIs, and are not being further developed; all new voices and effort are going into the WinRT APIs and voices.

If you want to use the language pack voices, you'll need to move your application over to WinRT and use the WinRT APIs.

System.Speech 对象仅适用于 SAPI API 声部。幸运的是,Windows 并没有在任何地方清楚地记录这个事实,您必须在 运行dom 堆栈溢出 post 上找到它,您 运行 是偶然发现的。