edge_tts

package
v0.0.0-...-72981a8 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

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_URL       = "https://speech.platform.bing.com/consumer/speech/synthesize/readaloud/voices/list?trustedclienttoken=" + TRUSTED_CLIENT_TOKEN
)

edge tts 相关接口

View Source
const (
	PackageVersion = "0.0.1" // edge-tts-go 包版本
)

Variables

View Source
var NoAudioReceived = errors.New("no audio received from the server")

NoAudioReceived error when no audio is received from the server

View Source
var UnexpectedResponse = errors.New("unexpected response received from the server")

UnexpectedResponse error for unexpected server responses

This hasn't happened yet, but it's possible that the server will change its response format in the future.

View Source
var UnknownResponse = errors.New("unknown response received from the server")

UnknownResponse error for unknown server responses

View Source
var WebSocketError = errors.New("WebSocket error occurred")

WebSocketError error for WebSocket errors

Functions

func ValidateStringParam

func ValidateStringParam(paramName, paramValue, pattern string) (string, error)

ValidateStringParam validates the given string parameter based on type and pattern.

Types

type Communicate

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

Communicate is a struct representing communication with the service.

func NewCommunicate

func NewCommunicate(text string, options ...CommunicateOption) (*Communicate, error)

NewCommunicate initializes the Communicate struct.

func (*Communicate) Stream

func (c *Communicate) Stream() ([]byte, error)

type CommunicateOption

type CommunicateOption func(*Communicate) error

func SetPitch

func SetPitch(pitch string) CommunicateOption

SetPitch sets the pitch for communication.

func SetProxy

func SetProxy(proxy string) CommunicateOption

SetProxy sets the proxy for communication.

func SetRate

func SetRate(rate string) CommunicateOption

SetRate sets the rate for communication.

func SetReceiveTimeout

func SetReceiveTimeout(receiveTimeout int) CommunicateOption

SetReceiveTimeout sets the receive timeout for communication.

func SetVoice

func SetVoice(voice string) CommunicateOption

SetVoice sets the voice for communication.

func SetVolume

func SetVolume(volume string) CommunicateOption

SetVolume sets the volume for communication.

type Voice

type Voice struct {
	Name           string   `json:"Name"`
	ShortName      string   `json:"ShortName"`
	Gender         string   `json:"Gender"`
	Locale         string   `json:"Locale"`
	SuggestedCodec string   `json:"SuggestedCodec"`
	FriendlyName   string   `json:"FriendlyName"`
	Status         string   `json:"Status"`
	VoiceTag       VoiceTag `json:"VoiceTag"`
}

func ListVoices

func ListVoices(proxyURL string) ([]Voice, error)

type VoiceTag

type VoiceTag struct {
	ContentCategories  []string `json:"ContentCategories"`
	VoicePersonalities []string `json:"VoicePersonalities"`
}

Jump to

Keyboard shortcuts

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