Back in 2017, Google shipped the cardboard AIY Voice Kit with a Raspberry Pi Voice HAT—complete with stereo MEMS microphones, a 3-watt speaker amplifier, and an illuminated arcade push-button. Years after Google retired the original cloud Assistant SDK, the hardware was still sitting on my desk (rpi-5), already wired into my homelab Tailscale mesh and Weave Scope topology.
Instead of letting good audio hardware collect dust, I resurrected it as ears and a voice for agy, my local AI agent.
Why Replace the Cloud SDK with a Local Split Architecture
Running modern speech-to-text and neural text-to-speech directly on a Raspberry Pi 3 (armv7l, Raspbian Buster) is painfully slow. Instead, I split the pipeline across two nodes over Tailscale:
rpi-5(Edge Audio & Button Client): Handlesarecord,paplay, and theaiy.boardGPIO arcade button/LED (GPIO 23&GPIO 25).- Workstation (
agy-voice.serviceon port8765): Runsfaster-whisper(base,int8on CPU), invokesagyCLI (--effort low --mode auto), and synthesizes natural speech withpiper-tts(en_US-lessac-medium).
This keeps rpi-5 ultra-lightweight while giving agy sub-second local transcription and crisp neural voice output.
Solving the First Gotcha: pulseaudio Owning card 0
On rpi-5, dtoverlay=googlevoicehat-soundcard exposes snd_rpi_googlevoicehat_soundcar as card 0 for both capture and playback. Running arecord -D plughw:0,0 directly failed immediately with:
arecord: main:828: audio open error: Device or resource busy
A quick fuser -v /dev/snd/* showed pulseaudio (running under user pi) already held /dev/snd/pcmC0D0c and /dev/snd/pcmC0D0p. Switching the client to run as User=pi with XDG_RUNTIME_DIR=/run/user/1000 and recording/playing via arecord -D pulse and paplay solved the contention cleanly—no fighting ALSA locks.
The Voice Gateway Server (agy_voice_server.py)
On the workstation side, a persistent systemd --user service (agy-voice.service) keeps both faster-whisper and the Piper ONNX voice model warm in RAM inside a Python 3.13 virtual environment:
POST /ask: Accepts raw16 kHzmono WAV audio, transcribes it with VAD filtering, strips markdown/URLs fromagy‘s concise 1–3 sentence response, and streams back synthesizedaudio/wav.POST /tts: Accepts JSON{"text": "..."}and returnsaudio/wavfor standalone spoken notifications.GET /health: Silent health check ({"status": "ok"}).
Before handing the reply to Piper, a small regex cleaner removes code fences, backticks, markdown links, and #/* characters so the speaker never reads out raw formatting symbols.
Walkie-Talkie UX + Proactive Spoken Alerts (rpi-5)
On rpi-5, agy-voice-client.service wires the arcade button and LED into an intuitive walkie-talkie loop:
- Idle: Button LED glows softly (
Led.BEACON_DARK). - Press & Hold: LED turns solid (
Led.ON) whilearecord -D pulse -f S16_LE -r 16000 -c 1captures your voice. - Release: LED pulses (
Led.PULSE_QUICK) whilePOST http://<workstation-tailscale-ip>:8765/asktranscribes, queriesagy, and returns WAV audio. - Reply:
paplayspeaksagy‘s answer through the AIY 3-watt speaker, then returns the LED to idle.
As a bonus, agy-voice-client.service also listens on port 8766 (POST /speak), giving Home Assistant, antigravity-sentinel, and agy itself a direct way to announce critical homelab alerts aloud—like a UPS switching to battery or a downed service. To avoid waking anyone up at night or startling the room, antigravity-sentinel enforces a 09:00–21:00 daytime window and plays alerts at a gentle 30% volume (paplay --volume=19660).
Reusing the Same Voice Pipeline on Signal
Because agy-voice.service already exposes standalone /stt and /tts HTTP endpoints, I wired the exact same local faster-whisper and Piper pipeline into my self-only Signal bot (signal-bot.service):
- Incoming Voice Notes: When I send an audio/voice note in Signal’s Note to Self chat,
signal_bot.pydetects theaudio/*attachment, posts it to/stt, and feeds the transcript intoagy(or instant sub-second handlers likeweather,ups, andsopor). - Spoken Voice Replies: When replying to a voice note,
signal_bot.pysynthesizes the answer via/tts, transcodes the WAV into a compact32 kbpsOGG/Opus voice note withffmpeg, and attaches it alongside the text reply.
One faster-whisper + Piper daemon now powers both the physical AIY desk box and mobile Signal voice chats.
Two More Real-World Fixes: Duration Flags and Default Playback Volume
Testing the live push-to-talk loop on rpi-5 surfaced two subtle bugs that are easy to miss in initial setup:
- Go duration units on
--print-timeout:agyparses--print-timeoutas a Gotime.Duration. Passing180instead of180sinagy_voice_server.pycaused the CLI to exit immediately with code2(time: missing unit in duration "180"), triggering “Sorry, agy returned an error.” Switching to180sand loggingstderron non-zero exits resolved it immediately. - Consistent
30%playback volume: While the/speakendpoint defaulted tovolume=0.30,play_wav_bytes()inagy_voice_client.pystill defaulted tovolume=1.0(65536, 100%) for push-to-talk responses—making desk replies overwhelmingly loud. Settingplay_wav_bytes(wav_bytes, volume=0.30)aligned interactive voice replies with the same comfortable room level as spoken alerts.
What’s Next
Now that rpi-5 is part of the Tailscale mesh (<rpi-5-tailscale-ip>) and bridged to agy, I can ask my desk box for a quick Sopor climate briefing, check UPS status, or trigger Home Assistant actions hands-free—breathing a second life into a 2017 cardboard kit with 100% local STT and TTS.