Windows console application voice has not changed

Here is the code that I write to switch from the female voice of the synthesizer to the man, but it will not change, it continues to control the female voice. Any idea why this could be?

//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);
+4
source share
1 answer

It seems I can’t get the method SelectVoiceByHintsto work, the voice never changes. If you want to switch to a male voice, then this code will work:

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");
}
+1
source

Source: https://habr.com/ru/post/1651918/


All Articles