wakewordkit
Lightweight wake-word detection for application-owned PCM audio, powered by openWakeWord.
WakewordKit deliberately does not open microphones, buffer application audio, or hand streams to speech-to-text services. The application owns capture and routing; WakewordKit only converts frames to the model format and reports detections.
Requires Python 3.12+.
Install
pip install wakewordkit
Process individual frames
Use process() when your application already has a capture loop:
from wakewordkit import AudioFormat, WakeWordDetector
detector = WakeWordDetector("hey_jarvis")
audio_format = AudioFormat(
sample_rate=48_000,
channels=2,
sample_format="pcm_s16le",
)
while chunk := await microphone.read():
detection = await detector.process(chunk, format=audio_format)
if detection is not None:
print(detection.name, detection.score)
process() moves synchronous model inference off the event loop and never
takes ownership of the source. Audio capture, buffering,
pre-roll, STT handoff, and device shutdown remain the application's
responsibility.
Asynchronous applications
The application owns iteration and routing while WakewordKit handles the synchronous model boundary internally:
while True:
frame = await microphone.read()
detection = await detector.process(frame, format=microphone.format)
if detection is not None:
await handle(detection)
Input may be interleaved 16-bit PCM bytes, 32-bit float PCM bytes, or NumPy
arrays. AudioFormat describes its sample rate, channel count, and encoding.
Downmixing and conversion to the model's 16 kHz mono format are internal and
stateful across frame boundaries.
Application-owned STT handoff
A voice application normally keeps one capture loop and routes its frames to the active consumer:
microphone -> application buffer -> wakewordkit
\-> VAD / recorder / STT
Keep any pre-roll ring buffer beside the capture loop. When WakewordKit reports a detection, the application can give that buffered prefix and subsequent live frames to its recorder or STT client without transferring device ownership. This also keeps follow-up turns and barge-in on the same audio lifecycle.
Models
Built-in and custom models can be combined:
from wakewordkit import CustomWakeWord, WakeWord, WakeWordDetector
WakeWordDetector("hey_jarvis")
WakeWordDetector(WakeWord.ALEXA, WakeWord.HEY_MYCROFT)
WakeWordDetector(CustomWakeWord("hey_computer", "models/hey_computer.onnx"))
WakeWordDetector() # all bundled models
Bundled names are alexa, hey_jarvis, hey_mycroft, and hey_marvin.
Development
uv sync --dev
uv run pytest
See examples/detect_from_wav.py for a complete
caller-owned source example.
Real microphone and STT/TTS examples
Hardware and provider SDKs are deliberately excluded from WakewordKit's core dependencies. Install the separate examples extra to run them:
uv sync --extra examples
uv run python examples/external_microphone.py
uv run python examples/stt_tts_assistant.py
external_microphone.pyreads asounddevicestream owned by the example and passes each frame todetector.process().stt_tts_assistant.pykeeps one microphone source and its pre-roll in the application, callsdetector.process(), records through silence, transcribes the resulting WAV, and plays a generated spoken response. It uses the request-based OpenAI audio APIs, requiresOPENAI_API_KEY(the example also loads it from.env), and is intentionally half-duplex.
The energy threshold in the compact STT/TTS example is suitable for trying the ownership pattern, not a production VAD. A real assistant should replace it with its own VAD/turn detector and add echo cancellation or explicit barge-in.
License
MIT — see LICENSE.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file wakewordkit-0.5.0.tar.gz.
File metadata
- Download URL: wakewordkit-0.5.0.tar.gz
- Upload date:
- Size: 64.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.9.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3c62447e0949936069194fbcb4642b5c35684d9d5d45e3c2a7b0f5d7845c3ec1
|
|
| MD5 |
4072d1e21be773e769485deddc89f861
|
|
| BLAKE2b-256 |
d267bf06664d9324fb241009dd9c6de12758458c9d229dd7de89080f95404715
|
File details
Details for the file wakewordkit-0.5.0-py3-none-any.whl.
File metadata
- Download URL: wakewordkit-0.5.0-py3-none-any.whl
- Upload date:
- Size: 7.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.9.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e7f9781ef7f2060e63b987a473877b5d1904cfd7a3ba52a6adcd598c00b35e8a
|
|
| MD5 |
3480c136861605c8bf71c69daa50f306
|
|
| BLAKE2b-256 |
077d9cff57be40cb9ead2ab5f34fa7a51de6d817af523d7ada9d765fa9b57d40
|