SpeechSynthesizer doesn't get all installed voices 3

此生再无相见时 提交于 2020-05-15 09:44:45

问题


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)

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);                           
        }
    }
}

Looking in available_voices.txt only these voices are listed:

Microsoft David Desktop
Microsoft Hazel Desktop
Microsoft Zira Desktop
Microsoft Irina Desktop

But looking under Text-to-speech in the setttings there are many more, like Microsoft George and Microsoft Mark.

The accepted answer here: SpeechSynthesizer doesn't get all installed voices suggest changing the platform to x86. I tried this but i am not seeing any change.

This answer: SpeechSynthesizer doesn't get all installed voices 2 suggest 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.


回答1:


I solved it by installing voices from another source and getting Microsoft Speech Platform - Runtime (Version 11



来源:https://stackoverflow.com/questions/51811901/speechsynthesizer-doesnt-get-all-installed-voices-3

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!