tts

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 16, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package tts provides TTS service implementations (OpenAI TTS, Groq TTS).

Package tts provides TTS service implementations (OpenAI TTS).

Index

Constants

View Source
const DefaultGroqTTSModel = "canopylabs/orpheus-v1-english"

DefaultGroqTTSModel is the default Groq TTS model (Orpheus English).

View Source
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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL