Text to Speech Issue When Pressing the Button for the First Time

723 views
Skip to first unread message
Assigned to halab...@google.com by me

Glassy

unread,
Apr 23, 2014, 12:08:30 AM4/23/14
to mitappinv...@googlegroups.com
Hi,

I have put some text to speech buttons on my app and also set it so that the language being used is always English - even if the phone is using another language, however when I press any text to speech button, there is a big delay of about 5 seconds before sound comes out for the first press of the button when the phone is set to English language, then it's fine after that. If the phone is set to any other language, the first press of the button after the app is opened is always in the language that the phone is set to, then it changes to English on the next button press.

I have the latest - Google Text To Speech installed and I have tested the app out on my Galaxy S3 and Bluestacks Emulator and both have exactly the same problem. The Galaxy S3 has Android 4.3 installed.

I will show my blocks below.




Any help with this problem will be much appreciated. I would like to be able to get the buttons to work instantly and always in English if possible?

Thanks,

Glassy.


Enis

unread,
Apr 23, 2014, 12:32:32 AM4/23/14
to mitappinv...@googlegroups.com, glas...@gmail.com
Hi Glassy...

The problem is that the text-to-speech module has to report back and say that it's initialization was successful before it can speak.  The first time you call it to say something, internally, it has to initialize the TTS engine and when that's successful, it reports back that it's ready and then can talk.

This is actually a function of the device itself....

Glassy

unread,
Apr 23, 2014, 1:50:23 AM4/23/14
to mitappinv...@googlegroups.com, glas...@gmail.com
Hi enis,

Thanks for your feedback. So does this mean there is nothing that can be done in the App Inventor to prevent this from happening?

Does this happen on most devices?

I also forget to mention that the language goes back to what the language is set to in the device and speaks in this language on the first button press - each time I go to a new screen, not just when I open the app. So if I am trying to make a translator app for people to learn English, this wont look very professional as each time they go to a new screen and press a button, the first press always speaks in their language.

Hopefully there is a solution for this?

Enis

unread,
Apr 23, 2014, 1:59:42 AM4/23/14
to
Hi... Not only is this an App Inventor thing, it's also an issue in many other languages.  The program always has to ask to use the tts function, and the device always has to answer back before something can be spoken.

You'll have to set the language for the component on every screen.  In App Inventor, each screen is like it's own little app...FYI Glassy, set the language in the properties on the designer screen... set them there and they should initialize with those settings.

Hope that helps...

Glassy

unread,
Apr 23, 2014, 2:40:58 AM4/23/14
to mitappinv...@googlegroups.com
Hi enis,

Thanks again for your input.

So would setting the language in the designer section prevent the app from going back to the language that the device is set at each time the users goes to a new screen?

I'm pretty new to App Inventor so I have no idea how to set this up in the designer so any help with this would be great thanks.


Cheers.








On Wednesday, April 23, 2014 3:59:07 PM UTC+10, Enis wrote:
Hi... Not only is this an App Inventor thing, it's also an issue in many other languages.  The program always has to ask to use the tts function, and the device always has to answer back before something can be spoken.

You'll have to set the language for the component on every screen.  In App Inventor, each screen is like it's own little app...FYI Glassy, set the language in the properties on the designer screen... set them there and they should initialize with those settings.

Hope that helps...


On Wednesday, April 23, 2014 1:50:23 AM UTC-4, Glassy wrote:

Glassy

unread,
Apr 23, 2014, 5:20:19 AM4/23/14
to mitappinv...@googlegroups.com, glas...@gmail.com
If there are any experts on how to overcome this problem, I would appreciate your feedback. I don't mind so much the initial delay when pressing the first button as long as it doesn't happen again until I re-open the app.

The bigger problem is, when the user has their device set to another language and you press the first button on a new screen, it always uses the language other than English so it just keeps doing it whenever you open a new screen. Is there is a way to overcome this, if so, I will be stoked?

Cheers,

Glassy.

glas...@gmail.com

unread,
Apr 23, 2014, 5:20:43 AM4/23/14
to mitappinv...@googlegroups.com, glas...@gmail.com

Hal Abelson

unread,
Apr 23, 2014, 7:19:56 AM4/23/14
to mitappinv...@googlegroups.com, glas...@gmail.com
I haven't tested your app, but it looks like you are setting the language to English *after* you are telling the device to speak.   Try changing the order of the blocks so that it speaks after you set the language.    
Also, from the name "screen21" on your block, I infer that you have at lest 21 screens.   That's a huge number of screens.  Think about redesigning your program to use fewer screens.

Glassy

unread,
Apr 23, 2014, 8:23:03 AM4/23/14
to mitappinv...@googlegroups.com, glas...@gmail.com
Hi Hal,

Thanks for the suggestions. I will try setting blocks as you say and report back on how that goes.

So it's not good to have that many screens? I have about 20 different screens for each category plus the home screen, I guess I will have to combine some categories to make less screens.

Does having this many screens cause an app to load slower or crash more easily?

Cheers.

Hal Abelson

unread,
Apr 23, 2014, 8:36:44 AM4/23/14
to mitappinv...@googlegroups.com, glas...@gmail.com
A screen on App Inventor takes lots of resources and space.  Try to design to minimize the number of screens.  I rarely make apps with more than a few screens.

This about why you are creating so many screens.  For example, if you are making a new screen just to have different text on a button or a different screen background, use a single screen where you change the button text or the screen background.

Glassy

unread,
Apr 23, 2014, 8:44:29 AM4/23/14
to mitappinv...@googlegroups.com, glas...@gmail.com
OK,

So your suggestion works by reversing the blocks around, thanks for that. It goes strait to English each time but there is a bit of a pause before it speaks but there is nothing that can be done about this right as this is the way that the tts works?

I will try your other suggestion too.
Reply all
Reply to author
Forward
0 new messages