Adding speech functionality to your site is so easy using the COM API available in the SAPI has a text-to-speech engine (TTS).
Mind you every machine with Windows XP has SAPI and TTS.
All you need do is to add a reference to a COM dll available in Microsoft Speech Object Library.
The dll's name is Interop.SpeechLib.dll
Namespace declare your dll as using SpeechLib;
Create a text box that will contain your text, add a button that will trigger the voice conversion as shown 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;
}
}
QED. You are done now. Just make sure your speakers are on and you have got the right volume.
Mind you every machine with Windows XP has SAPI and TTS.
All you need do is to add a reference to a COM dll available in Microsoft Speech Object Library.
The dll's name is Interop.SpeechLib.dll
Namespace declare your dll as using SpeechLib;
Create a text box that will contain your text, add a button that will trigger the voice conversion as shown 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;
}
}
QED. You are done now. Just make sure your speakers are on and you have got the right volume.
Comments