edge_tts

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

from:https://github.com/surfaceyu/edge-tts-go/blob/main/edgeTTS/communicate.go

Index

Constants

View Source
const (
	TRUSTED_CLIENT_TOKEN = "6A5AA1D4EAFF4E9FB37E23D68491D6F4"
	WSS_URL              = "wss://speech.platform.bing.com/consumer/speech/synthesize/readaloud/edge/v1?TrustedClientToken=" + TRUSTED_CLIENT_TOKEN
	VOICE_LIST           = "https://speech.platform.bing.com/consumer/speech/synthesize/readaloud/voices/list?trustedclienttoken=" + TRUSTED_CLIENT_TOKEN
)
View Source
const (
	ZhCN = "zh-CN"
	EnUS = "en-US"
)

Locale

View Source
const (
	ChunkTypeAudio        = "Audio"
	ChunkTypeWordBoundary = "WordBoundary"
	ChunkTypeSessionEnd   = "SessionEnd"
	ChunkTypeEnd          = "ChunkEnd"
)
View Source
const Version = "1.0.1"

Version is the Edge TTS version string.

Variables

This section is empty.

Functions

func ParseVersion

func ParseVersion() (int, int, int)

ParseVersion parses the version string and returns a tuple of integers.

Types

type Communicate

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

func NewCommunicate

func NewCommunicate() *Communicate

func (*Communicate) AllocateTask

func (c *Communicate) AllocateTask(tasks []*CommunicateTextTask)

func (*Communicate) Close

func (c *Communicate) Close()

func (*Communicate) CreatePool

func (c *Communicate) CreatePool()

func (*Communicate) FillOption

func (c *Communicate) FillOption(text *CommunicateTextOption)

func (*Communicate) GetOption

func (c *Communicate) GetOption() CommunicateTextOption

func (*Communicate) OpenWs

func (c *Communicate) OpenWs() *websocket.Conn

func (*Communicate) WithProxy

func (c *Communicate) WithProxy(proxy string) *Communicate

func (*Communicate) WithRate

func (c *Communicate) WithRate(rate string) *Communicate

func (*Communicate) WithVoice

func (c *Communicate) WithVoice(voice string) *Communicate

func (*Communicate) WithVolume

func (c *Communicate) WithVolume(volume string) *Communicate

type CommunicateTextOption

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

type CommunicateTextTask

type CommunicateTextTask struct {
	Id     int
	Text   string
	Option CommunicateTextOption

	Chunk      chan communicateChunk
	SpeechData []byte
}

type ListVoices

type ListVoices struct {
	Proxy  string  `json:"proxy"`
	Voices []Voice `json:"voices"`
}

func NewListVoices

func NewListVoices(proxy string) (*ListVoices, error)

func (*ListVoices) Find

func (l *ListVoices) Find(gender, language string) []Voice

find Gender="Male/Female", Language="es"

type NoAudioReceivedError

type NoAudioReceivedError struct {
	Message string
}

NoAudioReceivedError is raised when no audio is received from the server.

func (*NoAudioReceivedError) Error

func (e *NoAudioReceivedError) Error() string

type UnexpectedResponseError

type UnexpectedResponseError struct {
	Message string
}

UnexpectedResponseError is raised when an unexpected response is received from the server.

func (*UnexpectedResponseError) Error

func (e *UnexpectedResponseError) Error() string

type UnknownResponseError

type UnknownResponseError struct {
	Message string
}

UnknownResponseError is raised when an unknown response is received from the server.

func (*UnknownResponseError) Error

func (e *UnknownResponseError) Error() string

type Voice

type Voice struct {
	Name      string `json:"Name"`
	ShortName string `json:"ShortName"`
	Gender    string `json:"Gender"`
	Locale    string `json:"Locale"`
}

type WebSocketError

type WebSocketError struct {
	Message string
}

WebSocketError is raised when a WebSocket error occurs.

func (*WebSocketError) Error

func (e *WebSocketError) Error() string

Jump to

Keyboard shortcuts

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