Are there any alternatives to Android's native speech recognition engine that can be used on-device for an app? I do mean an SDK. But one that can be used on device (offline), as opposed to having to use a cloud based API.
You can use Mozilla's DeepSpeech. Some people have reported it works on Android:
My company develops SDKs for on-device speech recognition for iOS and Android devices.
We have trial SDKs and couple of PoC apps on Github that you can use to evaluate the SDK. I recommend you review general overview pages at https://keenresearch.com/keenasr-docs and then Android-related pages.
You could use Termux-DeepSpeech and configure Android to use that instead of the "OK Google" voice assistant. It's offline and open source since it's based on Mozilla's DeepSpeech.
Do note however, that you have to define the voice commands yourself. For example:
WORDS="$(speech2text)" # This will listen to the microphone for (by default) 2 seoncds and the write what you said in the variable WORDS if [[ "$WORDS" == "light" ]]; then # If you said the word "light" termux-tts-speak "Turning flashlight on" # Let a robot voice say "Turning flashlight on" termux-torch on # Turn the flashlight on fi
You can use Vosk, an open source speech recognition engine.
Android demo is here.
- Supports 9 languages - English, German, French, Spanish, Portuguese, Chinese, Russian, Turkish, Vietnamese. More to come.
- Works offline, even on lightweight devices - Raspberry Pi, Android, iOS Installs with simple
pip3 install vosk
- Portable per-language models are only 50Mb each, but there are much bigger server models available.
- Provides streaming API for the best user experience (unlike popular speech-recognition python packages)
- Allows quick reconfiguration of vocabulary for best accuracy.
- Supports speaker identification beside simple speech recognition.