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 #