edgetts

package module
v0.0.0-...-77be9ea Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const NormalSsmlTemplate = `` /* 301-byte string literal not displayed */
View Source
const StyleSsmlTemplate = `` /* 357-byte string literal not displayed */

Variables

View Source
var EdgeTtsDict = map[string]string{
	"用英语": "en-US-AriaNeural",
	"用日语": "ja-JP-NanamiNeural",
	"用法语": "fr-BE-CharlineNeural",
	"用韩语": "ko-KR-SunHiNeural",
	"用德语": "de-AT-JonasNeural",
}

Functions

func CreateSSML

func CreateSSML(text, voiceName string) string

func CreateStyleSSML

func CreateStyleSSML(text, voiceName, style string) string

func GetAzureVoices

func GetAzureVoices() ([]byte, error)

func TextToMp3

func TextToMp3(tts TTS, text string, ttsLang string, filePath string) error

Types

type AzureTTS

type AzureTTS struct {
	DialTimeout  time.Duration
	WriteTimeout time.Duration
	// contains filtered or unexported fields
}

func (*AzureTTS) CloseConn

func (t *AzureTTS) CloseConn()

func (*AzureTTS) GetAudio

func (t *AzureTTS) GetAudio(ssml, format string) (audioData []byte, err error)

func (*AzureTTS) GetAudioStream

func (t *AzureTTS) GetAudioStream(ssml, format string, read func([]byte)) error

func (*AzureTTS) NewConn

func (t *AzureTTS) NewConn() error

type EdgeTTS

type EdgeTTS struct {
	DnsLookupEnabled bool // 使用DNS解析,而不是北京微软云节点。
	DialTimeout      time.Duration
	WriteTimeout     time.Duration
	// contains filtered or unexported fields
}

func (*EdgeTTS) CloseConn

func (t *EdgeTTS) CloseConn()

func (*EdgeTTS) GetAudio

func (t *EdgeTTS) GetAudio(ssml, format string) (audioData []byte, err error)

func (*EdgeTTS) GetAudioStream

func (t *EdgeTTS) GetAudioStream(ssml, format string, read func([]byte)) error

func (*EdgeTTS) NewConn

func (t *EdgeTTS) NewConn() error

func (*EdgeTTS) TextToMp3

func (t *EdgeTTS) TextToMp3(text string, ttsLang string, filePath string) error

type TReadMessage

type TReadMessage func(messageType int, p []byte, errMessage error) (finished bool)

type TTS

type TTS interface {
	NewConn() error
	CloseConn()
	GetAudio(ssml, format string) (audioData []byte, err error)
	GetAudioStream(ssml, format string, read func([]byte)) error
}

Jump to

Keyboard shortcuts

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