C # mixed reading in Chinese and English

Source: Internet
Author: User

In occasional project requirements, the application is required to read a piece of text, such as the verification code reading function. Here is a simple implementation.

First, you must reference a class library SpeechLib. dll. The specific code is as follows: (this program is implemented using winform)

 

Code
 1 using System;
2 using System. Collections. Generic;
3 using System. Windows. Forms;
4 using SpeechLib;
5 namespace TestSpeaker1
6 {
7 static class Program
8 {
9 /// <summary>
10 /// main entry point of the application.
11 /// </summary>
12 [STAThread]
13 static void Main ()
14 {
15 Application. EnableVisualStyles ();
16 Application. SetCompatibleTextRenderingDefault (false );
17 Application. Run (new Form1 ());
18}
19}
20 public class Speach
21 {
22 private static Speach _ Instance = null;
23 private SpeechLib. SpVoiceClass voice = null;
24 private Speach ()
25 {
26 BuildSpeach ();
27}
28 public static Speach instance ()
29 {
30 if (_ Instance = null)
31 _ Instance = new Speach ();
32 return _ Instance;
33}
34 private void SetChinaVoice ()
35 {
36 voice. Voice = voice. GetVoices (string. Empty, string. Empty). Item (3 );
37}
38 private void SetEnglishVoice ()
39 {
40 voice. Voice = voice. GetVoices (
Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.