I am building an app that will use the TTS engine to pronounce a bunch of words/sentences one after another. And I want to pause the speech after each one. For example:
Speak "Random Text 1"
Pause for 1 second
Speak "Random Text 2"
Pause for 1 second
Speak "Random Text 3"
Pause for 1 second
I see that there is a method called playSilentUtterance
but it can only be used in API 21. I want my app's min SDK to be API 17 so I can't use that method.
I want to find a character or a group of characters that will "tell" the TTS to pause for a little bit, not limited to 1 second, a noticeable length of time would be fine.
Here is basically what my code is doing.
I loop through a list of words that needs to be pronounced. For each of the words, I call
tts.speak(theWord, TextToSpeech.QUEUE_ADD, null);
And it is saying them without any pause in between.
How can i do this?
To pause command for 1 second,Insert Thread.sleep after each tts.speak command. Change the milliseconds to what works best for your code.
try {
//sleep 1 seconds
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}