AI & Computer VisionEngineer

Offline Talking AI Assistant: Whisper + Ollama + Piper

Speak a question, a local model answers out loud — speech-to-text, a small LLM and text-to-speech all on one Pi 5.

LevelEngineer
Time3 h
Est. cost~$176
Steps5

Chain three open-source pieces: whisper.cpp turns your voice into text, Ollama runs a small language model, and Piper speaks the answer in English or Spanish.

Video tutorial

Video by Jdaie Lin, embedded from YouTube. The written steps below are our own and match the parts list.

Mission steps

  1. Set up Ollama

    Complete the local chatbot guide and pull a small model.

  2. Build whisper.cpp

    Clone and compile whisper.cpp and download a tiny or base model for speed.

  3. Install Piper

    Download a Piper release for ARM64 and an English or Spanish voice model.

  4. Wire the loop

    Record 5 seconds with arecord, transcribe, send the text to Ollama, speak the reply with Piper.

  5. Add a push-to-talk button

    A GPIO button starts recording, so the assistant only listens when you ask.

Code

#!/bin/bash
# talk.sh — paths depend on where you built/downloaded each tool
arecord -d 5 -f S16_LE -r 16000 -c 1 /tmp/q.wav
Q=$(./whisper.cpp/build/bin/whisper-cli -m whisper.cpp/models/ggml-base.bin -f /tmp/q.wav -nt -l auto 2>/dev/null)
A=$(ollama run llama3.2:3b "Answer in two short sentences: $Q")
echo "$A" | ./piper/piper --model voices/en_US-lessac-medium.onnx --output_file /tmp/a.wav
aplay /tmp/a.wav

Tip: test every script on the bench before installing it in a moving machine.

Questions

How long does an answer take?

Usually several seconds on a Pi 5 with small models. Shorter prompts and the tiny Whisper model are fastest.