Back to projects
AI integration · Developer toolsWorking integration

OpenCode Voice Input

From spoken thought to a working prompt.

A voice-to-prompt workflow that connects microphone capture, silence detection and Whisper transcription directly to OpenCode.

My contribution

Design & implementation

Built with

TypeScript / Groq Whisper / ffmpeg / Node.js

Workflow illustration · TypeScript + Whisper
X

The outcome

Turned microphone recordings into prompts inside OpenCode.

Y

The evidence

A documented /voz command and an audio-fixture integration test against Groq.

Z

The approach

Separated audio capture, speech transcription and command integration in TypeScript.

Inside the build

Explore the system

Open a stage to see how it works and why it was designed this way.

01Captureffmpeg · WAV

The microphone is recorded as mono, 16 kHz PCM audio through ffmpeg on macOS.

Engineering decision

Use a dedicated audio tool; keep recording orchestration separate from the transcription API.

See implementation
02Detect silence−35 dB · 3 s

A three-second silence window ends the recording after an initial four-second guard period.

Engineering decision

Make the recording boundary explicit. The microphone index and silence thresholds remain configuration constraints.

See implementation
03TranscribeGroq · Whisper

A reusable transcribe(audioPath) function sends the WAV to whisper-large-v3-turbo and returns the text.

Engineering decision

Keep the API boundary independent of OpenCode, propagate HTTP failures and load the key from the environment.

See implementation
04Deliver promptstdout → OpenCode

The /voz command passes the transcript to OpenCode. Progress messages go to stderr instead of polluting the prompt.

Engineering decision

Use a small command interface with a clear output contract rather than coupling transcription to the editor UI.

See implementation

Implementation walkthrough · not a live inference demo

The problem

OpenCode accepts text prompts. I wanted to speak an instruction and deliver the transcription to the same workflow, without manually moving text between a recorder, a transcription tool and the editor.

The engineering challenge was the handoff: deciding when recording ends, handling a remote transcription request and ensuring the command returns only the prompt.

Small boundaries. Clear responsibilities.

Keep transcription independent

groq-stt.ts exposes transcribe(audioPath). It accepts an audio file and returns text; it does not know about OpenCode. This also makes it possible to test transcription using a saved recording.

Use the terminal as a contract

voz.ts orchestrates recording and transcription. Progress messages go to stderr; the transcript goes to stdout. The /voz command can consume that output without filtering out log messages.

Make recording conditions explicit

ffmpeg captures mono audio at 16 kHz. Silence detection uses a −35 dB threshold and a three-second window, with an initial four-second guard. These are configuration choices, not measured latency or quality claims.

What can be verified

The public repository contains the recording orchestrator, transcription adapter, command installer and setup documentation. Its integration test sends the committed voz.wav fixture to Groq and checks the Spanish transcript.

That test depends on network access and an API key. It verifies one fixture against the service; it does not establish accuracy across speakers, accents or noisy environments. No speed improvement or transcription-accuracy benchmark is claimed here.

Limits & next steps

The current recording path uses macOS avfoundation and a configurable microphone index. Transcription depends on an external service, its rate limits and the network. Audio is sent to Groq rather than processed entirely on-device.

Useful next steps are broader audio fixtures, bounded request timeouts, cleanup on failure and a more portable recording adapter. The portfolio's interactive diagram explains the existing implementation; it does not record audio or call the model.

Build / Verify / Learn

Evidence over adjectives.

Source & setup

Recording, transcription and installation are available in the public repository.

GitHub

Integration check

The documented test transcribes a committed audio fixture. It needs a Groq key and network access.

GitHub
Next case study

Synthetic Face Detector