You can add speech capabilities to your site easily by following this simple process:
1. Add reference to a COM dll called Microsoft Speech Object Library(Interop.SpeechLib.dll).
2. Add a textbox to your web project where you can place the content to be converted to speech.
3. In your codebehind, declare the namespace - using SpeechLib;
4. Add a button that will handle the speech process as given below:
protected void btnVoice_Click(object sender, EventArgs e)
{
SpVoice voice = new SpVoice();
try
{
voice.Speak(spText.Text, SpeechVoiceSpeakFlags.SVSFDefault);
}
catch (Exception ex)
{
throw ex;
}
}
4. That is it! Remember to switch your speaker on and give it some volume.
Comments