gpt4 book ai didi

c# - 如何使用所有可用的声音?

转载 作者:太空狗 更新时间:2023-10-29 23:36:14 24 4
gpt4 key购买 nike

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

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 本身显示了更多的扬声器。

enter image description here

因此我只能听到“-Desktop”-voices。我如何通过 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

关于c# - 如何使用所有可用的声音?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49614914/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com