tts

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package tts provides OmniVoice-based text-to-speech for marp2video.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func VoiceConfigToSynthesisConfig

func VoiceConfigToSynthesisConfig(voice transcript.VoiceConfig) omnivoice.SynthesisConfig

VoiceConfigToSynthesisConfig converts marp2video VoiceConfig to OmniVoice SynthesisConfig.

Types

type Factory

type Factory struct {
	// contains filtered or unexported fields
}

Factory creates TTS providers based on configuration.

func NewFactory

func NewFactory(config ProviderConfig) *Factory

NewFactory creates a new TTS provider factory.

func (*Factory) Available

func (f *Factory) Available() []string

Available returns a list of available provider names based on configured API keys.

func (*Factory) Get

func (f *Factory) Get(name string) (*Provider, error)

Get returns a provider by name, creating it if necessary. If name is empty, returns the fallback provider.

func (*Factory) SetFallback

func (f *Factory) SetFallback(name string)

SetFallback sets the default provider name.

type Provider

type Provider struct {
	// contains filtered or unexported fields
}

Provider wraps an OmniVoice TTS provider for use with marp2video.

func New

func New(provider omnivoice.TTSProvider) *Provider

New creates a new OmniVoice TTS provider wrapper.

func (*Provider) Name

func (p *Provider) Name() string

Name returns the provider name.

func (*Provider) Synthesize

func (p *Provider) Synthesize(ctx context.Context, text string, voice transcript.VoiceConfig) ([]byte, error)

Synthesize converts text to speech using the OmniVoice provider.

func (*Provider) SynthesizeWithDuration

func (p *Provider) SynthesizeWithDuration(ctx context.Context, text string, voice transcript.VoiceConfig) ([]byte, time.Duration, error)

SynthesizeWithDuration converts text to speech and returns audio with duration.

func (*Provider) UnderlyingProvider

func (p *Provider) UnderlyingProvider() omnivoice.TTSProvider

UnderlyingProvider returns the wrapped OmniVoice provider for advanced operations.

type ProviderConfig

type ProviderConfig struct {
	// ElevenLabsAPIKey is the API key for ElevenLabs.
	ElevenLabsAPIKey string

	// DeepgramAPIKey is the API key for Deepgram.
	DeepgramAPIKey string
}

ProviderConfig holds configuration for creating TTS providers.

Jump to

Keyboard shortcuts

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