[ad_1]
Hello I have made a class to my program like this:
Speaker.cs (Synthesizer Class):
class Speaker
static int Volume = 100;
SpeechSynthesizer _synthesizer = new SpeechSynthesizer(); //Synthesizer
public Speaker()
_synthesizer.Volume = this.Volume; //set Volume from the static int
_synthesizer.SelectVoiceByHints(VoiceGender.Male, VoiceAge.Adult); //Select a default Gender and Age
public int getVolume()
return Volume;
public void setVolume(int value) //Gets the volume from other class
Volume = value;
_synthesizer.Volume = value;
public void Say(string Text) //Speak Text
_synthesizer.Speak(Text);
public void setGenAg(VoiceGender gen, VoiceAge ag) //I change Gender and age from here from another class
_synthesizer.SelectVoiceByHints(gen, ag);
And in main class:
static Speaker _speaker = new Speaker(); //set _speaker as new Speaker Synthesizer
static void Main(string[] args)
_speaker.setVolume(100); //set the volume
_speaker.setGenAg(VoiceGender.Male, VoiceAge.Teen); and change the Gender and Age
My questions:
- Why Age and Gender dont change
- How to make Synthesizer talk faster
[ad_2]
لینک منبع