Text to Speech Application in C#

In this tutorial, I will teach you how to create a program that will have a text to speech application. So, now let's start this tutorial! 1. Let's start with creating a Windows Form Application for this tutorial by following the following steps in Microsoft Visual Studio 2010: Go to File, click New Project, and choose Windows Application. 2. Add one textbox and have it as a multiline textbox and also a button. design 3. Click Reference, and then Add Reference. design Then, click the NET tab and choose System.Speech. design 4. Now, have this code below. Import first the namespace of speech.synthesis to access the text to speech.
  1. using System.Speech.Synthesis;
Then initialize variable for a synthesizer that will call the speech method.
  1. SpeechSynthesizer ss = new SpeechSynthesizer();
And have this code in your button.
  1. private void button1_Click(object sender, EventArgs e)
  2. {
  3. // if textbox1 is empty
  4. if (string.IsNullOrEmpty(textBox1.Text))
  5. {
  6. MessageBox.Show("Please enter some text in the text box before trying to speak");
  7. return;
  8. }
  9. else//if textbox is not empty
  10. {
  11. //call the speakAsync method to say the words inside the textbox
  12. ss.SpeakAsync(textBox1.Text);
  13. }
  14. }
Output: output For more inquiries and need programmer for your thesis systems in any kind of programming languages, just contact my number below. Best Regards, Engr. Lyndon Bermoy IT Instructor/System Developer/Android Developer/Freelance Programmer If you have some queries, feel free to contact the number or e-mail below. Mobile: 09488225971 Landline: 826-9296 E-mail:[email protected] Add and Follow me on Facebook: https://www.facebook.com/donzzsky Visit and like my page on Facebook at: https://www.facebook.com/BermzISware

Add new comment