C # to read text in speech

Source: Internet
Author: User

There are three methods for text-to-speech reading in C #, and one of these methods is described below.

在项目中引用System.Speech,具体方法为右键点击项目 > 添加引用 > .Net > 找到System.Speech点击确定。下面为实现代码,将以控制台程序为例:

  usingSystem.Speech.Synthesis; namespaceconsoleapplication1{classprogram{Static voidMain (string[] args) {SpeechSynthesizer Voice=NewSpeechSynthesizer ();//Create a speech instanceVoice. Rate =-1;//set speech speed, [ -10,10]Voice. Volume = -;//set volume, [0,100]Voice. Speakasync ("Hellow Word");//plays the specified string, which is read asynchronously//The following code is for some SpeechSynthesizer properties to see if the actual situation requires using theVoice. Dispose ();//Release all voice resourcesVoice. Speakasynccancelall ();//Cancel read aloudVoice. Speak ("Hellow Word");//Synchronous ReadingVoice. Pause ();//Pause ReadingVoice. Resume ();//Continue reading           }     }  }

C # to read text in speech

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.