New Tool Radar

Local AI

How to Build a Local Voice Pipeline with Whisper, Ollama, and Piper

Build a small local voice pipeline that transcribes your speech with Whisper, gets an answer from Ollama, and speaks it back with Piper, with nothing leaving your computer.

Schematic diagram with three steps: transcribe a practice recording with Whisper, ask the Ollama voice model for a short answer, then speak the answer with Piper.

A voice assistant is three jobs chained together: speech to text turns your sentence into words, a language model writes an answer, and text to speech reads it back. Each job has a local tool that runs on your own computer: Whisper for transcription, Ollama for the answer, and Piper for speech. One published guide builds exactly this chain and keeps every step offline once the models are downloaded, with no cloud dependency at any point.

Transcribe with Whisper

The guide uses Whisper.cpp, a C and C++ port of OpenAI’s Whisper model, built for local inference. Its test command transcribes one file:

./build/bin/whisper-cli -m models/ggml-base.en.bin -f audio.wav

The base.en model is the guide’s balance pick at 142 MB: tiny.en is 75 MB and faster, small.en is 466 MB and more accurate. Add --no-timestamps --output-txt to get text only, with no timestamps. Record one practice sentence first, for example “The lighthouse keeper named Mara checked the lamp at noon.”, saved as practice-note.wav, and transcribe that file so you can check the words yourself.

Answer with Ollama

Spoken answers need to be short: long replies feel unnatural when read aloud. The guide builds a voice-tuned model for this, with a Modelfile that keeps replies to one to three sentences and avoids bullet points, code blocks, and markdown:

FROM llama3.1:8b

SYSTEM You are a helpful voice assistant. Keep responses concise (1-3 sentences for simple questions). Use natural, spoken language.

PARAMETER temperature 0.7

PARAMETER num_ctx 2048

PARAMETER num_predict 256

ollama create voice-assistant -f ~/Modelfile-voice

ollama run voice-assistant

The num_predict 256 limit caps how long the spoken answer can run. In a script, the same step is a request to the local API at http://localhost:11434/api/generate with "stream": false, and the reply text is in the response field.

Speak the answer with Piper

Piper is a fast, lightweight text-to-speech engine that runs in real time on CPU. Install it, fetch one voice, and speak a line:

pip install piper-tts

wget https://huggingface.co/rhasspy/piper-voices/resolve/main/en/en_US/lessac/medium/en_US-lessac-medium.onnx

wget https://huggingface.co/rhasspy/piper-voices/resolve/main/en/en_US/lessac/medium/en_US-lessac-medium.onnx.json

echo "Hello, how can I help you today?" | piper --model ~/.local/share/piper/voices/en_US-lessac-medium.onnx --output_file response.wav

A Piper voice always comes as two files kept side by side: the .onnx voice model and its .onnx.json config. The guide’s chain is then: record, transcribe with Whisper, ask Ollama, and pipe the answer through Piper into response.wav.

Try it: three checks from recording to spoken reply

Check What you should see What it means
Transcript Transcribing practice-note.wav returns “The lighthouse keeper named Mara checked the lamp at noon.” Whisper heard the practice sentence
Answer Asking the voice model “What did Mara check?” returns a short answer mentioning the lamp Ollama answered from the transcript
Spoken reply Piper writes response.wav and it plays the answer aloud The voice pipeline runs end to end

Expected result. We checked the local voice assistant guide, which gives the Whisper test command and model sizes, the voice Modelfile, and the Piper install and voice download commands. We did not build Whisper, record audio, create the voice model, or run the pipeline on this machine.

Limits

This guide covers the three tools and how they connect, not a finished always-listening assistant: the guide’s full script adds microphone recording, and it lists wake-word detection, streaming speech, and voice activity detection as optional additions. Building Whisper.cpp needs its build tools, and Piper needs both voice files or it has no voice to speak with. A ready-made voice setup inside Home Assistant is a different task from building this pipeline yourself. We did not test any of this ourselves.

Sources

See all