Text-to-speech too much text but no error

When passing more than 4000 characters to the tool it quickly does nothing and returns a result of "true". 4000 characters works fine. I'm solving this by splitting the content and running them through the tool more than once. It would be nice if the tool has a result telling you it is too long or and error message. (Love app inventor!)

Probably not a bug but a hardware limitation.

TextToSpeech is an Android System function called by App Inventor. How it performs depends on your Android operating system version and probably your device memory.

I expect the ability to read more than 4000 characters depends on your hardware. I haven't see this behavior

The error probably can be avoided in an App Inventor app if the developer uses Blocks ( that is conditional statements).

if length Label.Text > 4000 then indicate too long for example. Recall that the Text length provides the number of characters in a string.

2 Likes

Thanks, good idea. I was actually thinking of doing the kind of check and if greater sending the first part then second, and third as needed. Still, it took me a while to detect the 4000 and was mostly posting so others could see there is a limit.

That 4000 character limit sounds close to a power of 2 (2^12), hinting at maybe some fixed size internal buffer.

If you split your text at '.' into a list of sentences and speak each sentence after completion of speaking the prior list item, that would avoid any internal speech buffer size limitation.

1 Like

This is a great idea.

Had no problem splitting the test on periods. The nice thing is the reader seems to pause nicely between sentences and it gives me the opportunity to pause the speaking between sentences.

Depending on the TTS engine, it may be making network calls to a third party server to generate the speech. The delay you observe may be network delay receiving the audio stream from the server, especially if you are splitting up the text into multiple pieces. On a phone display a 4000 character piece of text seems like it would span multiple pages and make it hard for the user to keep up. If you aren't planning to show the text, longer breaks or the ability in the app to stop/pause the TTS temporarily might be welcome.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.