繁体   English   中英

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM