How To Create Text2Speech Application in ASP.NET 2.0

1. Open new C# Web Application.
2. Add the Reference Microsoft object speech application
(SAPI is a COM component that needs to be referenced in the project.)
3. Add the namespace : using SpeechLib; 

SpVoice is the class that is used for text to speech conversion. The speak method takes in a string that needs to be spoken along with a set of flags. The flag that I have used, which is SVSFlagsAsync tells the TTS engine that the conversion of the text to speech needs to be done in a Asynchronous mode. The control quickly returns after this call. protected void Button1_Click(object sender, EventArgs e) { SpVoice voice = new SpVoice(); voice.Speak(TextBox1.Text, SpeechVoiceSpeakFlags.SVSFlagsAsync); }

Post a Comment


Close Menu