Currently using tts to get voice from the agent.
| .opencode/tools | initial commit | |
| audio-player | initial commit | |
| bin | initial commit | |
| models | initial commit | |
| voice_project | initial commit | |
| .dockerignore | initial commit | |
| .gitignore | initial commit | |
| AGENTS.md | initial commit | |
| Containerfile.dev | initial commit | |
| LICENSE | initial commit | |
| LICENSE-COMMERCIAL | initial commit | |
| Makefile | initial commit | |
| pyproject.toml | initial commit | |
| README.md | initial commit | |
Voice Project for OpenCode
Self-contained voice capabilities (STT + TTS) for OpenCode AI assistant.
What It Does
- TTS (Text-to-Speech): Convert text to audio and speak it
- STT (Speech-to-Text): Transcribe audio to text
- 100% Local: No cloud services, runs entirely on your machine
Two Ways to Run
Option 1: Container (Recommended)
Zero setup - everything runs in a container.
# Build container with all tools
make dev-build
# Run tests
make test
Option 2: Native Linux Install
Install directly on your Linux system.
System Dependencies
Before installing, you need these system packages:
# Ubuntu/Debian
sudo apt install -y \
libportaudio2 \
portaudio19-dev \
libasound2-dev
# Fedora/RHEL
sudo dnf install -y portaudio-tools
Installation
1. Install uv (Python package manager)
curl -LsSf https://astral.sh/uv/install.sh | sh
2. Clone and Install
# Clone the project
git clone <repo-url>
cd voice_project
# Create virtual environment
uv venv .venv
source .venv/bin/activate
# Install with all features
uv pip install -e ".[all]"
Quick Test
# Run unit tests (no hardware needed)
pytest
# Test TTS - generate audio file
voice-tts --text "Hello world" --output test.wav
# Play the audio
aplay test.wav # Linux
afplay test.wav # macOS
OpenCode Integration
To use with OpenCode:
# Copy the voice tool to OpenCode
cp .opencode/tools/voice.ts ~/.config/opencode/tools/voice.ts
The tool will be available as voice in OpenCode.
Architecture
voice_project/
├── .opencode/tools/ # OpenCode tools
│ └── voice.ts # Voice output tool
├── voice_project/ # Python package
│ ├── bin/ # CLI entry points
│ ├── tts/ # Text-to-speech backends
│ ├── stt/ # Speech-to-text
│ └── utils/ # Audio utilities
├── audio-player/ # Rust audio player
├── tests/ # Unit tests
├── Makefile # Container commands
└── pyproject.toml # Dependencies
Available Commands
# Text-to-Speech
voice-tts --text "Hello" --play
voice-tts --text "Hello" --output file.wav
# Speech-to-Text
voice-stt audio.wav --model tiny
# Audio Recording
voice-record 5 output.wav
Development
# Run all tests
make test
# Run linters
make lint
# Build Rust audio player
make build
# Clean build artifacts
make clean