Home > Net >  SpeechLib use about c #, I how, according to a library computer has been installed in accordance wit
SpeechLib use about c #, I how, according to a library computer has been installed in accordance wit

Time:10-14

SpVoice SpVoice=new SpVoice ();
SpVoice. Voice=spVoice. GetVoices (). The Item (7);
SpVoice. Speak (" hello ", SpeechVoiceSpeakFlags SVSFDefault);

This code can run normally, because my computer installed 7 kinds of library, but how do I according to the name of the library, such as "Microsoft Sam", "Microsoft Simplified Chinese" or "VW Wang", according to the name select voice? Not like the above code or online say 0 or 1 choice in both English and Chinese, are copied, didn't understand those subscript corresponds to pronunciation, I'm drunk...

CodePudding user response:

 foreach (ISpeechObjectToken Token in voice. GetVoices (string. The Empty string. Empty)) 
{
ComboBox1. Items. The Add (Token. The GetDescription (49));
}

CodePudding user response:

 private void comboBox1_SelectedIndexChanged (object sender, EventArgs e) 
{
Voice. Voice=voice. GetVoices (string. The Empty string. Empty), Item (comboBox1. SelectedIndex);

}

CodePudding user response:

The building Lord solved? 42637690 qq if trouble thank you to contact me!

CodePudding user response:

Public void setDescription (string name)//the Microsoft speech name Lili
{
for (int i=0; I & lt; SpVoice. GetVoices (). The Count; I++)//traverse library
{
String desc=spVoice. GetVoices (). The Item (I). The GetDescription ();//get name
If (desc) Equals (name))//judgment
{
SpVoice. Voice=spVoice. GetVoices (). The Item (I);//assignment
}
}

}
  •  Tags:  
  • C#
  • Related