Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Highlight the current word that TTS engine is speaking

I'm working on Text to speech application but I encounter a problem that I couldn't know the present word that TTS is speaking. Is there any way to find this.?

For Example: If TTS is speaking this string: Questions that may already have your answer and when it reaches 'already', how can I highlight 'already.'

like image 868
Rookie Avatar asked Sep 18 '12 11:09

Rookie


1 Answers

I propose that use sequence of TextToSpeech.speak():

    • start speaking first word.
    • highlight first word.
    • detect that synthesizing of first word has finished.
    • start speaking second word.
    • highlight second word.
    • detect that synthesizing of second word has finished.
    • and so on ...

Now it only remains How to detect that synthesizing of a word has finished?Use TextToSpeech.setOnUtteranceCompletedListener() to detect utterance has completed.

You can see these pages for more details:
How to know when TTS is finished?
An introduction to Text-To-Speech in Android

like image 86
hasanghaforian Avatar answered Oct 23 '22 14:10

hasanghaforian