edge

package
v1.1.6 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2024 License: MIT Imports: 13 Imported by: 1

Documentation

Index

Constants

View Source
const (
	TrustedClientToken = "6A5AA1D4EAFF4E9FB37E23D68491D6F4"
	WssURL             = "wss://speech.platform.bing.com/consumer/speech/synthesize/" + "readaloud/edge/v1?TrustedClientToken=" + TrustedClientToken
)

Variables

This section is empty.

Functions

func GetPitchByOption added in v1.1.3

func GetPitchByOption(opts []Option) string

func GetProxyByOption

func GetProxyByOption(opts []Option) string

func GetRateByOption

func GetRateByOption(opts []Option) string

func GetVoiceByOption

func GetVoiceByOption(opts []Option) string

func GetVolumeByOption

func GetVolumeByOption(opts []Option) string

Types

type AudioData

type AudioData struct {
	Data  []byte
	Index int
}

type Communicate

type Communicate struct {
	Text string

	// https://learn.microsoft.com/en-us/azure/cognitive-services/speech-service/language-support?tabs=tts
	Voice           string
	VoiceLangRegion string

	//Indicates the speaking rate of the text. Speaking rate can be applied at the word or sentence level. The rate changes should be within 0.5 to 2 times the original audio. You can express rate as:
	//A relative value:
	//As a relative number: Expressed as a number that acts as a multiplier of the default. For example, a value of 1 results in no change in the original rate. A value of 0.5 results in a halving of the original rate. A value of 2 results in twice the original rate.
	//As a percentage: Expressed as a number preceded by "+" (optionally) or "-" and followed by "%", indicating the relative change. For example: <prosody rate="50%">some text</prosody> or <prosody rate="-50%">some text</prosody>.
	//A constant value:
	//x-slow
	//slow
	//medium
	//fast
	//x-fast
	//default
	Rate string

	//Indicates the volume level of the speaking voice. Volume changes can be applied at the sentence level. You can express the volume as:
	//An absolute value: Expressed as a number in the range of 0.0 to 100.0, from quietest to loudest, such as 75. The default value is 100.0.
	//A relative value:
	//As a relative number: Expressed as a number preceded by "+" or "-" that specifies an amount to change the volume. Examples are +10 or -5.5.
	//As a percentage: Expressed as a number preceded by "+" (optionally) or "-" and followed by "%", indicating the relative change. For example: <prosody volume="50%">some text</prosody> or <prosody volume="+3%">some text</prosody>.
	//A constant value:
	//silent
	//x-soft
	//soft
	//medium
	//loud
	//x-loud
	//default
	Volume string

	//Indicates the baseline pitch for the text. Pitch changes can be applied at the sentence level. The pitch changes should be within 0.5 to 1.5 times the original audio. You can express the pitch as:
	//An absolute value: Expressed as a number followed by "Hz" (Hertz). For example, <prosody pitch="600Hz">some text</prosody>.
	//A relative value:
	//As a relative number: Expressed as a number preceded by "+" or "-" and followed by "Hz" or "st" that specifies an amount to change the pitch. For example: <prosody pitch="+80Hz">some text</prosody> or <prosody pitch="-2st">some text</prosody>. The "st" indicates the change unit is semitone, which is half of a tone (a half step) on the standard diatonic scale.
	//As a percentage: Expressed as a number preceded by "+" (optionally) or "-" and followed by "%", indicating the relative change. For example: <prosody pitch="50%">some text</prosody> or <prosody pitch="-50%">some text</prosody>.
	//A constant value:
	//x-low
	//low
	//medium
	//high
	//x-high
	//default
	Pitch string
	Proxy string

	AudioDataIndex int
	// contains filtered or unexported fields
}

func NewCommunicate

func NewCommunicate(text string, opts ...Option) (*Communicate, error)

func (*Communicate) CloseOutput

func (c *Communicate) CloseOutput()

func (*Communicate) Stream

func (c *Communicate) Stream() (<-chan map[string]interface{}, error)

type MessageType

type MessageType int

type NoAudioReceived

type NoAudioReceived struct {
	Message string
}

type Option

type Option struct {
	OptID optionID
	Param string
}

func WithPitch added in v1.1.3

func WithPitch(pitch string) Option

func WithProxy

func WithProxy(voice string) Option

func WithRate

func WithRate(voice string) Option

func WithVolume

func WithVolume(voice string) Option

type UnexpectedResponse

type UnexpectedResponse struct {
	Message string
}

type UnknownResponse

type UnknownResponse struct {
	Message string
}

type WebSocketError

type WebSocketError struct {
	Message string
}

Jump to

Keyboard shortcuts

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