4

I Am currently working on a project where I want to have the SpeechSynthesizer speak a text. I also want a textblock to display the words as they are spoken. This is so you can read along if you don't understand the Speech Synthesizer.

So basically the problem is that i cant find a efficient way to append every letter to a text within a textbox right when its spoken by the Speech Synthesizer. So it looks like the Speech Synthesizer is typing along with what he is saying.

Example

If I would do this:

SpeechSynthesizer x = new SpeechSynthesizer();
x.SpeakAsync("Hello there");

I want the textbox text to write along as the words are spoken by the x (SpeechSynthesizer ). Something like this: http://youtu.be/hx6JL7PsLrg?t=1m56s

4

2 回答 2

0

这是一种 hacky(并且不能保证逐个字母),但是您可以使用该PhonemeReached事件作为提示来显示下一个字母(并在断字处停止),然后使用该SpeakProgress事件生成剩余的单词中的字母。如果您使用的是 SSML,您当然需要跳过标记。

于 2014-02-27T17:52:45.010 回答
0

正如 Eric 提到的,您必须使用SpeechSynthesizer.SpeakProgress事件:

例如:

var ss = new SpeechSynthesizer();
ss.SpeakProgress += (sender, args) => txtBox.Text += args.Text;
ss.Speak("Hello this is " + true);
于 2014-02-25T01:26:19.813 回答