SpeechRecognizer runtime errors

yes
Taifun

I’m not sure that the Clock is necessary in either example.

When the when SpeechRecognizer.AfterGettingText event runs, the partial parameter will be false when the recognition has completed (for whatever reason, and regardless of the UseLegacy property). You should be able to test that variable and then restart recognition if it’s false.

Note well that this is likely to incur a significant power and possibly data use of the device. If it’s for your own use, that’s probably okay, but in the long term may be detrimental to people using your app.

@ewpatton

Attached is a continuous dictation app called Parrot. It indeed does provide continuous dictation; up til the system SpeechRecognizer spawns a 3809 error (No Speech Input). On the error, the app freezes. Supposedly the Stop as indicated below will forcefully stop listening; it does not.

Version documentation indicates Changes between nb177 and nb178 (July 30, 2019)
Added StopListening method to the SpeechRecognizer This involves an improved implementation. A new Designer Property, UseLegacy, was added. By default UseLegacy is set to true (for compatibility with older SpeechRecognizer projects). Setting it to false changes the User Interface (UI) for the Speech Recognizer and permits the “stop” StopListening method to be used , Setting this to false will forcefully stop listening in cases where SpeechRecognizer cannot or will not stop automatically for some reason.

The SpeechRecognizer.Stop does not force the SpeechRecognizer to reset (when UseLegacy is set to false). After about five seconds of inactivity (no speech input detected by the SR) the app receives a 3809 No Speech Input error. Once received, it is not possible to recover and resume listening without the error other than resetting the app. I tried using SpeechRecognizer.Stop using both the Companion and building the apk…same result.

Experience shows when UseLegacy is un checked; Stop() has no effect.

Stop()
Function used to forcefully stop listening speech in cases where SpeechRecognizer cannot stop automatically. This function works only when UseLegacy property is set to ‘false’.

The Stop function does not correct a 3807 RecognitionServiceBusy issue.

In the example I included a Clock to see if providing a slight delay before or after calling Stop had any effect. I notice no difference so I disabled it.

You may want to ‘play’ with this to see what result you get Evan. Stop speaking for five seconds and you probably will freeze the app. parrot.aia (3.8 KB)

Any ideas about how to eliminate or recover from a 3807?

Regards,
Steve

After about five seconds of inactivity (no speech input detected by the SR) the app receives a 3809 No Speech Input error. Once received, it is not possible to recover and resume listening without the error other than resetting the app.

I concur w/ the observation. If you imagine the 'OK Google'-like speech recognizer issues a beep when the recognizer starts and a boop when the utterance times out with no speech input (3809), then after the beep, the AfterGettingText text event is generated whenever there is speech detected with partial == false indicating the end of utterance. However, if the boop ever occurs (no speech detected) The AfterGettingText text event is never generated — necessitating the restarting of the recognizer with a Clock or by some other UI.

Once received, it is not possible to recover and resume listening without the error other than resetting the app.

I have not experienced the situation experienced by @SteveJG that the recognizer is not restartable from the Clock. (Tested on Samsung GS7 & Lenovo Tab 8.)

– dcp

Note: As someone else suggested, I simply have an empty handler for ErrorOccurred.

Hi!

Hope someone has a solution for this:

I use speech recognition and activate it through bluetooth from an external system. This works fine, and as long as I say something it all works well.

A problem arises when I do not speak. The Google speech service times out and a message pops up, see attached file. signal-attachment-2020-04-13-163538

The only way to continue speech recognition is to push te phone’s back button (removes the pop up) or click the Try again button within the popup screen.

Is there a way to avoid this popup or let the app remove it? This is an app to be used while driving and I want to avoid physical interaction with the phone.

This might help:

Thanks!

I just had a look at that, and that app does not use speech detection in legacy mode. When I try my app with legacy mode false, I do not get pop ups on time out either.

Okay, I will stick to the non-legacy mode for the moment.

However when in non-legacy mode, another problem occurs which seem to be a bug: When converting results with “text to speech” the result is often spoken twice. Any information on this problem? I can get around this by using flags but it would be nice to get it fixed.

A final thing I noticed when testing driving is that sometimes the speech recognition does not complete, see attached image. popup1

I spoke the word 50, it was recognized as shown, but the pop up with the result does not disappear. The app does not react on the result, so the “after getting text” flag is not raised.

After a while I get a time out error and a message “no internet connection”. When I check the internet connection of the phone (4G) it appears to be okay.

Closing the app, removing it from memory, and then a restart is needed to make speech recognition work again.

Anyone with suggestions on these problems?

Dear all,
maybe I’m joining this topic too late, and you have already solved everything.
Anyway, I think that the annexed .aia could help a bit.
The (very raw) app that I share is capable to continuously hear the user voice, to recognize the speech in off-line mode, without any prompt nor “beep and boop” of the standard recognizer.
The rationale of this solution is very simple: the app starts the “get text” and waits for a user input. If the user speaks, it catches the voice and writes on a label what it has understood.
If the user does not speech, the timeout elapses and the message “No Speech Input” is raised. By trapping it in the “Screen1 on error” it is avoided to be displayed, and a new “get text” cycle is started. In this way there is no need to have a clock to re-run periodically the get text. It is simply triggered every time it elapses.
To make it working please be aware that it is not possible to restart a “get text” cycle within the “screen1 on error”, but it is necessary to restart it after some hundreths of milliseconds. To this purpose the “screen1 on error” fires a clock after TBD milliseconds (e.g. 500).
Thanks to Taifun extension the “beep&boop” are also silenced.
I’ve tested it on a “unknown” chinese extra cheap tablet featuring an Android 6.1 and a Samsung Grand Neo Phone, Android 4.4.2.
Last but not least, be aware also that if you want to use offline a language different from English, it shall be loaded into the off-line available languages list of your device.
Hoping it can be of some aid.
Warm regards.
(Sorry for my italian-english :-))

Hearing.aia (45.0 KB)

1 Like

how to sove this problem

@Devil_Rider

I expect you are trying to use the SpeechRecognizer with the emulator. Is that true? The SpeechRecognizer needs to be used on a phone or Tablet.

The error could be something else. You did not show all your code. Your Procedure that you left named as ‘procedure’ might be interfering. When you create a Procedure, always change it’s name; never leave it as procedure.

I am using my phone as the emulator,the error occured even after changing the procedure name

Unfortunately, you did not provide an image of your Blocks or tell us how you use the native SpeechRecognizer (you are using the MIT SpeechRecognizer control, aren't you?)

Without more explanation, I've run out of guesses why you get the particular error message, sorry, cannot help.

It would really help if you provided a screenshot of your relevant blocks, so we can see what you are trying to do, and where the problem may be.

To get an image of your blocks, right click in the Blocks Editor and select "Download Blocks as Image". You might want to use an image editor to crop etc. if required. Then post it here in the community.

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.

1 Like

i am trying to make a voice assistant , so when i give the assistant a voice command like “i need calculator” or “open calculator” then it should check if the voice input contains the word “calculator” only and open it.
i cant figure out how i can split the voice input stored in a global variable and check for the corresponding word (in this case “calculator”) is present in the sentence and perform the corresponding activity.

Show your code Blocks please. Exactly what you do to split out ‘calculator’ depends on what you coded. There are several possibilities. It may be as simple as checking your variable like this partial code

containsText

What you should do depends on your existing code.

Yes the above mentioned block method is what i used. In the ‘text’ portion i used the voice input but the problem is, if the input voice completely matches the ‘piece’ then only it will proceed to next block
So from the above mentioned block if my voice input is “calculator"then only further execution take place ,but if i say the voice command “i need calculator” or something else that contain the word “calculator” it should procced to the task in the” then "block

I was starting to write the code and i cant figure out this please help

Without using “or” block

So, are you going to show your code Blocks? Your description of your coding problem is interesting . It is solvable. Without seeing an image of the blocks you coded so far, no one can help because to provide specific advice, someone has to know what you coded.

Please download and post each of those event block(s)/procedures here …
(sample video)