问题描述
我在区域和语言下使用添加语言"添加了许多语音.这些出现在 Speech 中的 Text-to-speech 下.(我使用的是 Windows 10)
I have added many voices using "Add language" under region and language. These appear under Text-to-speech in Speech. (I am using Windows 10)
我想在我的应用程序中使用 System.Speech.Synthesis
中的 SpeechSynthesizer
类.
I want to use these in my app with the SpeechSynthesizer
class in System.Speech.Synthesis
.
在我的应用程序中列出可用语音时,只显示了少数实际可用的语音:
When listing the available voices in my application only a handful of those actually available are shown:
static void Main()
{
SpeechSynthesizer speech = new SpeechSynthesizer();
ReadOnlyCollection<InstalledVoice> voices = speech.GetInstalledVoices();
if (File.Exists("available_voices.txt"))
{
File.WriteAllText("available_voices.txt", string.Empty);
}
using (StreamWriter sw = File.AppendText("available_voices.txt"))
{
foreach (InstalledVoice voice in voices)
{
sw.WriteLine(voice.VoiceInfo.Name);
}
}
}
查看 available_voices.txt
中只列出了这些声音:
Looking in available_voices.txt
only these voices are listed:
Microsoft David Desktop
Microsoft Hazel Desktop
Microsoft Zira Desktop
Microsoft Irina Desktop
但是在设置中的 Text-to-speech 下查看还有更多,例如 Microsoft George
和 Microsoft Mark
.
But looking under Text-to-speech in the setttings there are many more, like Microsoft George
and Microsoft Mark
.
这里接受的答案:SpeechSynthesizer 无法获取所有已安装的声音建议将平台更改为 x86.我试过了,但我没有看到任何变化.
The accepted answer here:SpeechSynthesizer doesn't get all installed voicessuggest changing the platform to x86. I tried this but i am not seeing any change.
这个答案:SpeechSynthesizer 无法获取所有已安装的语音 2由于 System.Speech.Synthesis
中的错误,建议使用 .NET v4.5.我的目标是 .NET Framework 4.5,但我仍然只能检索 4 个声音.
This answer:SpeechSynthesizer doesn't get all installed voices 2suggest using .NET v4.5 because of a bug in System.Speech.Synthesis
. I targeted .NET Framework 4.5 but i can still only retrieve 4 voices.
我链接的问题中的所有答案都没有帮助我解决我的问题,所以我再次提问.任何帮助都表示感谢.
None of the answers in the questions i linked helped me solve my problem, so i am asking again. Any help is appretiated.
推荐答案
我通过从其他来源安装语音并获取 Microsoft Speech Platform - Runtime(版本 11)解决了这个问题
I solved it by installing voices from another source and getting Microsoft Speech Platform - Runtime (Version 11)
可以在 microsofts 网站 上找到可用的语音a>(点击红色下载按钮,应该会列出声音)
The available voices can be found on microsofts website (click on the red download button and the voices should be listed)
这篇关于SpeechSynthesizer 无法获取所有已安装的声音 3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!