Speech recognition does not work if device connected to Local webserver

624 views
Skip to first unread message

Naveen Shetty

unread,
Apr 12, 2018, 2:49:20 AM4/12/18
to MIT App Inventor Forum
Hi,
For the IOT project i have a webserver which is flashed on a micro-controller  nodemcu chip. I have screen designed in MIt app2 to voice activate certain switches. The process goes:

1) Set android device to connect to local hosted Webserver over wifi.
2) Click button to speak the command .
3) The command is passed to a Text label.
4) This command is converted to "Get" request for the local webserver. ( using WEB component)
5) The webserver accepts the request , performs some actions and sends the response as an HTML plain text.
6) The HTML response is format to plain text and then sent for Text to Voice conversion.

In this case if i connect to my webserver and give any command by click the button , the speech recognizer does not seem to capture it , but if i switch off my webserver and give the command , the speech recognizer recognizes it and passes it to the text label and it goes ahead with the remainder of the process. ( in this case since the webserver is off it will throw an error, which is understood)

But am not sure as to why the speech recognizer fails to work when its connected to the local webserver. it works fine if not connected or if connected to the internet.

rgds
naveen





SteveJG

unread,
Apr 12, 2018, 9:54:49 AM4/12/18
to mitappinv...@googlegroups.com
This StackOverflow discussion possibly explains why you cannot use 'offline' speech recognition with your own server. The ability to 'recognize speech' depends on your Android OS version and  the device's hardware.  There are two ways to use Google's speech recognition; one uses the on line recongizer, the other uses software available on some devices.   I am not sure whether the App Inventor 2 Speech component can differentiate between the two methods.

See https://stackoverflow.com/questions/19564561/does-the-google-speech-recognizer-on-android-need-internet  .    The article probably has the information to help you answer your "why the speech recognizer fails to work when its connected to the local webserver" .   The which recognizer is used possibly depends on whether an Internet connection exists or not.  When you connect to your local system, it might be confused or does not acquire the expect link.... just a guess.   Other possibility ... there is a timing issue and it is impossible to complete a request through your server to post the required information.

Since you are using an emulator (as shown in your thread header), I don't see how you can get the Android Speech Recognizer to work at all with the basic Android emulator.

Regards,
Steve

Naveen Shetty

unread,
Apr 13, 2018, 1:39:41 AM4/13/18
to MIT App Inventor Forum
Hi Steve,
Thanks for the information . In my case i am not using the emulator , i download the build on my Lenovo Tablet on android OS version 4.4.2 and try from there.Also i have made the default speech as English ( USA) as it's only using this the speech recog works offline

As you state there are two ways of connection and in one case it uses the devices google speech recognition, Is there any app to upload / update the google speech software on the device and make the MIT refer to this?

rgds
Naveen

SteveJG

unread,
Apr 13, 2018, 8:46:47 AM4/13/18
to MIT App Inventor Forum
Sorry Naveen, I have no idea.  You might search the StackOverflow forums. https://stackoverflow.com/questions/17616994/offline-speech-recognition-in-android-jellybean  Only some phones have the capability of using the offline speech recognizer (Jelly Bean and above).
Reply all
Reply to author
Forward
0 new messages