Reputation: 29
Hi I'm just testing SpeechSynthesizer in C# and I want to change the voice.
SpeechSynthesizer reader = new SpeechSynthesizer();
private void button1_Click(object sender, EventArgs e)
{
reader.Dispose();
reader = new SpeechSynthesizer();
reader.SelectVoiceByHints(VoiceGender.Male);
reader.Speak("Hi how are you baby");
}
There is no more Code, just a single button(WinForm). Personally I would say that reader.SelectVoiceByHints(VoiceGender.Male);
should be enough. But if I click the button, I still will hear a female voice. What do I need to change? Thank you!
Upvotes: 2
Views: 3427
Reputation: 2145
I was able to selected specific voices like this:
reader.SelectVoice("Microsoft Zira Desktop");
To get the list of the voices currently installed:
foreach(var voice in reader.GetInstalledVoices()){
Console.WriteLine(voice.VoiceInfo.Name);
}
Upvotes: 1