speech/interface.go

clawbench · internal/speech/interface.go · go · MIT
voice, Voice / Speech

Go interfaces defining speech synthesis providers, streaming support, and cache identity for TTS.

// Source: https://github.com/clawbench-dev/clawbench | License: MIT | Copyright 2025 xulongzhe
// Provided via justclaw.it.com; keep this notice with the code.
package speech

import "context"

// SpeechProvider abstracts audio synthesis.
// Implementations can be swapped (Edge TTS, Piper, Kokoro, MOSS-Nano, etc.)
type SpeechProvider interface {
	// Synthesize generates an audio file at outputPath from the given text.
	// language is a language code (e.g. "zh", "en") — implementations that
	// support language-specific synthesis should use it; others may ignore it.
	// Returns an error if synthesis fails.
	Synthesize(ctx context.Context, text string, outputPath string, language string) error
}

// StreamingSpeechProvider extends SpeechProvider with streaming audio output.
// Implementatio

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key