Files
viettranx f4cc595e50 feat(audio): add unified audio manager with 4 provider interfaces
Introduce internal/audio package with Manager orchestrating TTS, STT,
Music, and SFX providers via 4 interfaces. Phase 1 wires TTS providers
(ElevenLabs, OpenAI, Edge, MiniMax) and ElevenLabs SFX; STT/Music
wiring deferred to later phases. ElevenLabs TTS and SFX share an
xi-api-key HTTP client.
2026-04-15 11:24:56 +07:00

32 lines
1014 B
Go

// Package elevenlabs implements the ElevenLabs audio API for TTS and SFX.
// TTS ships in Phase 1; SFX migrated from internal/tools/create_audio_elevenlabs.go.
// Music generation via /v1/music/compose lands in Phase 3.
package elevenlabs
// Config bundles credentials + TTS defaults for ElevenLabs. Shared by the
// TTS and SFX providers — SFX ignores Voice/Model fields.
type Config struct {
APIKey string
BaseURL string // default "https://api.elevenlabs.io"
VoiceID string // default "pMsXgVXv3BLzUgSXRplE" (TTS only)
ModelID string // default "eleven_multilingual_v2" (TTS only)
TimeoutMs int // default 30000
}
// defaults fills in blank fields with the values used by the legacy tts package.
func (c Config) withDefaults() Config {
if c.BaseURL == "" {
c.BaseURL = "https://api.elevenlabs.io"
}
if c.VoiceID == "" {
c.VoiceID = "pMsXgVXv3BLzUgSXRplE"
}
if c.ModelID == "" {
c.ModelID = "eleven_multilingual_v2"
}
if c.TimeoutMs <= 0 {
c.TimeoutMs = 30000
}
return c
}