Text To Speech Using C#

This code-sample includes add Text to speech. This sample can be used for many purpose. For example, you can create an captcha speech.

Here is the code

  1. <body>  
  2.     <form id="form1" runat="server">  
  3.     <div>  
  4.       
  5.         <asp:TextBox ID="txtWord" runat="server"/>  
  6.         <asp:Button ID="btnSubmit" runat="server" Text="Speack Word" OnClick="btnSubmit_Click"/>  
  7.     </div>  
  8.     </form>  
  9. </body>  
Need to add this library file on code behind
  1. using SpeechLib;  
Wirte C# code in the Button_Click event.
  1. protected void btnSubmit_Click(object sender, EventArgs e)  
  2.         {  
  3.             //Create Voice Object  
  4.             //Add text for speach  
  5.             SpVoice voice = new SpVoice();  
  6.             voice.Speak(txtWord.Text);  
  7.         }  
Build the application and you can hear the voice.