However, the method itself does not know what language you are giving the string, so you need us to read the string in what language. The Voice attribute of the Spvoiceclass class is used to set the language, we can get all the list of languages through the Spvoiceclass Getvoices method, and then select the corresponding language according to the parameters, such as setting the language to Chinese as follows:
0 is used in Chinese, and 1234 in English, which means different accents.
In this way, we set up a language, if combined with the pronunciation method, we can design a only Chinese speech method
private void Speakchina (string strspeak)
{
Setchinavoice ();
Speak (Strspeak);
}
The only way to speak English speech is similar, the above program has.
For a combination of Chinese and English language, we let the program read the mixed speech method is: Programming the language of the Chinese and English separate, to call the Speakchina method, English call Speakenglishi method; As to how to judge whether a character is English or Chinese, I am using the method of judging the ASC code, the concrete class method is implemented through Analysespeak.
In this way, for a piece of Chinese and English mixed text, we simply pass it as a parameter to the Analysespeak, he can complete the mixed pronunciation in English and Chinese.
Of course, for the pronunciation of the tentative, continue, stop and other operations, the above also gives a simple method call, it is easy to understand.
The following is a brief introduction to Chinese speech recognition methods:
First put the class source code for the speech recognition below, and then explain:
We define the context and syntax of Ssrcontex and ISRG for speech recognition, and by setting the Isrg Dictationsetstate method, we can start or end the recognition, which is the Beginrec and Closerec method in the above program. CDisplay is where we use to output recognition results, and to be able to display results on most controls, I use a control class to define it. Of course, every speech recognition triggers the Ispeechrecocontextevents_recognitioneventhandler event, and we define a method contexrecognition to respond to the event, and output the recognition result in this method.
In this way, the Chinese speech processing some of the most basic problems have a simple solution, of course, this method has a lot of imperfect places, I hope that we put forward more criticism and common improvement.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.