edgetts

package module
v0.2.8 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 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 added in v0.2.1

type Option func(option *option)

func WithHttpProxy added in v0.2.1

func WithHttpProxy(proxy string) Option

func WithHttpProxyEx added in v0.2.6

func WithHttpProxyEx(proxy string, ignoreSSLVerification bool) Option

func WithPitch added in v0.2.5

func WithPitch(pitch string) Option

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

func WithRate added in v0.2.1

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 added in v0.2.1

func WithSocket5Proxy(proxy, userName, password string) Option

func WithSocket5ProxyEx added in v0.2.6

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

func WithVoice added in v0.2.1

func WithVoice(voice string) Option

func WithVoiceLangRegion added in v0.2.1

func WithVoiceLangRegion(voiceLangRegion string) Option

func WithVolume added in v0.2.1

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 added in v0.1.3

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 added in v0.2.4

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 added in v0.1.3

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 added in v0.1.3

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 added in v0.2.3

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 added in v0.2.3

type VoiceManager struct {
}

func NewVoiceManager added in v0.2.3

func NewVoiceManager() *VoiceManager

func (*VoiceManager) ListVoices added in v0.2.3

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

type VoiceTag added in v0.2.3

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