innovision123 / eyes-free

Automatically exported from code.google.com/p/eyes-free
0 stars 0 forks source link

[TTS] - Generating Consecutive Speech #7

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi

I want to block the thread/method until the speak() has finished.
I have coded this :

myTTS.speak(text, 0, s );
while ( myTTS.isSpeaking() == true )  {
   try {
      Thread.sleep(500);
   }
   catch (InterruptedException e)  {}
}

Unfortunately, it seems isSpeaking() returns too early.

In my app I need to speak several sentences, one at a time.
I need to wait until the 1st sentence is finished COMPLETELY before I do a
speak() for the next one.

Original issue reported on code.google.com by bsegon...@gmail.com on 19 May 2009 at 10:16

GoogleCodeExporter commented 9 years ago
I use SDK 1.5

Original comment by bsegon...@gmail.com on 19 May 2009 at 10:16

GoogleCodeExporter commented 9 years ago
I have the same problem. Does anyone have any suggestion to fix it? 
Furthermore, is
there any way to know the length of the spoken sentence? Thanks.

Original comment by jones121...@gmail.com on 26 Aug 2009 at 3:38

GoogleCodeExporter commented 9 years ago
I also have this problem, and it is highly disruptive.

Original comment by grego...@gmail.com on 17 Apr 2010 at 2:11

GoogleCodeExporter commented 9 years ago
The TTS library allows you to queue speech.  See:  
http://developer.android.com/reference/android/speech/tts/TextToSpeech.html#spea
k(jav
a.lang.String, int, java.util.HashMap<java.lang.String, java.lang.String>)

So, instead of using calls to isSpeaking(), it would be more efficient to speak 
consecutively using something similar to the following:

myTTS.speak("This is my first sentence.", 0, null);
myTTS.speak("This will be spoken after the first sentence is complete.", 1, 
null);

Subsequent calls to speak() using 1 or TextToSpeech.QUEUE_ADD as the second 
parameter 
will continue to chain the spoken text, but as soon as speak() is called with a 
0 or 
TextToSpeeach.QUEUE_FLUSH, speech will be interrupted.

Hope this helps,
Casey Burkhardt

Original comment by caseybur...@google.com on 5 Jun 2010 at 2:38