Documentation
¶
Index ¶
Constants ¶
View Source
const (
FunctionSpeechSynthesizer string = "SpeechSynthesizer"
)
View Source
const (
StreamingDuplex string = "duplex"
)
View Source
const (
TaskGroupAudio string = "audio"
)
View Source
const (
TaskTTS string = "tts"
)
View Source
const (
TextTypePlainText string = "PlainText"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AsyncSynthesizer ¶
type AsyncSynthesizer struct {
// contains filtered or unexported fields
}
func (*AsyncSynthesizer) Close ¶
func (s *AsyncSynthesizer) Close() error
func (*AsyncSynthesizer) FinishTask ¶
func (s *AsyncSynthesizer) FinishTask(ctx context.Context) error
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClientWithConfig ¶
func NewClientWithConfig(config ClientConfig) *Client
func (*Client) AsyncSynthesizer ¶
func (c *Client) AsyncSynthesizer(ctx context.Context, opts ...SynthesizerOption) (*AsyncSynthesizer, error)
func (*Client) SyncSynthesizer ¶
func (c *Client) SyncSynthesizer(ctx context.Context, opts ...SynthesizerOption) (*SyncSynthesizer, error)
type ClientConfig ¶
func DefaultConfig ¶
func DefaultConfig(apiKey string) ClientConfig
type Error ¶
type Params ¶
type Params struct {
TextType string `json:"text_type"` // PlainText
Voice Voice `json:"voice"` // longwan, longcheng, longhua, etc.
Format Format `json:"format"` // pcm, wav, mp3
SampleRate SampleRate `json:"sample_rate"` // 8000, 16000, 22050, 24000, 44100, 48000
Volume int `json:"volume,omitempty"` // range: 0~100, default: 50
Rate int `json:"rate,omitempty"` // range: 0.5~2, default: 1.0
Pitch int `json:"pitch,omitempty"` // range: 0.5~2, default: 1.0
}
type SampleRate ¶
type SampleRate int
const ( SampleRate8000 SampleRate = 8000 SampleRate16000 SampleRate = 16000 SampleRate22050 SampleRate = 22050 SampleRate24000 SampleRate = 24000 SampleRate44100 SampleRate = 44100 SampleRate48000 SampleRate = 48000 )
type SyncSynthesizer ¶
type SyncSynthesizer struct {
// contains filtered or unexported fields
}
func (*SyncSynthesizer) Close ¶
func (s *SyncSynthesizer) Close() error
type SynthesizerConfig ¶
type SynthesizerConfig struct {
Model Model `json:"model"` // cosyvoice-v1
Voice Voice `json:"voice"` // longwan, longcheng, longhua, etc.
Format Format `json:"format"` // pcm, wav, mp3
SampleRate SampleRate `json:"sample_rate"` // 8000, 16000, 22050, 24000, 44100, 48000
Volume int `json:"volume,omitempty"` // range: 0~100, default: 50
Rate int `json:"rate,omitempty"` // range: 0.5~2, default: 1.0
Pitch int `json:"pitch,omitempty"` // range: 0.5~2, default: 1.0
}
func DefaultSynthesizerConfig ¶
func DefaultSynthesizerConfig() SynthesizerConfig
type SynthesizerOption ¶
type SynthesizerOption func(*synthesizerOption)
func WithChanSize ¶
func WithChanSize(size int) SynthesizerOption
func WithDialer ¶
func WithDialer(dialer openairt.WebSocketDialer) SynthesizerOption
func WithLogger ¶
func WithLogger(logger openairt.Logger) SynthesizerOption
func WithPingInterval ¶
func WithPingInterval(interval int) SynthesizerOption
func WithSynthesizerConfig ¶
func WithSynthesizerConfig(config SynthesizerConfig) SynthesizerOption
type Voice ¶
type Voice string
const ( Longwan Voice = "longwan" Longcheng Voice = "longcheng" Longhua Voice = "longhua" Longxiaochun Voice = "longxiaochun" Longxiaoxia Voice = "longxiaoxia" Longxiaocheng Voice = "longxiaocheng" Longxiaobai Voice = "longxiaobai" Longlaotie Voice = "longlaotie" Longshu Voice = "longshu" Longjing Voice = "longjing" Longmiao Voice = "longmiao" Longyue Voice = "longyue" Longyuan Voice = "longyuan" Longfei Voice = "longfei" Longjielidou Voice = "longjielidou" Longshuo Voice = "longshuo" Longtong Voice = "longtong" Longxiang Voice = "longxiang" Loongstella Voice = "loongstella" Loongbella Voice = "loongbella" )
Click to show internal directories.
Click to hide internal directories.