YatingTtsSdk

package module
v0.0.0-...-662936a Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: MIT Imports: 7 Imported by: 0

README

Yating TTS SDK - Go version

Available Key

  • Please contact Yating TTS
Input
{
    "input": {
        "text": "sentence, the text that you want to generate audio",
        "type": "text"
    },
    "voice": {
        "model": "zh_en_female_1",
        "speed": 1,
        "pitch": 1,
        "energy": 1
    },
    "audioConfig": {
        "encoding": "LINEAR16",
        "sampleRate": "16K"
    }
}

Available Variable

Input Type
Name Description
text Recognize input.text as pure text.
ssml Recognize input.text in ssml format.
Voice Setting
Name Type Value Limit Description
model string Table bellow Voice Model
speed float 0.5 - 1.5 Voice Speed, faster slower
pitch float 0.5 - 1.5 Voice Pitch, higher or lower
energy float 0.5 - 1.5 Voice Energy, stronger or weaker
Voice Model
Name Sample Rate Description
zh_en_female_1 16k,22k Yating speak Mandarin and English
zh_en_female_2 16k,22k Yiqing speak Mandarin and English
zh_en_male_1 16k,22k Jiahao speak Mandarin and English
zh_en_male_2 22k Zhiming speak Mandarin and English
tai_female_1 16k,22k Yating speak Taiwanese
tai_female_2 16k,22k Yiqing speak Taiwanese
tai_male_1 16k,22k Jiahao speak Taiwanese
Encoding Format
Name File Extension Description
MP3 .mp3 Compressed audio
LINEAR16 .wav Uncompromised audio quality
Sampling Rate
Name Description
16K Sampling rate in 16khz
22K Sampling rate in 22khz

Documentation

Index

Constants

View Source
const (
	ModelZhEnFemale1 = "zh_en_female_1"
	ModelZhEnFemale2 = "zh_en_female_2"
	ModelZhEnMale1   = "zh_en_male_1"
	ModelZhEnMale2   = "zh_en_male_2"

	ModelTaiFemale1 = "tai_female_1"
	ModelTaiFemale2 = "tai_female_2"
	ModelTaiMale1   = "tai_male_1"

	TypeText = "text"
	TypeSsml = "ssml"

	EncodingMp3      = "MP3"
	EncodingLinear16 = "LINEAR16"

	SampleRate16k = "16K"
	SampleRate22k = "22K"
)

Variables

Functions

This section is empty.

Types

type AudioConfig

type AudioConfig struct {
	Encoding   string `json:"encoding"`
	SampleRate string `json:"sampleRate"`
}

type Input

type Input struct {
	Text string `json:"text"`
	Type string `json:"type"`
}

type SynthesizeErrorDto

type SynthesizeErrorDto struct {
	Error      string   `json:"error"`
	Message    []string `json:"message"`
	StatusCode int      `json:"statusCode"`
}

type SynthesizeRequestDto

type SynthesizeRequestDto struct {
	Input       Input       `json:"input"`
	Voice       Voice       `json:"voice"`
	AudioConfig AudioConfig `json:"audioConfig"`
}

type SynthesizeResponseDto

type SynthesizeResponseDto struct {
	AudioContent string      `json:"audioContent"`
	AudioConfig  AudioConfig `json:"audioConfig"`
}

type Voice

type Voice struct {
	Model  string  `json:"model"`
	Speed  float64 `json:"speed"`
	Pitch  float64 `json:"pitch"`
	Energy float64 `json:"energy"`
}

type YatingClient

type YatingClient struct {
	Url string
	Key string
}

func NewClient

func NewClient(url string, key string) *YatingClient

func (*YatingClient) Synthesize

func (c *YatingClient) Synthesize(text, inputType, model, encoding, sampleRate string, speed, pitch, energy float64, fileName string) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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