Skip to content
/ lowwi Public

Lightweight OpenWakeWord Implementation written in C++.

License

Notifications You must be signed in to change notification settings

CLFML/lowwi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

8fdb1a2 · Mar 27, 2025

History

28 Commits
Jan 1, 2025
Dec 30, 2024
Dec 30, 2024
Dec 30, 2024
Mar 8, 2025
Dec 30, 2024
Mar 8, 2025
Oct 25, 2024
Dec 30, 2024
Dec 30, 2024

Repository files navigation

Lowwi - Lightweight openwakeword implementation written in C++.

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

API Features

This library offers support for:

  • Single-model wakeword detection
  • Multi-model wakeword detection

Single-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);
}

Multi-model wakeword detection

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);

Example code

For a full example showcasing the API functions see the example code in example/LOWWI_demo_mic/demo.cpp.

Building with CMake

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)

Running the examples (CPU)

  1. Clone this repo
  2. Run:
cmake . -B build -G Ninja
  1. Let CMake generate and run:
cd build && ninja
  1. After building you can run (linux & mac):
./LOWWI_demo

or (if using windows)

LOWWI_demo.exe

Using it in your project as library

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)

Aditional documentation

See our wiki...

Todo

  • 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?

License

This work is licensed under the Apache 2.0 license.

About

Lightweight OpenWakeWord Implementation written in C++.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published