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.
Metadata
Release files for wakewordkit 0.5.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| wakewordkit-0.5.0.tar.gz | 64.7 kB | Without provenance | Details for wakewordkit-0.5.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| wakewordkit-0.5.0-py3-none-any.whl | Python 3 | none | any | Details for wakewordkit-0.5.0-py3-none-any.whl |
Total release size: 72.4 kB
Release files / wakewordkit-0.5.0.tar.gz
| Download URL | wakewordkit-0.5.0.tar.gz |
|---|---|
| Size | 64.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3c62447e0949936069194fbcb4642b5c35684d9d5d45e3c2a7b0f5d7845c3ec1
|
|
BLAKE2b-256 checksum How to use checksums |
d267bf06664d9324fb241009dd9c6de12758458c9d229dd7de89080f95404715
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.2
|
Release files / wakewordkit-0.5.0-py3-none-any.whl
| Download URL | wakewordkit-0.5.0-py3-none-any.whl |
|---|---|
| Size | 7.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e7f9781ef7f2060e63b987a473877b5d1904cfd7a3ba52a6adcd598c00b35e8a
|
|
BLAKE2b-256 checksum How to use checksums |
077d9cff57be40cb9ead2ab5f34fa7a51de6d817af523d7ada9d765fa9b57d40
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.2
|
Security for wakewordkit 0.5.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.