Documentation ¶
Index ¶
Constants ¶
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 相关接口
const (
PackageVersion = "0.0.1" // edge-tts-go 包版本
)
Variables ¶
var NoAudioReceived = errors.New("no audio received from the server")
NoAudioReceived error when no audio is received from the server
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.
var UnknownResponse = errors.New("unknown response received from the server")
UnknownResponse error for unknown server responses
var WebSocketError = errors.New("WebSocket error occurred")
WebSocketError error for WebSocket errors
Functions ¶
func ValidateStringParam ¶
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 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"` }