Documentation
¶
Overview ¶
Package tts provides TTS service implementations (OpenAI TTS, Groq TTS).
Package tts provides TTS service implementations (OpenAI TTS).
Index ¶
Constants ¶
const DefaultGroqTTSModel = "canopylabs/orpheus-v1-english"
DefaultGroqTTSModel is the default Groq TTS model (Orpheus English).
const DefaultGroqVoice = "alloy"
DefaultGroqVoice is the default Groq TTS voice.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GroqService ¶
type GroqService struct {
// contains filtered or unexported fields
}
GroqService implements services.TTSService using Groq's TTS API (OpenAI-compatible). Groq returns WAV at 48 kHz; we decode to raw PCM for TTSAudioRawFrame.
func NewGroq ¶
func NewGroq(apiKey, model, voice string) *GroqService
NewGroq creates a Groq TTS service. If apiKey is empty, config.GetEnv("GROQ_API_KEY", "") is used. If model or voice is empty, DefaultGroqTTSModel and DefaultGroqVoice are used.
func (*GroqService) Speak ¶
func (s *GroqService) Speak(ctx context.Context, text string, sampleRate int) ([]*frames.TTSAudioRawFrame, error)
Speak requests TTS from Groq (WAV response), decodes to PCM, and returns TTSAudioRawFrame(s).
func (*GroqService) SpeakStream ¶
func (s *GroqService) SpeakStream(ctx context.Context, text string, sampleRate int, outCh chan<- frames.Frame)
SpeakStream runs TTS and sends the resulting TTSAudioRawFrame(s) to outCh.
type OpenAIService ¶
type OpenAIService struct {
// contains filtered or unexported fields
}
OpenAIService implements services.TTSService using OpenAI TTS (e.g. tts-1).
func NewOpenAI ¶
func NewOpenAI(apiKey, model string) *OpenAIService
NewOpenAI creates an OpenAI TTS service.
func (*OpenAIService) Speak ¶
func (s *OpenAIService) Speak(ctx context.Context, text string, sampleRate int) ([]*frames.TTSAudioRawFrame, error)
Speak requests TTS and returns one or more TTSAudioRawFrame.
func (*OpenAIService) SpeakStream ¶
func (s *OpenAIService) SpeakStream(ctx context.Context, text string, sampleRate int, outCh chan<- frames.Frame)
SpeakStream runs TTS and sends the resulting TTSAudioRawFrame(s) to outCh.