Facing "Sentences are too long” error from Google Cloud Text-to-Speech

TTS Error with Google Cloud Text-to-Speech

Description:

During bot conversations, issues have been observed with the Google Cloud Text-to-Speech (TTS) engine. Specifically, when a large character sequence is entered into the TTS model, it freezes. The problem is particularly evident with a sequence length of 748 characters. While audio is generated for 747 characters, some parts of the text are missing in the output. This issue can be tested from the start flow when TTS settings and the Preview audio option are used. The attached screenshot illustrates the issue from a text perspective, but during the call, silence is heard, and the bot freezes.

Symptoms:

  • TTS engine freezes when processing character sequences of 748 characters or more.
  • Audio generated for 747 characters may have missing parts.
  • Silence during calls when the issue occurs.

Errors:

  • “Sentences are too long” error from Google Cloud Text-to-Speech.
  • INVALID_ARGUMENT: This request contains sentences that are too long.

Solution Given:

  1. Enable TTS Chunking (Recommended): Set the enableTTSChunking parameter to true in the Call Control Parameters section. This will split long text into smaller segments before sending it to the TTS provider, preventing the “sentence too long” error.
  2. Adjust Text Input: Replace semicolons with full stops to split the text into shorter sentences.

Commands:

  • Parameter Name: enableTTSChunking
  • Value: true
  • Location: Add this parameter at the very first Entity node or Message Node in the call flow.

Please ensure to save and redeploy the flow after making these changes, then retest the scenario.

Content by @tejasree.yeddolla @praveen.adari