这是我正在编写的代码,用于将女性合成器的声音更改为男性,但它不会改变它继续运行女性声音。知道为什么会这样吗?
//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");
}
关于c# - Windows 控制台应用程序语音不会改变,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39060224/