Android: speech rate and backend switching are not reflected properly #17
Replies: 11 comments
-
|
Hi there, Can you provide more info? Specifically, the speech rate thing is a bit weird. In Android, there is no upper limit to speech rate. So, in theory, the upper bound could be infinity. This is obviously a huge problem for Prism, since we would like "1.0" to map to the maximum rate supported by the backend. To alleviate this, I did a lot of digging and decided to use what the settings app uses as a hard limit, which is 600 percent. However, the rate may be slow because I am using the wrong numeric transform; at the moment we use a linear piecewise transformation, but it may need to be an exponential or logarithmic one. So that may need some fiddling with to get right. It doesn't help that testing on Android is such a spurious/difficult thing to do, so I gave up on eventually trying, which wasn't what I wanted to do but testing across API levels 30-36 proved to be a non-starter when I tried. This definitely falls under a bug, so please open an issue so we can track it. You can just reference this discussion for context, or re-describe the problem there in more detail and provide an MRE. With respect to your second problem, can you clarify exactly what's happening? Can you provide the code your using? You must also keep in mind the multi-threading requirements of the docs as well if you are using Prism in a multi-threaded context. |
Beta Was this translation helpful? Give feedback.
-
|
@ethindp Here is the code I use for backend switching and speech rate. Here, Prism is also called from a background thread: "Task.Run(... _speech.Speak(...))" |
Beta Was this translation helpful? Give feedback.
-
Then you need to synchronize access between both threads. Please thoroughly read the documentation around multi-threaded requirements. |
Beta Was this translation helpful? Give feedback.
-
I have already done so, and the result was the same. I am doing this in DotNet: All methods such as Speak, Init, backend selection and queries use "lock (_sync)". So not really sure then what is the problem. |
Beta Was this translation helpful? Give feedback.
-
|
Ah okay. I will have a test binary soon which in theory should solve both of these but we will see |
Beta Was this translation helpful? Give feedback.
-
|
I've mentioned that the problem of speech rate has been fixed. I just want to add something here which is that switching backends on Android still fails, and I haven't been able to identify the problem yet. |
Beta Was this translation helpful? Give feedback.
-
|
Understandable. I'm not entirely sure why the backend switching issue is occurring. Can you walk me through what exactly happens? Like, does the app crash outright? I don't have an android test device, and Prism is extremely unreliable on the Google-provided Android emulator images due to problems outside my control. So testing these backends to ensure that they are as stable as I would like them to be is quite challenging. I'm not at all happy about it and would like to dramatically improve things in future. |
Beta Was this translation helpful? Give feedback.
-
|
@diamondStar35 Even better, could you provide me with a test app that reproduces this other problem? I can try to get emulator stuff to work on my machine to locally debug the problem. |
Beta Was this translation helpful? Give feedback.
-
|
Thanks for at least trying to help. No, the app does not crash. What happens is that whenever I switch to another backend, Prism gets completely stuck even if I do that and if there was no speech running. The app continues to run normally, but because Prism is stuck, all backends are unavailable and thus they do not show. I have to restart the app for the new backend to take effect. Like I mentioned, none of this happens at all on other platforms, not even Linux, even before synchronizing threads honestly. I have tried looking at the adb logcat to see if there are any exceptions but there was nothing related to Prism. |
Beta Was this translation helpful? Give feedback.
-
|
@ethindp Will create a test app in a few. |
Beta Was this translation helpful? Give feedback.
-
|
@ethindp Thanks for your idea, it actually helped me a lot to isolate the problem. Not sure if this was stated somewhere explicitly, but Android speech backends need an Android looper context with a looper-backed thread. I tried different solutions on that test app I've created, and the first thing I did was trying a single worker thread for all Prism calls. It worked for everything except backend switching. I switched to a looper-backed thread with a looper context, backend switching behaved normally. Sorry if this was stated somewhere. If you still want the source of the test app to see it, I could upload it here too. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello.
First of all, I'm sorry if it seems like I'm opening too many discussions or issues.
I have encountered 2 behavioral problems when integrating Prism into an Android project, and not really sure if they are bugs or that is the intended behavior.
The first issue is that, when using the TTS backend and not the Android screen-reader one, I have an issue where speech rate is not being reflected properly in Prism. It doesn't even depend on the system's default speech rate because:
At first when I used that backend, it was so slow. I tried increasing the system's speech rate, it did not help. The only thing that really helped a little, is increasing speech rate through the TTS engine itself, but even so, I think Prism does not map this correctly.
Normally when I use the TTS engine, setting speech rate to 50% is not slow. However, in Prism it's very slow, even when setting speech rate to 1.0 in Prism itself. I do not know what is the problem, but I can provide any needed info.
The other problem, which only happens on Android: when switching to another speech backend, Prism completely stops speech and I have to restart my application in order for the new backend to take effect. Is this a known bug or something wrong with my code?
The only reason I mentioned this here is that it never happened to me neither on Windows or Linux.
Regards.
Beta Was this translation helpful? Give feedback.
All reactions