I’m currently trying with the help of a friend to create a “virtual caller” app to be used during training in remote control precision aerobatic.
We have different sequences of aerobatic maneuvers to execute and the goal of the app is to tell what we have to do next (Looping, rolls…).
Here is an example of the flying maneuvers:
The app is currently built so that once you press the button (P21) it start the 1st text to speech (take off) and then start Speech Recognizer to ask for the instructions so that it can be used free hands.
Instructions are simple, either we ask for the next maneuver (“suite” in the code in French) either we ask to repeat the maneuver (“répéter” in the code in French).
The current version of the code is working but we have two main problems.
The speech recognizer period is too short. Sometimes it can take more than 20 seconds until I need to ask for the next maneuver instruction.
Each times this period is passed, the SR goes in “click to try again” mode which is impossible to do during the flight as our hands are not free.
Each times the SR do not understand the instruction, it goes in a sort of failed mode and stop the application.
So could you please help so that the SR automatically start again until it as an instruction, and/or automatically start again until it receive a valid instruction?
Attached is the corresponding .aia file for analysis.
The example Project has a feature to Use Timer and another Auto Sr. Turning both on might provide the response you need to keep the app running. Keep in mind, if the Screen is not touched within a period determined by your device System settings on your tablet/cell phone, any app, not only your app, will 'go to sleep' . Use an extension to make the app work in the background or use a StayAwake routine to force the app to run continuously.
Regarding your second problem, Parrot contains some code to respond to if a command is not understood that may or may not ameliorate the tendency of your app to stop. You need to use if..then..else statements to help the SpeechRecognizer to do what you want. Setting Use Timer and Auto Sr might help you with this issue too. Review the code and Clock settings in the aia and adapt them until your app 'works'.
Unfortunately, App Inventor does not have access to the full SpeechRecognizer library that can be accessed using a professional compiler so one has to use the tools available to make the SR respond better.
My French is terrible. I once was lectured in a restaurant in Northern France in the countryside when I ordered a fish. I could not pronounce truite .The waitress would not provide my order until I pronounced trout correctly. I am not going to be able to test your aia.
Dear @Madslide,
please take a look to the .aia that I've posted a few days ago (annexed).
It creates a continuous speech recognizer and keeps awake the app, so it won't go to sleep even if you don't touch the screen or if you don't speech.
Please be aware that, in order to recognize specific words, the desired language vocabulary shall be available at system level by Android settings. Cont_Speech.aia (88.2 KB)
Hoping it can help you.
Cheers.
Dear @Madslide,
thanks for your like, BTW, if you take a sight to the link below, there are some explanations on how it works. Some clocks shall be used in order to "synchronize" the Speech Recognizer operations.
Though I'm Italian, and the words (written in my code) recognized are obviously italian, I believe that if you set the French language as system (Android) language, it shall work also.
Thank you @SteveJG and Grazie mille @uskiara for your help and suggestions.
I will have a look at both of your Apps and try them in French and/or english (changing command word if necessary). It seems that both apps are based on a clock so it's may be the way to go.
Also I have a plan B which could be to use a "bluetooth foot page turner" boutton. It's perhaps easier to deal with this kind of bouton than the SR.
Also, if some of you have already seen apps using external Bluetooth button, I would be glad to have your advices or a sample code.
Dear @Madslide,
if you want to try with the BT you will find plenty of samples on the community. @Juan_Antonio and @ChrisWard have on their web sites a lot of tutorials and chunks of code on the matter. My only suggestion, whether you will really approach to use the BT, is to stay on the "classic" version of BT and leave the BLE for future occasions (oldie and goodie ).
At least in my experience I've interfaced so many HC05, HC06 and ESP32 with 0 (zero) problems that I really suggest you this type of BT.
But before ceasing with the SR, please try my .aia, it is very simple, and (at least on my devices) it works well.
Bonne chance et à bientot.
Ugo.
PS je parle un petit peu le Français, donc si tu veux m'écrire en Français, n'hésite pas.