How to Create a Simple Text to Speech Program in C#

Submitted by: 
Language: 
Visitors have accessed this post 196 times.

This time, I will teach you how to create a Text to Speech Application in C#. In this method you will be able to make the machine speak because of .Net Framework that produces the speech libraries. Simply follow the steps below to see how it works.

Creating Application

Step 1

Open Microsoft Visual Studio 2015 and create a new windows form application in C#.
speech1

Step 2

Do the form just like shown below.
speech2

Step 3

Go to solution explorer, right click the “References” and hit add reference.
speech3

Step 4

Add the System.Speech and hit “ok”.
speech4

Step 5

Add a namespace below to access Speech library.

  1. using System.Speech.Synthesis;

Step 6

Double click the “Speak” button and do the following codes to make the machine speak when the button is clicked.

  1. private void button1_Click(object sender, EventArgs e)
  2. {
  3. SpeechSynthesizer speaks = new SpeechSynthesizer();
  4. string msg;
  5. msg = "Welcome to sourcecodester.com";
  6. speaks.Rate = 1;
  7. speaks.Volume = 100;
  8. speaks.Speak(msg);
  9. }

For more question about this article. You can contact me @
Email – [email protected]
Mobile No. – 09305235027 – TNT
FB Account – https://www.facebook.com/onnaj.soicalap
Or feel free to comment below.


Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • You may insert videos with [video:URL]
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd> <table> <tr> <td> <th> <img> <h1> <h2> <h3> <iframe> [video]
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <asp>, <c>, <cpp>, <csharp>, <css>, <html4strict>, <java>, <javascript>, <mysql>, <php>, <python>, <sql>, <vb>, <vbnet>. The supported tag styles are: <foo>, [foo].
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.