Documentation
¶
Index ¶
- Constants
- type Client
- type DuplexSynthesizeService
- func (s *DuplexSynthesizeService) Do(ctx context.Context) (err error)
- func (s *DuplexSynthesizeService) SetConnectID(id string) *DuplexSynthesizeService
- func (s *DuplexSynthesizeService) SetFormat(format string) *DuplexSynthesizeService
- func (s *DuplexSynthesizeService) SetInput(input StreamSynthesizeInput) *DuplexSynthesizeService
- func (s *DuplexSynthesizeService) SetOutput(output StreamSynthesizeOutput) *DuplexSynthesizeService
- func (s *DuplexSynthesizeService) SetPitchRate(rate int) *DuplexSynthesizeService
- func (s *DuplexSynthesizeService) SetRequestID(id string) *DuplexSynthesizeService
- func (s *DuplexSynthesizeService) SetResourceID(id string) *DuplexSynthesizeService
- func (s *DuplexSynthesizeService) SetSSML(ssml bool) *DuplexSynthesizeService
- func (s *DuplexSynthesizeService) SetSampleRate(rate int) *DuplexSynthesizeService
- func (s *DuplexSynthesizeService) SetSpeakerID(id string) *DuplexSynthesizeService
- func (s *DuplexSynthesizeService) SetSpeechRate(rate int) *DuplexSynthesizeService
- func (s *DuplexSynthesizeService) SetUserID(id string) *DuplexSynthesizeService
- type Option
- type StreamSynthesizeInput
- type StreamSynthesizeOutput
- type StreamSynthesizeService
- func (s *StreamSynthesizeService) Do(ctx context.Context) (err error)
- func (s *StreamSynthesizeService) SetCluster(cluster string) *StreamSynthesizeService
- func (s *StreamSynthesizeService) SetFormat(format string) *StreamSynthesizeService
- func (s *StreamSynthesizeService) SetInput(input string) *StreamSynthesizeService
- func (s *StreamSynthesizeService) SetOutput(output StreamSynthesizeOutput) *StreamSynthesizeService
- func (s *StreamSynthesizeService) SetRequestID(reqID string) *StreamSynthesizeService
- func (s *StreamSynthesizeService) SetSSML(ssml bool) *StreamSynthesizeService
- func (s *StreamSynthesizeService) SetSpeakerID(speakerID string) *StreamSynthesizeService
- func (s *StreamSynthesizeService) SetUserID(userID string) *StreamSynthesizeService
- type VoiceCloneUploadAudio
- type VoiceCloneUploadResponse
- type VoiceCloneUploadService
- func (s *VoiceCloneUploadService) AddAudio(buf []byte, format string, text string) *VoiceCloneUploadService
- func (s *VoiceCloneUploadService) Do(ctx context.Context) (err error)
- func (s *VoiceCloneUploadService) SetLanguage(language int) *VoiceCloneUploadService
- func (s *VoiceCloneUploadService) SetModelType(modelType int) *VoiceCloneUploadService
- func (s *VoiceCloneUploadService) SetSpeakerID(speakerID string) *VoiceCloneUploadService
Constants ¶
const ( FormatAAC = "aac" FormatM4A = "m4a" FormatMP3 = "mp3" FormatOGG = "ogg" FormatOGG_OPUS = "ogg_opus" FormatPCM = "pcm" FormatWAV = "wav" SampleRate8K = 8000 SampleRate16K = 16000 SampleRate24K = 24000 SampleRate32K = 32000 SampleRate44K = 44100 SampleRate48K = 48000 )
const ( // DuplexSynthesizeResourceStandard is a resource id for TTS service. DuplexSynthesizeResourceStandard = "volc.service_type.10029" // DuplexSynthesizeResourceVoiceCloneV2 is a resource id for VoiceClone 2.0 service. DuplexSynthesizeResourceVoiceCloneV2 = "volc.megatts.default" )
const ( StreamSynthesizeClusterV1 = "volcano_mega" StreamSynthesizeClusterV1Concurrent = "volcano_mega_concurr" StreamSynthesizeClusterV2 = "volcano_icl" StreamSynthesizeClusterV2Concurrent = "volcano_icl_concurr" )
const ( VoiceCloneUploadLanguageCN = 0 VoiceCloneUploadLanguageEN = 1 VoiceCloneUploadLanguageJA = 2 VoiceCloneUploadLanguageES = 3 VoiceCloneUploadLanguageID = 4 VoiceCloneUploadLanguagePT = 5 VoiceCloneUploadModelTypeV1 = 0 VoiceCloneUploadModelTypeV2 = 1 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface {
// StreamSynthesize create a new service for stream synthesize.
StreamSynthesize() *StreamSynthesizeService
// DuplexSynthesize create a new service for bidirectional stream synthesize.
DuplexSynthesize() *DuplexSynthesizeService
// VoiceCloneUpload create a new service for voice clone upload.
VoiceCloneUpload() *VoiceCloneUploadService
}
Client is the interface for the volcvoice client.
type DuplexSynthesizeService ¶
type DuplexSynthesizeService struct {
// contains filtered or unexported fields
}
DuplexSynthesizeService is a service to synthesize speech in bi-directional stream mode.
func (*DuplexSynthesizeService) Do ¶
func (s *DuplexSynthesizeService) Do(ctx context.Context) (err error)
func (*DuplexSynthesizeService) SetConnectID ¶
func (s *DuplexSynthesizeService) SetConnectID(id string) *DuplexSynthesizeService
SetConnectID sets the connect id
func (*DuplexSynthesizeService) SetFormat ¶
func (s *DuplexSynthesizeService) SetFormat(format string) *DuplexSynthesizeService
SetFormat sets the format of the synthesized speech
func (*DuplexSynthesizeService) SetInput ¶
func (s *DuplexSynthesizeService) SetInput(input StreamSynthesizeInput) *DuplexSynthesizeService
SetInputFunc sets the input function
func (*DuplexSynthesizeService) SetOutput ¶
func (s *DuplexSynthesizeService) SetOutput(output StreamSynthesizeOutput) *DuplexSynthesizeService
SetOutputFunc sets the output function
func (*DuplexSynthesizeService) SetPitchRate ¶
func (s *DuplexSynthesizeService) SetPitchRate(rate int) *DuplexSynthesizeService
SetPitchRate sets the pitch rate of the synthesized speech
func (*DuplexSynthesizeService) SetRequestID ¶
func (s *DuplexSynthesizeService) SetRequestID(id string) *DuplexSynthesizeService
SetRequestID sets the request id
func (*DuplexSynthesizeService) SetResourceID ¶
func (s *DuplexSynthesizeService) SetResourceID(id string) *DuplexSynthesizeService
SetResourceID sets the resource id
func (*DuplexSynthesizeService) SetSSML ¶
func (s *DuplexSynthesizeService) SetSSML(ssml bool) *DuplexSynthesizeService
SetSSML sets the ssml mode
func (*DuplexSynthesizeService) SetSampleRate ¶
func (s *DuplexSynthesizeService) SetSampleRate(rate int) *DuplexSynthesizeService
SetSampleRate sets the sample rate of the synthesized speech
func (*DuplexSynthesizeService) SetSpeakerID ¶
func (s *DuplexSynthesizeService) SetSpeakerID(id string) *DuplexSynthesizeService
SetSpeakerID sets the speaker id, for VoiceClone service, use the "S_" started speaker id.
func (*DuplexSynthesizeService) SetSpeechRate ¶
func (s *DuplexSynthesizeService) SetSpeechRate(rate int) *DuplexSynthesizeService
SetSpeechRate sets the speech rate of the synthesized speech
func (*DuplexSynthesizeService) SetUserID ¶
func (s *DuplexSynthesizeService) SetUserID(id string) *DuplexSynthesizeService
SetUserID sets the user id
type Option ¶
type Option func(opts *options)
func WithEndpoint ¶
WithEndpoint sets a custom endpoint for the client, default to openspeech.bytedance.com, also can be set by VOLCVOICE_ENDPOINT env.
func WithHTTPClient ¶
WithHTTPClient sets a custom http client for the client.
func WithVerbose ¶
WithVerbose enables verbose mode for the client, default to VOLCVOICE_VERBOSE env.
func WithWebsocketDialer ¶
WithWebsocketDialer sets a custom websocket dialer for the client.
type StreamSynthesizeInput ¶
StreamSynthesizeInput is a function to get input text chunk, the last chunk should be empty string and io.EOF error.
func StreamSynthesizeInputFromChannel ¶ added in v0.1.1
func StreamSynthesizeInputFromChannel(input chan string) StreamSynthesizeInput
func StreamSynthesizeInputFromSlice ¶ added in v0.1.1
func StreamSynthesizeInputFromSlice(input []string) StreamSynthesizeInput
StreamSynthesizeOutput is a function to handle output audio chunk.
type StreamSynthesizeOutput ¶
StreamSynthesizeOutput is a function to process output audio chunk.
type StreamSynthesizeService ¶
type StreamSynthesizeService struct {
// contains filtered or unexported fields
}
StreamSynthesizeService is the service for voice clone.
func (*StreamSynthesizeService) Do ¶
func (s *StreamSynthesizeService) Do(ctx context.Context) (err error)
Do sends the audio request to the server, and stream audio chunks to handler.
func (*StreamSynthesizeService) SetCluster ¶
func (s *StreamSynthesizeService) SetCluster(cluster string) *StreamSynthesizeService
SetCluster sets the cluster for the audio.
func (*StreamSynthesizeService) SetFormat ¶
func (s *StreamSynthesizeService) SetFormat(format string) *StreamSynthesizeService
SetFormat sets the encoding for the audio.
func (*StreamSynthesizeService) SetInput ¶
func (s *StreamSynthesizeService) SetInput(input string) *StreamSynthesizeService
SetInput sets the text for the audio.
func (*StreamSynthesizeService) SetOutput ¶
func (s *StreamSynthesizeService) SetOutput(output StreamSynthesizeOutput) *StreamSynthesizeService
SetOutput sets the handler for the audio chunks.
func (*StreamSynthesizeService) SetRequestID ¶
func (s *StreamSynthesizeService) SetRequestID(reqID string) *StreamSynthesizeService
SetRequestID sets the request id for the audio.
func (*StreamSynthesizeService) SetSSML ¶
func (s *StreamSynthesizeService) SetSSML(ssml bool) *StreamSynthesizeService
SetSSML sets the text type to SSML.
func (*StreamSynthesizeService) SetSpeakerID ¶
func (s *StreamSynthesizeService) SetSpeakerID(speakerID string) *StreamSynthesizeService
SetSpeakerID sets the voice type for the audio, also known as the speaker id.
func (*StreamSynthesizeService) SetUserID ¶
func (s *StreamSynthesizeService) SetUserID(userID string) *StreamSynthesizeService
SetUserID sets the user id for the audio.
type VoiceCloneUploadAudio ¶
type VoiceCloneUploadService ¶
type VoiceCloneUploadService struct {
// contains filtered or unexported fields
}
func (*VoiceCloneUploadService) AddAudio ¶
func (s *VoiceCloneUploadService) AddAudio(buf []byte, format string, text string) *VoiceCloneUploadService
func (*VoiceCloneUploadService) Do ¶
func (s *VoiceCloneUploadService) Do(ctx context.Context) (err error)
func (*VoiceCloneUploadService) SetLanguage ¶
func (s *VoiceCloneUploadService) SetLanguage(language int) *VoiceCloneUploadService
func (*VoiceCloneUploadService) SetModelType ¶
func (s *VoiceCloneUploadService) SetModelType(modelType int) *VoiceCloneUploadService
func (*VoiceCloneUploadService) SetSpeakerID ¶
func (s *VoiceCloneUploadService) SetSpeakerID(speakerID string) *VoiceCloneUploadService