Skip to content

Repository files navigation

OmniVoice

Go CIGo LintGo SASTDocsDocsVisualizationLicense

Batteries-included voice pipeline framework for Go. This package provides a unified interface for speech-to-text (STT) and text-to-speech (TTS) with all providers included.

For a minimal dependency footprint, use omnivoice-core instead.

Voice Architecture

OmniVoice supports two approaches for real-time voice:

ApproachLatencyUse Case
Traditional Pipeline (STT→LLM→TTS)500-1500msCustom voices, domain-specific STT
Native Voice-to-Voice100-200msLow latency, natural conversation

This package provides the Traditional Pipeline components. For native voice-to-voice, see:

See the Voice Architecture Guide for detailed comparison.

Features

  • 🎯 Unified Interface: Single API for all STT and TTS providers
  • 📦 Provider Registry: Get providers by name - no need to import individual provider packages
  • 🔌 Multiple Providers: OpenAI, Deepgram, ElevenLabs, Twilio, Telnyx + local providers
  • 💻 Local Voice: F5-TTS and Whisper via MLX on Apple Silicon (zero API cost)
  • Streaming Support: Real-time transcription and synthesis
  • 🚀 Easy Integration: Import and use with minimal configuration

Installation

go get github.com/plexusone/omnivoice

CLI

OmniVoice includes a command-line tool for transcription.

Install CLI

go install github.com/plexusone/omnivoice/cmd/omnivoice@latest

Usage

# Set your API keyexport DEEPGRAM_API_KEY="your-api-key"# Basic transcription (stdout)
omnivoice transcribe podcast.mp3
# Save to file
omnivoice transcribe -p deepgram -o transcript.txt podcast.mp3
# JSON output with full metadata (OmniVoice Transcript format)
omnivoice transcribe -p deepgram --diarize --timestamps -f json -o transcript.json podcast.mp3
# Generate SRT subtitles
omnivoice transcribe -p deepgram -f srt -o subtitles.srt podcast.mp3
# Generate WebVTT subtitles
omnivoice transcribe -p deepgram -f vtt -o subtitles.vtt podcast.mp3
# List available providers
omnivoice providers list

Output Formats

FormatDescription
textPlain transcript text (default)
jsonOmniVoice Transcript format with full metadata
srtSubRip subtitles
vttWebVTT subtitles

Environment Variables

VariableProvider
DEEPGRAM_API_KEYDeepgram
OPENAI_API_KEYOpenAI
ELEVENLABS_API_KEYElevenLabs

Quick Start (Library)

import (
"github.com/plexusone/omnivoice"
_ "github.com/plexusone/omnivoice/providers/all"// Register all providers
)

Usage

package main
import (
"context""log""os""github.com/plexusone/omnivoice"
_ "github.com/plexusone/omnivoice/providers/all"
)
funcmain() {
ctx:=context.Background()
// Get providers by name using the registrysttProvider, err:=omnivoice.GetSTTProvider("deepgram",
omnivoice.WithAPIKey(os.Getenv("DEEPGRAM_API_KEY")))
iferr!=nil {
log.Fatal(err)
}
ttsProvider, err:=omnivoice.GetTTSProvider("elevenlabs",
omnivoice.WithAPIKey(os.Getenv("ELEVENLABS_API_KEY")))
iferr!=nil {
log.Fatal(err)
}
// Transcribe audioresult, err:=sttProvider.TranscribeFile(ctx, "audio.mp3", omnivoice.TranscriptionConfig{
Language: "en",
EnableWordTimestamps: true,
})
iferr!=nil {
log.Fatal(err)
}
log.Printf("Transcription: %s", result.Text)
// Synthesize speechaudio, err:=ttsProvider.Synthesize(ctx, "Hello, world!", omnivoice.SynthesisConfig{
VoiceID: "pNInz6obpgDQGcFmaJgB", // Adam
})
iferr!=nil {
log.Fatal(err)
}
// audio.Audio contains the audio bytes
}

Provider Registry

Get providers by name at runtime - no need to import individual provider packages:

// STT/TTS providers: "openai", "elevenlabs", "deepgram", "twilio"ttsProvider, _:=omnivoice.GetTTSProvider("elevenlabs", omnivoice.WithAPIKey(key))
sttProvider, _:=omnivoice.GetSTTProvider("deepgram", omnivoice.WithAPIKey(key))
// Realtime providers: "openai", "gemini", "deepgram"rtProvider, _:=omnivoice.GetRealtimeProvider("openai", omnivoice.WithAPIKey(key))
// Gateway providers: "twilio", "telnyx"gateway, _:=omnivoice.GetGatewayProvider("twilio", omnivoice.WithAccountSID(sid), omnivoice.WithAuthToken(token))
// List registered providersfmt.Println(omnivoice.ListTTSProviders()) // [openai elevenlabs deepgram twilio]fmt.Println(omnivoice.ListSTTProviders()) // [openai elevenlabs deepgram twilio]fmt.Println(omnivoice.ListRealtimeProviders()) // [openai gemini deepgram]fmt.Println(omnivoice.ListGatewayProviders()) // [twilio telnyx]// Realtime factory API (for gateway integration)factory, _:=omnivoice.GetRealtimeFactory("openai")
fmt.Println(omnivoice.ListRealtimeFactories()) // [openai gemini deepgram]

Language Codes

OmniVoice accepts language codes in BCP-47 format, which includes ISO 639-1 two-letter codes and regional variants.

Common codes:

CodeLanguage
enEnglish
en-USEnglish (US)
en-GBEnglish (UK)
esSpanish
es-MXSpanish (Mexico)
frFrench
deGerman
itItalian
ptPortuguese
pt-BRPortuguese (Brazil)
jaJapanese
koKorean
zhChinese
zh-CNChinese (Simplified)
zh-TWChinese (Traditional)
arArabic
hiHindi
ruRussian

Notes:

  • Use simple codes (en) for broad compatibility across providers
  • Use regional variants (en-US) when accent/dialect matters for TTS
  • Provider support varies; see provider documentation for full language lists
  • STT providers generally support automatic language detection when no code is specified

Included Providers

Cloud STT/TTS Providers

ProviderSTTTTSRegistry Name
OpenAIWhisperTTS-1/TTS-1-HD"openai"
ElevenLabsScribeMultilingual v2"elevenlabs"
DeepgramNova-2Aura"deepgram"
TwilioMedia StreamsMedia Streams"twilio"

Local Providers (Apple Silicon)

ProviderTypeRegistry NameRequirements
F5-TTS MLXTTS"f5tts-mlx"Apple Silicon, Python server
Whisper MLXSTT"whisper-mlx"Apple Silicon, Python server

Local providers are opt-in imports from omnivoice-core. See Local TTS Guide.

Native Voice-to-Voice (Realtime)

ProviderLatencyRegistry Name
OpenAI Realtime~100ms"openai"
Gemini Live~200ms"gemini"
Deepgram Voice Agent~100-300ms"deepgram"

Voice Gateway

ProviderRegistry Name
Twilio"twilio"
Telnyx"telnyx"

Related Packages

Core

Local Providers (Apple Silicon)

Available in omnivoice-core v0.15.0+ for on-device voice processing:

Native Voice-to-Voice (Recommended for Low Latency)

STT/TTS Providers

Voice Gateway Providers

License

MIT License - see LICENSE for details.

About

Batteries-included voice pipeline framework for Go. This package provides a unified interface for speech-to-text (STT) and text-to-speech (TTS) with all providers included.

Resources

Stars

4 stars

Watchers

1 watching

Forks

Releases

Contributors

Languages