mstts

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2024 License: MIT Imports: 7 Imported by: 0

README

mstts

tts interface using microsoft translate api

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 Speech

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

func NewSpeech

func NewSpeech(options ...communicate.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][]communicate.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 Tasker

type Tasker interface {
	Start(wg *sync.WaitGroup) error
}

type Voice

type Voice struct {
	Name            string `json:"Name"`
	DisplayName     string `json:"DisplayName"`
	LocalName       string `json:"LocalName"`
	ShortName       string `json:"ShortName"`
	Gender          string `json:"Gender"`
	Locale          string `json:"Locale"`
	LocaleName      string `json:"LocaleName"`
	SampleRateHertz string `json:"SampleRateHertz"`
	VoiceType       string `json:"VoiceType"`
	Status          string `json:"Status"`
	WordsPerMinute  string `json:"WordsPerMinute"`
}

type VoiceManager

type VoiceManager struct {
}

func NewVoiceManager

func NewVoiceManager() *VoiceManager

func (*VoiceManager) ListVoices

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

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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