簡體   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