This is an alternate version of the Voice Recognition Component
New Features:
Ability to disable the Google dialogue,
Turn off the sound prompt signal,
Continuous listening (hands free),
and other…
Can be used in robots, running Android; Voice assistants and etc.
New properties (default all is false ):
EnableGoogleDialog (boolean) - if “true”, then the recognition works in normal mode. No additional features (described below) is working.
MuteAudio (boolean) - if is “true”, then Google prompt sound signal are disabled before and after recognition. In reality, all sounds are turned off, but only for the duration of the listening. That, after recognition, or recognition errors, the sound immediately turns on.
ContinuouslyRecognitionEnabled (boolean) – in case the “false”, if the user is silent, the component will return an empty string result and generate “No voice input” error. Otherwise, the audition just automatically resumes every time. A related error does not occur.
PreferOffLine (boolean) - if “true to indicate whether to only use an offline speech recognition engine. The default is false, meaning that either network or offline recognition engines may be used. (Starting with Android version 6.0).
LastError (String) read-only - A description of the errors is stored here, if they occurred during the last recognition. When you start a new service, this information is erased.
ExtraPrompt (String) - when the Google dialog is displayed, the inscription on it can be replaced with its own. If there is an empty line in its field, then the inscription remains Google.
KeepScreenOn (boolean) - If you app window is visible to the user, keep the device’s screen turned on and bright.
IsListening (Boolean, Read only) - You can find out if he is currently listening.
EnablePartialResult (boolean) - Allows to have intermediate recognition results when the user continues to speak.Allows the occurrence of an event “AfterPartialResults”.
New method :
StopASR () - used to forcefully stop the Continuously Recognition process.
New Events :
OnError () - when error of recognizing is occur, the user receive the description and saves it in LastError.
Possibles errors :
“Audio recording error”
“Client side error”
“Insufficient permissions”
“Network error”
“Network timeout”
“No speech input”, “No match” (automatic restart in the Continuously Recognition mode )
“RecognitionService busy”
“Error from server”
“Didn’t understand, please try again”
“Speech Recognizer not Available!”
OnRmsChanged Event occurs when Microphone input is change. Gives an integer 0…10. It is used to dynamically indicate the microphone status in the voice recognition process.
AfterPartialResults Event occurs when exist Partial Results.
New properties for implementing the keyword wait function:
KeywordEnable (Boolean, default is False),
Keyword (String, default is Empty),
KeywordTimeSeg (Integer, default is 30S).
How it works:
Provided that KeywordEnable =true , Keyword != Empty , ContinuouslyRecognitionEnabled=true and EnableGoogleDialog=false, the AfterGettingText event will not appear until the recognition result contains a Keyword . In this case, the recognition service will restart automatically. At the same time, the AfterPartialResults event will occur as usual and transmit the recognition result. After the first occurrence of the AfterGettingText event, over KeywordTimeSeg time (in seconds), after each recognition, the user can conduct a dialogue without pronouncing the Keyword . After silence exceeding KeywordTimeSeg time, the user must again utter a phrase containing a keyword in order to continue the dialogue.
Current version:
ScSpeechRecognizerV9_1.aix (20.1 KB)
Test project:
TEST_ASR_V9_1.aia (23.8 KB)
Possible solution for the extension to work correctly with Android 11 and older.