Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Google TTS can't convert text longer than ~500-600 characters when using Neural2 voices

ih
Bronze 2
Bronze 2

According to Google TTS documentation, the Speech Synthesis Limit is 5000 bytes per request - https://cloud.google.com/text-to-speech/quotas.

However, when I use Neural2 voice (for example "es-US-Neural2-A"), I can't even convert 600 bytes per request. Instead, I receive an error message: google.api_core.exceptions.InvalidArgument: 400 Request contains an invalid argument. 

Converting text < 500 bytes works fine, so that's definitely not an "invalid argument" issue.

It looks like an issue on Google's side, but please let me know if you have any ideas on how to fix it.

Thank you

Solved Solved
1 10 11.2K
1 ACCEPTED SOLUTION

There is already an ongoing internal bug for this. For the meantime, possible workarounds would be, converting the text into <500 bytes as you mentioned or send the request into smaller pieces.

View solution in original post

10 REPLIES 10

There is already an ongoing internal bug for this. For the meantime, possible workarounds would be, converting the text into <500 bytes as you mentioned or send the request into smaller pieces.

Thank you for the quick response! Do you know by any chance how long it will take to solve this bug? 

Thanks again

Hi - I'm having these errors too:

 

This request contains sentences that are too long. To fix, split up long sentences with sentence ending punctuation e.g. periods.

 

 
It would be good to get this fixed. It appears to be a problem for Neural, WaveNet, and Standard voices right now.
 
The problem persists even if I lower the TTS characters to under 250 per request.

same here

Hi, did you find a solution? I have the same problem.

Hi, did you find a solution? I have the same problem.
My quick fix was to change the voice, but I may need to support different voices. I can't try them all over and over again.

tks

Below sentence has only 360 characters, and the api returns error 'This request contains sentences that are too long.' 

The Post also reviewed approximately 300 photos of classified documents, most of which have not been made public; some of the text documents OG is said to have written out; an audio recording of a man the two group members identified as OG speaking to his companions; and chat records and photographs that show OG communicating with them on the Discord server.

 

 

Still not working

About the error 

This request contains sentences that are too long. To fix, split up long sentences with sentence ending punctuation e.g. periods.

Which is not the same as the character limit, I had this problem today and I found that I had multiple tabulation characters as the text was extracted from html pages. I did a $text=preg_replace('#\t+#',' ',$text); and that solved the issue.

Since they are fixing the bug still, you can try using a different AI text to speech generator for the time being which doesn't have such limitations. The one that I use has a vast voice library and supports over 40 languages