C++ version of dscripka/openWakeWord.
Fork from @rhasspy C++ version.
This fork adds support for Android.
ATTENTION: Startup scripts automatically install non-existent tools (curl, tar, unzip, make, g++, ffmpeg, sox, arecord, pulseaudio, pactl) !
All operations are transparently logged in the terminal.
I was assisted by AI, and so far I have only tested the macOS and Android Termux versions. The Android app was also working before I added the Termux version, so I hope I didn’t break it.
./build.shor for Androin Termux terminal:
./build-androidTermux-from-pc.shNot required: ---ANDROID_SDK, -onnxruntime 1.23.2
But Android Studio mut by installed.
./start.sh --model alexa_v0.1
./start.sh --model alexa_v0.1 --threshold 0.5 --trigger-level 4 --optimizeUnstableSystems--modelsearching inopenWakeWord-cpp/models,openWakeWord-cpp/../models. You can add multiple--model <path>arguments. You can generate your own wake words through the original project.--optimizeUnstableSystemsfor lightly smartphones (DisableMemPattern, DisableCpuMemArena, ORT_DISABLE_ALL graph optimizations).--helpfor more options.
Useful environment overrides, when auto-detection does not match your setup:
OPENWAKEWORD_BIN- explicit path toopenwakewordexecutable.OPENWAKEWORD_ORT_LIB_DIR- explicit ONNX Runtime lib dir for desktop.ORT_LIB_DIR- explicit ONNX Runtime lib dir for Termux.OPENWAKEWORD_WIN_MIC- explicit Windows microphone name for ffmpeg dshow.
If Termux microphone is not found, verify Android mic permission for Termux and PulseAudio source availability.
If Windows mic auto-detection fails, list devices with:
ffmpeg -list_devices true -f dshow -i dummy
- openWakeWord-cpp path:
android/app/src/main/cpp/openWakeWord-cpp - onnxruntime-android path:
android/app/src/main/cpp/onnxruntime-android - models path moved from android/app/src/main/cpp/openWakeWord-cpp/models to:
android/app/src/main/assets/models
android/app/build.gradle:
android {
defaultConfig {
minSdkVersion 27
ndk {
ldLibs "log"
}
}
externalNativeBuild {
cmake {
path "src/main/cpp/openWakeWord-cpp/src/android/CMakeLists.txt"
}
}Example of Android service is in openWakeWord-cpp/src/android/OpenWakeWordServiceExample.java. There C++ part is defaulted end after waking, and started after manualy calling the service (intend) again.
- Extras with
endproperty end service. - Extras with
stopproperty end cpp subprocess. - Extras with
keywordproperty start service, or only cpp subprocess, and set wake word model path. Default ismodels/alexa_v0.1.onnx.- Optional extras
sensitivityas string value. Default is0.5. - Optional extras
closeServiceAfterWakeWordActivationproperty end android service after waking (cpp subprocess is end by hardcode). Default isfalse.
- Optional extras
- Don't forget to create first
NotificationChannelin MainActivity. - Android destroy service automaticly after same time, that's why you must set
Worker, which will call this service each 16 minutes.