Documentation ¶
Index ¶
- Variables
- type Option
- func WithHttpProxy(proxy string) Option
- func WithHttpProxyEx(proxy string, ignoreSSLVerification bool) Option
- func WithPitch(pitch string) Option
- func WithRate(rate string) Option
- func WithSocket5Proxy(proxy, userName, password string) Option
- func WithSocket5ProxyEx(proxy, userName, password string, ignoreSSLVerification bool) Option
- func WithVoice(voice string) Option
- func WithVoiceLangRegion(voiceLangRegion string) Option
- func WithVolume(volume string) Option
- type Speech
- func (s *Speech) AddPackTask(dataEntries map[string]string, ...) error
- func (s *Speech) AddPackTaskWithCustomOptions(dataEntries map[string]string, entriesOption map[string][]Option, ...) error
- func (s *Speech) AddSingleTask(text string, output io.Writer) error
- func (s *Speech) GetVoiceList() ([]Voice, error)
- func (s *Speech) StartTasks() error
- type Voice
- type VoiceManager
- type VoiceTag
Constants ¶
This section is empty.
Variables ¶
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 WithHttpProxyEx ¶ added in v0.2.6
func WithRate ¶ added in v0.2.1
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 WithSocket5ProxyEx ¶ added in v0.2.6
func WithVoiceLangRegion ¶ added in v0.2.1
func WithVolume ¶ added in v0.2.1
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 ¶
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
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
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 ¶
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)