Wakeword detector based on OpenWakeWord-cpp but faster, cleaner and more lightweight.
- Plain C/C++ implementation with minimal dependencies (ONNXRuntime)
- Runs on ARM as well (Tested on RPI 3,4 and 5)
- Written with performance in mind, < 3% CPU utilization on x86/64 CPUs
This library offers support for:
- Single-model wakeword detection
- Multi-model wakeword detection
This is some example code for wakeword detection:
...
/* Create new Lowwi runtime */
CLFML::LOWWI::Lowwi ww_runtime;
/* Create new wakeword */
CLFML::LOWWI::Lowwi_word_t ww;
ww.cbfunc = wakeword_callback;
ww.model_path = "models/example_wakewords/hey_mycroft.onnx";
ww.phrase = "Hey Mycroft";
/* Add wakeword to ww-runtime */
ww_runtime.add_wakeword(ww);
std::vector<float> audio_samples;
...
while(1) {
ww_runtime.run(audio_samples);
}
Just create two or more Lowwi_word_t's:
...
/* Create new wakeword */
CLFML::LOWWI::Lowwi_word_t ww;
ww.cbfunc = wakeword_callback;
ww.model_path = "models/example_wakewords/hey_mycroft.onnx";
ww.phrase = "Hey Mycroft";
/* Add wakeword to ww-runtime */
ww_runtime.add_wakeword(ww);
/* Create new wakeword */
CLFML::LOWWI::Lowwi_word_t ww2;
ww2.cbfunc = wakeword_callback;
ww2.model_path = "models/example_wakewords/hey_jarvis.onnx";
ww2.phrase = "Hey Jarvis";
/* Add wakeword to ww-runtime */
ww_runtime.add_wakeword(ww2);
For a full example showcasing the API functions see the example code in example/LOWWI_demo_mic/demo.cpp.
Before using this library you will need the following packages installed:
- Working C++ compiler (GCC, Clang, MSVC (2017 or Higher))
- CMake
- Ninja (Optional, but preferred)
- SDL (when using Lowwi mic example)
- Clone this repo
- Run:
cmake . -B build -G Ninja
- Let CMake generate and run:
cd build && ninja
- After building you can run (linux & mac):
./LOWWI_demo
or (if using windows)
LOWWI_demo.exe
Add this to your top-level CMakeLists file:
include(FetchContent)
FetchContent_Declare(
Lowwi
GIT_REPOSITORY https://github.com/CLFML/lowwi
GIT_TAG main
SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/lib/Lowwi
)
FetchContent_MakeAvailable(Lowwi)
...
target_link_libraries(YOUR_EXECUTABLE CLFML::Lowwi)
Or manually clone this repo and add the library to your project using:
add_subdirectory(lowwi)
...
target_link_libraries(YOUR_EXECUTABLE CLFML::Lowwi)
See our wiki...
- Add language bindings for Python, C# and Java
- Add support for MakeFiles, Bazel and Conan
- Add Unit-tests
- Add TPU support
- Add automatic wakeword training
- Merge melspectrogram & embedding model?
This work is licensed under the Apache 2.0 license.