Chrome.tts.speak character limit

I use the Chrome tts service in my extension. According to chrome.tts documentation :

The maximum text length is 32,768 characters.

However, when I pass a line containing more than 250 characters, the engine will not read all statements (it just stops reading it in the middle of the word). Now I am wondering if this is a mistake, or is it by design. The web speech API has a similar character limit described in spec , and it behaves the same.

I would like to know that I am doing something wrong or does it depend only on the TTS Engine in the browser, and I can not do anything about it?

+4
source share
1 answer

I read the official documentation and how did you report that it says that:

The maximum length of the text is 32,768 characters.

Perhaps they refer to the maximum length of an SSML file!

I used chrome api for a while and I can tell you that:

  • Violation of statements occurs only when the voice is not native,
  • Cutting usually occurs between 200-300 characters. When it breaks, you can freeze it by executing the function speechSynthesis.cancel ();
  • The onend event sometimes decides not to fire. A bizarre workaround for this is to console.log () from the statement object before talking about it. I also found that wrapping the talk call in the setTimeout callback helps mitigate these issues.

I solved the problem of text splitting:

  • -, ( );
  • , ;

.

+1

Source: https://habr.com/ru/post/1570527/


All Articles