i am trying to highlight words read by the text to speech but its not working. until now i made:
string startSpan = "<span style=" + "background-color:Yellow" + ">";
string endSpan = "</span>";
//button onclick
protected void speak_Hope(object sender, EventArgs e)
{
speaker.Rate = -4;
speaker.SpeakAsync(announce.InnerText);
speaker.SpeakProgress += new EventHandler<SpeakProgressEventArgs> (speaker_SpeakProgress);
System.Diagnostics.Debug.WriteLine("processing");
}
void speaker_SpeakProgress(object sender, SpeakProgressEventArgs e)
{
counter2 = e.CharacterPosition - 10;
counter3 = e.Text.Length;
counter4 = counter2 + counter3;
System.Diagnostics.Debug.WriteLine(e.CharacterPosition - 10 + " next one" + e.Text);
announce.InnerHtml = announce.InnerText.Substring(0, counter2) + startSpan + announce.InnerText.Substring(counter2, counter3) + endSpan + announce.InnerText.Substring( announce.InnerText.Length - 1);
}
am i doing it right or is there any other way, can it be done in a javascript manner?
thanks alot
In the case you are looking for text to speech this is a possible duplicate of this Stackoverflow Question. That question provides the suggestion of using WebAnywhere, this provides speech to text without any additional downloads or special software. Pretty cool!
However, it seems like you are actually looking to achieve speech recognition. Based on your code you are heading down the wrong rabbit hole. You are not going to be able to use the Microsoft Speech libraries to accomplish this goal (short on embedding them in an XBAP) and this is a result of them running on the server and not on the client side.
There are some Flash and Java based solutions that will indeed allow for client side voice recognition. I suggest you explore them because I believe they achieve what you’re looking for.
1) Speech API – Open source and their website includes a range of demos that I found to work quite well.
2) wami – Also open source