Introduction
This Article explains how to convert text to speech using c#.
Before starting to write code for converting a text into speech you have to add a reference (DownLoad if not available) for Interop.SpeechLib.

Step 1. Add the NameSpace as Using SpeechLib.
Step 2. Create an object of SpVoice class.
SpVoice voice = new SpVoice();
Step 3. Call the Speak() method by using Spvoice class object as follows and pass the parameters in the Speak().
voice.Speak(String text,SpeechVoiceSpeakFlags Flags);
Example
SpVoice voice = new SpVoice();
voice.Volume = 100;
voice.Speak(textBox1.Text, SpeechVoiceSpeakFlags.SVSFlagsAsync);
Place the above code in the Button Click event.
Add one TextBox, write some text in TextBox and click on the button to convert the TextBox text into speech as follows.

using System;
using System.Windows.Forms;
using SpeechLib; // Add this using directive for SpeechLib namespace
namespace VoiceTest {
public partial class Form1 : Form {
public Form1() {
InitializeComponent();
}
private void btnSpeak_Click(object sender, EventArgs e) { // Corrected EventArgs
if (!string.IsNullOrEmpty(textBox1.Text)) {
SpVoice voice = new SpVoice();
voice.Volume = 100;
voice.Speak(textBox1.Text, SpeechVoiceSpeakFlags.SVSFlagsAsync);
}
else {
MessageBox.Show("Please enter text for speech", "Text to Speech", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
}
}
Thanks for Reading my article!
Syed Shakeer Hussain

万春 吴Posted Nov 5, 2014, 8:04 PM
amazing
mohamed sayedPosted Nov 5, 2014, 10:33 AM
good work, thank you
prithvi rajPosted Oct 8, 2014, 8:56 AM
but when use same code in my windows service application it give error System.Runtime.InteropServices.COMException (0x8004503A): Exception from HRESULT: 0x8004503A at SpeechLib.ISpeechVoice.Speak how to use speech library in wndows service?
ankit makadiaPosted Aug 23, 2014, 11:17 AM
thanx...very good work
duaa qaisiPosted Sep 18, 2011, 8:39 AM
thanx alot . plz can anybody tell me how i can do the opposite speech to text ?
Rahat pattalbabPosted Mar 27, 2011, 3:12 PM
great steps thnxxxxxxxxxxx
Frank SlowPosted Feb 27, 2011, 9:03 AM
Thank You so much for the link
Slavcho ChungurskiPosted Feb 27, 2011, 6:05 AM
Mr Syed, I have found an article in Microsoft SpeechSDK documentation under a Topic "TTS Engine Vendor Porting Guide". This is the topic I was looking for. Do you have some c# experience with this. Do You have some tips & tricks?
Slavcho ChungurskiPosted Feb 24, 2011, 5:00 PM
Mr. Syed, is there any answer for me? Thanks...
Slavcho ChungurskieditedPosted Feb 22, 2011, 4:58 PMEdited Feb 22, 2011, 4:59 PM
Mr. Shakeer, I have developed a new TTS engine (for Macedonian language) in C#. It's main method SpeakMacedonian(string InputText) gets Unicode text as input, and returns a WAV file (or a stream). I'm trying to make it SAPI compatible and use it as default Windows voice, but I can not find some fine article for this issue. Do you have any idea how to resolve this? Thanks in advance...
Frank SlowPosted Jan 29, 2011, 2:40 PM
Could you tell me where can i download the Interop.SpeechLib file?
sagar BhosalePosted Jan 27, 2011, 12:58 PM
Very nice tutorials .Thanks sir.
Irfan KumtePosted Jan 20, 2011, 2:10 AM
great!!!