tts

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ChunkTypeAudio responseChunkType = iota
	ChunkTypeWordBoundary
	ChunkTypeSessionEnd
	ChunkTypeEnd
)

Variables

This section is empty.

Functions

func ReadResponse

func ReadResponse(conn *websocket.Conn) iter.Seq2[responseChunk, error]

ReadResponse read response from Edge TTS server

func SendRequest

func SendRequest(ctx context.Context, text string, args Args, format OutputFormat) (*websocket.Conn, error)

SendRequest sends request to Edge TTS server and returns connection to read result

Types

type Args

type Args struct {
	// Voice to speak with
	Voice string

	// Volume delta, e.g. "+10%" or "-20%"
	Volume string

	// Rate delta, e.g. "+10%" or "-20%"
	Rate string
}

type OutputFormat

type OutputFormat int8
const (
	OutputFormatMp3 OutputFormat = iota
	OutputFormatWebm
	OutputFormatOgg
	OutputFormatRaw22050
	OutputFormatRaw44100
)

func (OutputFormat) String

func (f OutputFormat) String() string

type SpeechMetadata

type SpeechMetadata struct {
	// Start time of word in generated sound in milliseconds
	Offset int `json:"offset"`

	// Duration of word pronunciation in milliseconds
	Duration int `json:"duration"`

	// Separate word
	Text string `json:"text"`
}

Jump to

Keyboard shortcuts

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