Upgrades: wake word, push-to-talk, LEDs¶
whispa-pi ships with voice-activated recording (sox VAD) or fixed-length recording (arecord). Here are common upgrades, all optional and offline-friendly.
Wake word ("Hey Pi")¶
Add an always-listening wake word so you don't rely on silence detection:
- openWakeWord — open, offline, custom words.
- Porcupine — very accurate (free tier needs a key).
Pattern: run the wake-word detector in a small always-on process; when it fires, call
appliance.runOnce(). Because the Appliance exposes runOnce(), you can drive it
from any trigger.
Push-to-talk button (GPIO)¶
Wire a momentary button to a GPIO pin and trigger a turn on press:
import { Appliance, ArecordRecorder, AplayPlayer } from 'whispa-pi';
// e.g. with onoff or @raspberrypi/gpio
button.on('press', () => appliance.runOnce());
Use ArecordRecorder (fixed seconds) or start/stop recording on press/release.
Status LEDs¶
Give feedback with an LED (or a ReSpeaker's ring): idle → listening → thinking → speaking. Hook into the appliance lifecycle:
new Appliance({
recorder, pipeline, player,
onTurn: () => led.idle(),
});
// set led.listening() before record, led.thinking() before turn, etc. by
// composing your own runOnce, or extend Appliance.
Tools & smart-home actions¶
Since the "brain" is your LlmEngine, you can add tool-calling inside it (timers,
lights, HTTP calls) without changing the audio loop. Keep actions local to stay offline.
Better voices / languages¶
Piper has many voices and languages — swap piperModel for a different .onnx.
For non-English, also pick a matching whisper model (multilingual base/small).