Skip to content

Recipes

Minimal run with env vars

WHISPA_WHISPER_MODEL=models/ggml-base.en.bin \
WHISPA_OLLAMA_MODEL=llama3.2:1b \
WHISPA_PIPER_MODEL=voices/en_US-amy-medium.onnx \
whispa-pi

Run at boot with systemd

sudo cp systemd/whispa-pi.service /etc/systemd/system/
sudoedit /etc/systemd/system/whispa-pi.service   # set User + model paths
sudo systemctl enable --now whispa-pi
journalctl -u whispa-pi -f

Fixed-length recording instead of VAD

{ "recorder": "arecord", "recordSeconds": 6, "device": "plughw:1,0" }

Wake word → run one turn

import { Appliance, SoxVadRecorder, AplayPlayer } from 'whispa-pi';
import { VoicePipeline, WhisperCppStt, OllamaLlm, PiperTts } from 'whispa';

const appliance = new Appliance({
  recorder: new SoxVadRecorder(),
  pipeline: new VoicePipeline({ stt: new WhisperCppStt({ model }), llm: new OllamaLlm({ model: 'llama3.2:1b' }), tts: new PiperTts({ model: voice }) }),
  player: new AplayPlayer(),
});

wakeWord.on('detected', () => appliance.runOnce()); // openWakeWord, Porcupine, …

GPIO push-to-talk button

import { Gpio } from 'onoff';
const button = new Gpio(17, 'in', 'rising', { debounceTimeout: 50 });
button.watch(() => appliance.runOnce());