Android Question Using TTS

nypaulie

Active Member
Licensed User
Longtime User
About 6 years ago I wrote a b4a program to keep track of Bingo numbers that had been called. I improved it by adding a text to speech feature that called out the numbers using the TTS library. This works fine on my small Fire tablet, but not on a larger screen Fire I got. The graphics are OK but no sound. It is the same .apk file. Any thoughts? Looks like this may be a Fire Tablet issue, but I thought I'd take a chance here.
 

epiCode

Active Member
Licensed User
About 6 years ago I wrote a b4a program to keep track of Bingo numbers that had been called. I improved it by adding a text to speech feature that called out the numbers using the TTS library. This works fine on my small Fire tablet, but not on a larger screen Fire I got. The graphics are OK but no sound. It is the same .apk file. Any thoughts? Looks like this may be a Fire Tablet issue, but I thought I'd take a chance here.
Install some TTS app from playstore to check if it is working. If it does not, check if you have TTS installed on tab.
 
Upvote 0

nypaulie

Active Member
Licensed User
Longtime User
I installed another TTS apk on both Fire Tabs and yes, it worked on the 6", but not the 7". I still haven't been able to turn TTS on even after doing a lot of Google searching. Do you know how? Thanks for your help.
 
Upvote 0

epiCode

Active Member
Licensed User
I installed another TTS apk on both Fire Tabs and yes, it worked on the 6", but not the 7". I still haven't been able to turn TTS on even after doing a lot of Google searching. Do you know how? Thanks for your help.
Install google TTS from play store and check if it works.
 
Upvote 0

nypaulie

Active Member
Licensed User
Longtime User
I installed a program called: "Natural Reader" and it works. I thought maybe this would have done something so I tried my B4A creation again and no voice. A puzzle...
I am going to see if deleting/reinstalling will do anything.
 
Upvote 0

nypaulie

Active Member
Licensed User
Longtime User
Install google TTS from play store and check if it works.
Still have no sound, even after installing the google TTS apk. Funny tho how some TTS apps do work, but not my b4a one. If I unzip the .apk file I wrote 6 years ago and update the .bal file how do I rezip the files into a "new" .apk? Is this possible? I looked into using zipalign, but the info was greek to me.
 
Upvote 0

epiCode

Active Member
Licensed User
Still have no sound, even after installing the google TTS apk. Funny tho how some TTS apps do work, but not my b4a one. If I unzip the .apk file I wrote 6 years ago and update the .bal file how do I rezip the files into a "new" .apk? Is this possible? I looked into using zipalign, but the info was greek to me.

Find and Replace your ,bal file (most likely in asssets folder)
You will have to sign you new zip with a tool like apksigner
 
Upvote 0

drgottjr

Expert
Licensed User
Longtime User
2 thoughts:
runtime permissions
log output

i don't use fire, and i don't know if their version of android even
requires runtime permissions, but i see that the 6" runs
a version of android that doesn't require runtime permissions.
the 7" does. on an android device that would be a big issue.

the tts library raises an event when speaking is done.
you could log that event just to make sure the "speaking"
is occurring (even though you can't hear it). it's unclear
from your description (at least to me) whether it's a sound
issue or a failure due to, eg, runtime permissions and the
granting of same.
 
Upvote 0

nypaulie

Active Member
Licensed User
Longtime User
2 thoughts:
runtime permissions
log output

i don't use fire, and i don't know if their version of android even
requires runtime permissions, but i see that the 6" runs
a version of android that doesn't require runtime permissions.
the 7" does. on an android device that would be a big issue.

the tts library raises an event when speaking is done.
you could log that event just to make sure the "speaking"
is occurring (even though you can't hear it). it's unclear
from your description (at least to me) whether it's a sound
issue or a failure due to, eg, runtime permissions and the
granting of same.
The runtime permissions answer seems most likely. That I can run only some of the TTS-using apps may mean that the ones that do work include all the needed requirements and do not rely on getting any permission. Think so? As to recording a "log", how would I go about that? Thanks you so much. I will look into the permissions issue next.
 
Upvote 0

drgottjr

Expert
Licensed User
Longtime User
to clarify: the runtime permissions could affect aspects of
the app not related to TTS. i don't know what your app does
(beyond speaking letters and numbers). in the logs tab of
the IDE there is a "permissions" button. you click on it to see if
your app requires "dangerous" permissions. you would then
need to edit the manifest and, perhaps, add a runtime
permissions dialog to the app. if permissions are required,
the app would appear to run but you would see something in
the log about unsatisfied permissions. yeah, my thought was that
if some TTS apps run ok on the device, those apps were correctly
handling permissions required on post android 5 models


regarding TTS, i assume you know you're supposed to
wait until the engine has synthesized an utterance and
triggers the "ready" event. there may have been changes
to the library over the years reflecting how strongly that
rule is enforced.
and as for logging, i was slightly mistaken. the TTS library
raises the "ready" event. within that sub, you simply put

B4X:
' somewhere:     tts.Initialize("mytts")

' somewhere else:
Sub mytts_Ready (Success As Boolean)
    Log("is ready?: " & success)
End Sub

that tells you the engine, at least, is working on your 7" tablet.

where i was mistaken regards what
happens when the engine has finished speaking. the TTS
library does not raise an event at that time. such an event
occurs in android's TTS api (upon which our TTS library is
based). but our library doesn't expose that part. there is
another TTS library (called TTSID),which may address
that. i remember trying it once. it's somewhat more involved
than our regular TTS library. there are some issues
about reliably capturing exactly what happens when the engine
stops talking. perhaps that is why it was not included in our TTS library.
 
Upvote 0

nypaulie

Active Member
Licensed User
Longtime User
to clarify: the runtime permissions could affect aspects of
the app not related to TTS. i don't know what your app does
(beyond speaking letters and numbers). in the logs tab of
the IDE there is a "permissions" button. you click on it to see if
your app requires "dangerous" permissions. you would then
need to edit the manifest and, perhaps, add a runtime
permissions dialog to the app. if permissions are required,
the app would appear to run but you would see something in
the log about unsatisfied permissions. yeah, my thought was that
if some TTS apps run ok on the device, those apps were correctly
handling permissions required on post android 5 models


regarding TTS, i assume you know you're supposed to
wait until the engine has synthesized an utterance and
triggers the "ready" event. there may have been changes
to the library over the years reflecting how strongly that
rule is enforced.
and as for logging, i was slightly mistaken. the TTS library
raises the "ready" event. within that sub, you simply put

B4X:
' somewhere:     tts.Initialize("mytts")

' somewhere else:
Sub mytts_Ready (Success As Boolean)
    Log("is ready?: " & success)
End Sub

that tells you the engine, at least, is working on your 7" tablet.

where i was mistaken regards what
happens when the engine has finished speaking. the TTS
library does not raise an event at that time. such an event
occurs in android's TTS api (upon which our TTS library is
based). but our library doesn't expose that part. there is
another TTS library (called TTSID),which may address
that. i remember trying it once. it's somewhat more involved
than our regular TTS library. there are some issues
about reliably capturing exactly what happens when the engine
stops talking. perhaps that is why it was not included in our TTS library.
It is now WORKING. I poked around the Fire and tried to see what I could fiddle with and tried activating "VoiceView" which gives you a spoken description of every keyboard activity you trigger. What an annoying thing! When I turned it off my program as it turned out does now speak. I guess that VV thing activated the TTS machine. At any rate I am good to go and can move on with modifying my program. Thanks to all for helping. I am going to change the subject to [Solved], etc. later and explain what I did.
 
Upvote 0

MicroDrie

Well-Known Member
Licensed User
Nice to read that TTS was started. Don't forget to reboot the tablet and start as first app your program tot test if TTS is permanently working after a cold start.
 
Upvote 0
Top