如何使用所有可用的声音?

How to use all voices available?

我正在使用这个命令来列出可用的语音

private static SpeechSynthesizer sprecher;

...

sprecher = new SpeechSynthesizer();

...

private static List<VoiceInfo> GetInstalledVoices()
{
    var listOfVoiceInfo = from voice
                          in sprecher.GetInstalledVoices()
                          select voice.VoiceInfo;

    return listOfVoiceInfo.ToList<VoiceInfo>();
}

我只有 4 种不同的声音(Hedda、Hazel、David 和 Zira),但 windows 本身显示了更多的说话者。

因此我只听到“-Desktop”-声音。如何通过 C# 访问其他扬声器?

编辑 2:OP 通过使用导出而不是命令行复制使其工作

Export the whole Token Directory of Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech_OneCore\Voices to a file. Replace every HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech_OneCore\Voices\Tokens with HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech\Voices\Tokens in the file and run the file(I removed the voices I already had before).

following thread 上,一位 MSDN 用户 A.Kelany 问了一个类似的问题,他只从 GetInstalledVoices 方法中得到了两个声音。

他说他可以通过执行以下操作来解决此问题:

I managed to get it to work in a test project by doing the following : I opened the registry and noticed that there is a node : Quote: Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech\Voices

which contained the voices that appear in the application GetInstalledVoices method

and there is another node :

Quote: Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech_OneCore\Voices

that contained all the voices including the ones don't appear in the aforementioned method,

So I copied one of the voices from the second node to the first node and it worked!

他还表示,此更改后他无法在 Any CPU 上构建,必须将构建类型更改为 x64