Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how I can change the voice synthesizer gender and age in C#?

Tags:

I would like to change the gender and age of the voice of System.Speech in c#. For example, a girl of 10 years but can not find any simple example to help me adjust the parameters.

like image 557
Pablo Gonzalez Avatar asked Jun 04 '12 12:06

Pablo Gonzalez


2 Answers

First, check which voices you have installed by enumerating the GetInstalledVoices method of the SpeechSynthesizer class, and then use SelectVoiceByHints to select one of them:

using (SpeechSynthesizer synthesizer = new SpeechSynthesizer()) {     // show installed voices     foreach (var v in synthesizer.GetInstalledVoices().Select(v => v.VoiceInfo))     {         Console.WriteLine("Name:{0}, Gender:{1}, Age:{2}",           v.Description, v.Gender, v.Age);     }      // select male senior (if it exists)     synthesizer.SelectVoiceByHints(VoiceGender.Male, VoiceAge.Senior);      // select audio device     synthesizer.SetOutputToDefaultAudioDevice();      // build and speak a prompt     PromptBuilder builder = new PromptBuilder();     builder.AppendText("Found this on Stack Overflow.");     synthesizer.Speak(builder); } 
like image 180
Groo Avatar answered Oct 05 '22 06:10

Groo


http://msdn.microsoft.com/en-us/library/system.speech.synthesis.voiceage.aspx http://msdn.microsoft.com/en-us/library/system.speech.synthesis.voicegender.aspx

Did you take a look at this ?

like image 26
Pierre Pellegrino Avatar answered Oct 05 '22 06:10

Pierre Pellegrino