audio

package
v0.0.205 Latest Latest
Warning

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

Go to latest
Published: May 4, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultModel  = veniceDefaultModel
	DefaultVoice  = veniceDefaultVoice
	DefaultFormat = veniceDefaultFormat
	DefaultSpeed  = veniceDefaultSpeed
)

Variables

View Source
var (
	ElevenLabsModels = []string{
		"eleven_v3",
		"eleven_multilingual_v2",
		"eleven_flash_v2_5",
		"eleven_flash_v2",
		"eleven_turbo_v2_5",
		"eleven_turbo_v2",
		"eleven_monolingual_v1",
		"eleven_multilingual_v1",
	}
	ElevenLabsFormats = []string{
		"alaw_8000",
		"mp3_22050_32", "mp3_24000_48", "mp3_44100_32", "mp3_44100_64", "mp3_44100_96", "mp3_44100_128", "mp3_44100_192",
		"opus_48000_32", "opus_48000_64", "opus_48000_96", "opus_48000_128", "opus_48000_192",
		"pcm_8000", "pcm_16000", "pcm_22050", "pcm_24000", "pcm_32000", "pcm_44100", "pcm_48000",
		"ulaw_8000",
		"wav_8000", "wav_16000", "wav_22050", "wav_24000", "wav_32000", "wav_44100", "wav_48000",
	}
	ElevenLabsVoices = []string{
		"JBFqnCBsd6RMkjVDRZzb",
		"21m00Tcm4TlvDq8ikWAM",
		"Rachel",
		"Aria",
		"Roger",
		"Sarah",
		"Laura",
		"Charlie",
		"George",
		"Callum",
		"River",
		"Liam",
		"Charlotte",
		"Alice",
		"Matilda",
		"Will",
		"Jessica",
		"Eric",
		"Chris",
		"Brian",
		"Daniel",
		"Lily",
		"Bill",
	}
	ElevenLabsTextNormalization = []string{"auto", "on", "off"}
)
View Source
var (
	GeminiModels = []string{
		"gemini-3.1-flash-tts-preview",
		"gemini-2.5-flash-preview-tts",
		"gemini-2.5-pro-preview-tts",
	}
	GeminiFormats = []string{"wav", "pcm"}
	GeminiVoices  = []string{
		"Zephyr", "Puck", "Charon", "Kore", "Fenrir", "Leda", "Orus", "Aoede", "Callirrhoe", "Autonoe", "Enceladus", "Iapetus", "Umbriel", "Algieba", "Despina", "Erinome", "Algenib", "Rasalgethi", "Laomedeia", "Achernar", "Alnilam", "Schedar", "Gacrux", "Pulcherrima", "Achird", "Zubenelgenubi", "Vindemiatrix", "Sadachbia", "Sadaltager", "Sulafat",
	}
)
View Source
var (
	VeniceModels = []string{
		"tts-kokoro",
		"tts-qwen3-0-6b",
		"tts-qwen3-1-7b",
		"tts-xai-v1",
		"tts-inworld-1-5-max",
		"tts-chatterbox-hd",
		"tts-orpheus",
		"tts-elevenlabs-turbo-v2-5",
		"tts-minimax-speech-02-hd",
		"tts-gemini-3-1-flash",
	}
	VeniceFormats = []string{"mp3", "opus", "aac", "flac", "wav", "pcm"}
	VeniceVoices  = []string{}/* 162 elements not displayed */

)

Functions

func ExtensionForFormat

func ExtensionForFormat(format string) string

func MimeTypeForFormat

func MimeTypeForFormat(format string) string

func Save

func Save(data []byte, outputDir, text, format string) (string, error)

func ValidateElevenLabsFormat

func ValidateElevenLabsFormat(format string) error

func ValidateElevenLabsTextNormalization

func ValidateElevenLabsTextNormalization(value string) error

func ValidateElevenLabsVoiceSettings

func ValidateElevenLabsVoiceSettings(req Request) error

func ValidateFormat

func ValidateFormat(format string) error

func ValidateGeminiFormat

func ValidateGeminiFormat(format string) error

func ValidateSpeed

func ValidateSpeed(speed float64) error

func ValidateTemperature

func ValidateTemperature(temperature float64) error

func ValidateTopP

func ValidateTopP(topP float64) error

Types

type ElevenLabsProvider

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

func NewElevenLabsProvider

func NewElevenLabsProvider(apiKey string) *ElevenLabsProvider

func (*ElevenLabsProvider) Generate

func (p *ElevenLabsProvider) Generate(ctx context.Context, req Request) (*Result, error)

type GeminiProvider

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

func NewGeminiProvider

func NewGeminiProvider(apiKey string) *GeminiProvider

func (*GeminiProvider) Generate

func (p *GeminiProvider) Generate(ctx context.Context, req Request) (*Result, error)

type Request

type Request struct {
	Input                          string
	Model                          string
	Voice                          string
	Voice1                         string
	Voice2                         string
	Speaker1                       string
	Speaker2                       string
	Language                       string
	Prompt                         string
	ResponseFormat                 string
	Speed                          float64
	Streaming                      bool
	Temperature                    *float64
	TopP                           *float64
	Stability                      float64
	SimilarityBoost                float64
	Style                          float64
	UseSpeakerBoost                bool
	UseSpeakerBoostSet             bool
	Seed                           string
	PreviousText                   string
	NextText                       string
	PreviousRequestIDs             string
	NextRequestIDs                 string
	PronunciationDictionaries      string
	UsePVCAsIVC                    bool
	ApplyTextNormalization         string
	ApplyLanguageTextNormalization bool
	OptimizeStreamingLatency       int
	EnableLogging                  bool
	Debug                          bool
	DebugRaw                       bool
}

type Result

type Result struct {
	Data     []byte
	MimeType string
	Format   string
}

type VeniceProvider

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

func NewVeniceProvider

func NewVeniceProvider(apiKey string) *VeniceProvider

func (*VeniceProvider) Generate

func (p *VeniceProvider) Generate(ctx context.Context, req Request) (*Result, error)

Jump to

Keyboard shortcuts

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