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.
-
Are you looking for an SDK to integrate with an app you write – or for a ready-to-use app which "shares" the recognized text to other apps?– IzzyCommented Jan 24, 2017 at 12:57
-
My apologies, I do mean an SDK. But one that can be used on device, as opposed to having to use a cloud based API– ishidoCommented Jan 24, 2017 at 13:48
-
There's Pocketsphinx. I only know that because we have a similar need for Gadgetbridge, also discussed here, where it was said not to be that useful.– IzzyCommented Jan 24, 2017 at 16:05
-
wow, love seeing so much development in this area. without starting another thread, is it possible to use one of the aforementioned methods by simply installing an android apk and changing settings to implement it in place of google voice? I will root, degoogle, and move to more privacy centric apps (an good offline gesture keyboard is also a need, as well a a private encrypted calendar service that accepts and shares ics, etc). I am not tech savvy enough to try to use vosk or deepspeech above the way described. I might be able to run a simple script once rooted. Can these be installed via an– Adam DCommented May 20, 2021 at 14:46
6 Answers
You can use Mozilla's DeepSpeech. Some people have reported it works on Android:
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
-
This is awesome and should be the top answer right now! … I have to check how resource-intensive it is. Those things weren’t offline because phones were too slow, in the past.– anonCommented Apr 27, 2023 at 17:06
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 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)
- There are bindings for different programming languages, too - java/csharp/javascript etc.
- Allows quick reconfiguration of vocabulary for best accuracy.
- Supports speaker identification beside simple speech recognition.
I'm currently doing my own research on this, and here are the top contenders I'm finding as of April 2024:
Free / Open Source Solutions
- whisper.cpp: This is a cross-device compatible implementation of OpenAI's Whisper model.
- DeepSpeech fork by zhouwg: Android specific version of DeepSpeech
Commercial Solutions
- Google Cloud Speech-to-Text On Device: Very promising, but pricing is opaque.
- PicoVoice Cheetah: Also promising, but pricing model lacks scale for consumer apps.
There are two new players:
- Dicio Assistant
- FUTO Keyboard (Previously just "FUTO Voice Input")
Both are open source, extremely fast and work fully offline. In terms of accuracy, FUTO Keyboard appears superior, but it is of course just a keyboard with voice input, not an entire assistant.
- Dicio is free and based on Vosk (open source). Development seems rather slow. It is available on F-Droid through the official repository. You can configure it as your Assistant on Android. It allegedly supports voice keyboard input as well, but I could never get it to work. The "assistant" features are, at the time of writing, fairly limited. Supported features are: Weather, Web Search, Open app, Search song by lyrics, Navigate, Call, Time.
- FUTO Keyboard is based on Google's AOSP Keyboard combined with OpenAI's Whisper, both open source. On F-Droid it is only available through the FUTO repo, not through the official repository at the time of writing. The App/company is getting a lot of media attention recently through right-to-repair activist Louis Rossmann and appears to have a lot of funding. The app is free, entirely lacks the Internet permission, thus is not able to "spy" on you, but it will ask for your donation: