edgetts

package module
v0.0.0-...-133c2bc Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	NoPackTaskEntries = errors.New("no pack task entries")
)

Functions

This section is empty.

Types

type Option

type Option func(option *option)

func WithHttpProxy

func WithHttpProxy(proxy string) Option

func WithHttpProxyEx

func WithHttpProxyEx(proxy string, ignoreSSLVerification bool) Option

func WithPitch

func WithPitch(pitch string) Option

WithPitch set pitch of the tts output.such as +50Hz,-50Hz

func WithRate

func WithRate(rate string) Option

WithRate set rate of the tts output.rate=-50% means rate down 50%,rate=+50% means rate up 50%

func WithSocket5Proxy

func WithSocket5Proxy(proxy, userName, password string) Option

func WithSocket5ProxyEx

func WithSocket5ProxyEx(proxy, userName, password string, ignoreSSLVerification bool) Option

func WithVoice

func WithVoice(voice string) Option

func WithVoiceLangRegion

func WithVoiceLangRegion(voiceLangRegion string) Option

func WithVolume

func WithVolume(volume string) Option

WithVolume set volume of the tts output.volume=-50% means volume down 50%,volume=+50% means volume up 50%

type Speech

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

func NewSpeech

func NewSpeech(options ...Option) (*Speech, error)

NewSpeech creates a new Speech instance. It takes a variadic parameter: - options: a slice of communicateOption.Option that will be used to configure the Speech instance. The function returns a pointer to the newly created Speech instance and an error if any occurs during the creation process.

func (*Speech) AddPackTask

func (s *Speech) AddPackTask(dataEntries map[string]string, entryCreator func(name string) (io.Writer, error), output io.Writer, metaData ...map[string]any) error

AddPackTask adds a pack task to the speech. It takes four parameters: - dataEntries: a map where the key is the entry name and the value is the entry text to be synthesized. - entryCreator: a function that creates a writer for each entry. This can be a packer context related writer, such as a zip writer. - output: the output of the pack task, which will finally be written into a file. - metaData: optional parameter. It is the data which will be serialized into a json file. The name uses the key and value as the key-value pair. The function returns an error if there are no pack task entries.

func (*Speech) AddPackTaskWithCustomOptions

func (s *Speech) AddPackTaskWithCustomOptions(dataEntries map[string]string, entriesOption map[string][]Option, entryCreator func(name string) (io.Writer, error), output io.Writer, metaData ...map[string]any) error

AddPackTaskWithCustomOptions adds a pack task with options to the speech. It takes four parameters: - dataEntries: a map where the key is the entry name and the value is the entry text to be synthesized. - entriesOption: a map where the key is the entry name and the value is the entry option to be used for the entry. - entryCreator: a function that creates a writer for each entry. This can be a packer context related writer, such as a zip writer. - output: the output of the pack task, which will finally be written into a file. - metaData: optional parameter. It is the data which will be serialized into a json file. The name uses the key and value as the key-value pair. The function returns an error if there are no pack task entries.

func (*Speech) AddSingleTask

func (s *Speech) AddSingleTask(text string, output io.Writer) error

AddSingleTask adds a single task to the speech. It takes two parameters: - text: the text to be synthesized. - output: the output of the single task, which will finally be written into a file. The function returns an error if there is an issue with the communication.

func (*Speech) GetVoiceList

func (s *Speech) GetVoiceList() ([]Voice, error)

GetVoiceList retrieves the list of voices available for the speech. It returns a slice of Voice objects and an error if any occurs during the retrieval process.

func (*Speech) StartTasks

func (s *Speech) StartTasks() error

StartTasks starts all the tasks in the Speech instance. It creates a WaitGroup and adds the total number of tasks to it. Then it starts each task in a separate goroutine and waits for all of them to finish. The function returns an error if any occurs during the execution of the tasks.

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"`
	Language       string
	VoiceTag       VoiceTag `json:"VoiceTag"`
}

type VoiceManager

type VoiceManager struct {
}

func NewVoiceManager

func NewVoiceManager() *VoiceManager

func (*VoiceManager) ListVoices

func (m *VoiceManager) ListVoices() ([]Voice, error)

type VoiceTag

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

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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