Text to Speech for a book

I’m looking for a way to use text to speech to save the placement in a book. So the user would have the ability to pick up where they left off the next time they resume reading.

I’m thinking maybe variables could be the solution but I can’t figure out how to tie in where the text to speech stops and starts.

Thanks all

What if you broke your text up (into sentences? Or paragraphs?) and used a stored variable to record the most recently played sentence/paragraph?

1 Like

I thought about that but it is way too long to break up that many times.

I wouldn’t do it manually! :slight_smile: Code it!

I’m wondering if there’s a built in way though in Thunkable, that would be ideal and more efficient.

Hopefully someone has done something similar in the past.

Try this block:

image

OK, this might seem a long shot, but you might want to make a list from text with a delimiter ‘.’, as @skulamester suggested. But I doubt that all your sentences would end with a full stop.

Ok I’ve been doing some work on this.

Currently as it cycles through each iteration it changes the variable pretty much instantly to the next, so it just go straight to the end of the story in a matter of seconds.
I need the counting to pause while the text to speech is speaking. Then once the speaking is done for that sentence, it needs to change the variable +1 and continue.

But I can’t get it to pause while it’s speaking is the new problem.

Thanks for the tip with the list though, that seems to be the right direction to go.

Edit: I also thought about building in a timer, but there’s no way to be sure that each paragraph or sentence will always take the same amount of time to speak out loud.

Could you take the average length of a word and determine how long it takes text to speech to say that and then multiply by the number of words in the text? And then maybe add a buffer of a second or two? You’d have to test it to see how reliable it was.

Edit: a quick test shows that the English text-to-speech engine reads at about 3 words per second. You probably could get away with 3.4 words per second.

1 Like

Here’s a demo:

https://x.thunkable.com/copy/d96b2d90528c5231bd2099a55ee407b4

1 Like

Ya this is great, the problem now is having the ability to stop and start on command and save the current position in the text.

I don’t see a proper way to do that with what we’ve got here.

Unless you separate the full text into single words (which you can do quite easily with the blocks from my demo), you can’t. But if you had a list of words from the full text, then you could speak each word and the user could stop at any time. I have no idea how choppy that would sound though!

I’ve tried delimiting with just a single space, so it does break them up for each word, but yes it is in fact extremely choppy.
As bad as the native text-to-speech already sounds with no inflection it gets terribly worse when broken up by spaces.

1 Like

It’s too bad these blocks don’t have a pause and restart, or the ability to start at a certain point, or a way to know they’ve completed.

Yes exactly what I was thinking, there should be some type of “is still speaking” or something.