Teach you how to make text into a sound program in C #

Source: Internet
Author: User

Teach you how to make text into a sound program in C #

Under the System.speech namespace, the SpeechSynthesizer class can read the text and play it together.

First introduce System.speech in the Windows Forms project. Interface section:

The backend code is also simple, except for some methods of calling the SpeechSynthesizer class:

Using system.windows.forms;using system.speech;using system.speech.synthesis;namespace WindowsFormsApplication1{    Public partial class Form1:form {private SpeechSynthesizer SS;    Public Form1 () {InitializeComponent ();    } private void Form1_Load (object sender, EventArgs e) {ss = new SpeechSynthesizer (); } private void Buttonread_click (object sender, EventArgs e) {ss.      rate = Trackbarspeed.value; Ss.      Volume = Trackbarvolumn.value; Ss.    Speakasync (Txtmsg.text); } private void Buttonpause_click (object sender, EventArgs e) {ss.    Pause (); } private void Buttoncontinue_click (object sender, EventArgs e) {ss.    Resume ();       } private void Buttonrecord_click (object sender, EventArgs e) {SpeechSynthesizer SS = new SpeechSynthesizer (); Ss.      rate = Trackbarspeed.value; Ss.      Volume = Trackbarvolumn.value;      SaveFileDialog sfd = new SaveFileDialog (); SfD.      Filter = "Wave files|*.wav"; Ss. SetoutputTowavefile (SFD).      FileName); Ss.      Speak (Txtmsg.text); Ss.      Setoutputtodefaultaudiodevice ();    MessageBox.Show ("Complete recording ~ ~", "hint");    } private void Buttonclose_click (object sender, EventArgs e) {application.exit (); }  }}

In addition to the Declaration, Running GuestArticles are original, reproduced please link to the form of the address of this article
Teach you how to make text into a sound program in C #

This address: http://www.paobuke.com/develop/c-develop/pbk23559.html






Related Content C # calls to the Javawebservice service a summary of problems encountered by the C # Regular expression Regex class common Match Game development random probability selection algorithm C # method of realizing system tray notification
C # How to synchronize network time examples of how C # uses post to send and receive data grayscale method of image processing in C # using the Split method in C # to split a string instance

Teach you how to make text into a sound program in C #

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.