Building a Raspberry Pi voice assistant in 30 minutes with ViolaWake
This tutorial builds the wake word layer for a Raspberry Pi assistant. It uses local inference, a USB microphone, Python, and a ViolaWake ONNX model.
What you need
- Raspberry Pi 4 or newer.
- USB microphone or a known-good audio HAT.
- Python 3.10 or newer.
- A trained ViolaWake model.
- Network access for installation, unless you pre-stage wheels and model files.
Step 1: install the SDK
python -m venv .venv
. .venv/bin/activate
pip install "violawake[oww]"
Step 2: copy your model
Download your ONNX model from the ViolaWake Console or train locally with the CLI. Copy it to the Pi:
scp my_word.onnx [email protected]:/home/pi/models/my_word.onnx
Step 3: run detection
from violawake_sdk import WakeDetector
def handle_wake():
print("Wake word detected. Start your command pipeline here.")
with WakeDetector(model="/home/pi/models/my_word.onnx", threshold=0.80) as detector:
for frame in detector.stream_mic():
if detector.detect(frame):
handle_wake()
Step 4: tune threshold
Start at 0.80. If the assistant triggers while music or TV is playing, raise the threshold. If it misses normal wake attempts, lower the threshold slightly or collect more training data.
Step 5: test like a device owner
Do not test only at your desk. Test near the kitchen, next to a fan, with music, with quiet speech, with loud speech, and from across the room. Count false alarms and misses separately.
Step 6: add the rest of the assistant
After wake detection, you can run STT, a command parser, a local LLM, or a cloud assistant. Keep wake word detection local so idle audio does not leave the device.