Run This Ai
EN DE

How to Build a Voice Agent with Moonshine Voice: Step-by-Step Tutorial

From pip install to a spoken conversational agent: a hands-on tutorial for building real-time, privacy-first voice apps with Moonshine Voice.

Want a voice assistant that responds in real time and runs entirely on your own hardware? This tutorial walks you through getting Moonshine Voice up and running β€” from a one-line Python install to a full conversational agent.

πŸš€ Want to deploy Moonshine Voice yourself?

Docker configs, system requirements, and installation guides β€” all on one page.

View Moonshine Voice Tool Page β†’

Step 1: Install and transcribe in seconds

Moonshine ships as a Python package with a ready-made CLI. Open a terminal and run:

pip install moonshine-voice
moonshine-voice mic --language en

The mic command listens to your microphone and prints a live, streaming transcript as you speak β€” you should see text appear before you finish your sentence, which is the real-time magic of Moonshine's streaming architecture.

Step 2: Synthesize speech

Text-to-speech is equally simple, and works offline:

moonshine-voice tts --language en_us --text "Hello world"

Pick any of the 16 supported voices β€” including German (de_de), Spanish, French, and Japanese β€” and the audio is generated locally, with no network round-trip.

Step 3: Build a spoken conversational agent

Moonshine's killer feature is the agent flow: it listens for a trigger phrase, asks questions, and semantically matches natural-language answers. Try the built-in example, which simulates a Wi-Fi setup conversation:

moonshine-voice agent

The agent uses intent recognition, so variations like "it's five two one" or "521" are understood the same way β€” no brittle keyword matching.

Step 4: Go cross-platform

For the browser, use the WASM build from the CDN β€” a few lines of JavaScript and you have MicTranscriber streaming to your UI:

import { MicTranscriber, ModelArch } from 'https://cdn.jsdelivr.net/npm/@moonshine-ai/moonshine-wasm/dist/index.js';
const mic = new MicTranscriber().modelArch(ModelArch.MediumStreaming);
await mic.load(); await mic.start();

iOS and Android developers get native Swift and Kotlin packages, and the same models run on Raspberry Pi and even 1 MB microcontrollers. Full starter projects (transcriber, dictation, meeting note-taker) are downloadable from the releases page.

Review verdict

Moonshine Voice earns its 10.7K stars: genuinely low latency, impressive accuracy versus Whisper, and a uniquely broad device footprint β€” all with no cloud dependency. The main trade-off is that top-end models need decent local hardware, though the 1 MB tier covers edge cases. For privacy-first voice products, it's currently one of the strongest options in open source.

πŸš€ Ready to run Moonshine Voice?

Get the Docker setup, system requirements, and install guide on the tool page.

Deploy Moonshine Voice β†’
#voice #tutorial #voice-agents #real-time #stt