gpt4 book ai didi

c# - Windows 控制台应用程序语音不会改变

转载 作者:行者123 更新时间:2023-11-30 12:22:51 25 4
gpt4 key购买 nike

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

//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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com