androidtext-to-speechonutterancecompleted

onUtteranceCompleted() lost if TTS received is too long


I just observed an "undocumented anomaly" in Android's TTS engine: If the text to be spoken is too long (greater than 4K characters), then onUtteranceCompleted() for that particular utterance will never arrive...

Has anyone else come across this?

Is this a known bug or limitation?

What could be done to work around this?


Solution

  • I wasn't aware of the limit, as I prefer smaller chunks of speech (useful if pausing or if activity is paused).

    When you call speak, you can add the new utterance to the end of the queue using this for queueMode: TextToSpeech.QUEUE_ADD

    Test to be sure the sentence doesn't sound different, but I think just automatically parsing at the next sentence (or word if needed) after a cutoff length would work.