Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TTS] - Generating Consecutive Speech #7

Closed
GoogleCodeExporter opened this issue Jun 11, 2015 · 4 comments
Closed

[TTS] - Generating Consecutive Speech #7

GoogleCodeExporter opened this issue Jun 11, 2015 · 4 comments

Comments

@GoogleCodeExporter
Copy link

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
Copy link
Author

I use SDK 1.5

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

@GoogleCodeExporter
Copy link
Author

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
Copy link
Author

I also have this problem, and it is highly disruptive.

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

@GoogleCodeExporter
Copy link
Author

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

  • Changed title: [TTS] - Generating Consecutive Speech
  • Changed state: Done
  • Added labels: Type-Other
  • Removed labels: Priority-Medium, Type-Defect

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant