Windows控制台应用语音不会改变

Windows console application voice would not change

这是我正在编写的代码,用于将女声合成器声音更改为男声,但它不会改变它继续 运行 女声。知道为什么会这样吗?

//Opening dialog to the user
Console.WriteLine("Console cpu burn by mixedBreed" + "\nPlease wait while I look over your system");
Console.WriteLine();
string author = "Console cpu burn by mixed Breed" + " Please wait while I look over your system";
synth.SelectVoiceByHints(VoiceGender.Male);
synth.Speak(author);

看来SelectVoiceByHints的方法我也没法用,声音一直没变。如果你想切换到男性声音,这里有一些代码可以工作:

using (var synth = new SpeechSynthesizer())
{
    var voices = synth.GetInstalledVoices().Dump();
    var male = voices.FirstOrDefault(v => v.VoiceInfo.Gender == VoiceGender.Male);
    if (male != null)
    {
        synth.SelectVoice(male.VoiceInfo.Name);
    }

    synth.Speak("Hello");
}