Documentation ¶
Index ¶
- Constants
- func IssueToken(hc *http.Client, region, key string) (string, error)
- func IssueTokenUrl(region string) *url.URL
- func NewSynthesizer(hc *http.Client, region, key string, audioOutput AudioOutput, ...) (tts_integration.Synthesizer, error)
- func SsmlToSpeech(hc *http.Client, ssml []byte, audioOutput AudioOutput, region, token string) (io.ReadCloser, error)
- func TextToSpeech(hc *http.Client, text string, audioOutput AudioOutput, region, token string, ...) (io.ReadCloser, error)
- func TextToSpeechUrl(region string) *url.URL
- func VoicesListUrl(region string) *url.URL
- type AudioOutput
- type SpeakData
- type Synthesizer
- func (s *Synthesizer) DecorateWithPauses(text string, d time.Duration) (string, tts_integration.SynthesisInputType)
- func (s *Synthesizer) IsNameRequired() bool
- func (s *Synthesizer) IsSSMLSupported() bool
- func (s *Synthesizer) IsWriterRequired() bool
- func (s *Synthesizer) RefreshToken() error
- func (s *Synthesizer) VoicesStrings(params ...string) ([]string, error)
- func (s *Synthesizer) WriteSSML(ssml string, w io.Writer, _ string) error
- func (s *Synthesizer) WriteText(text string, w io.Writer, _ string) error
- type VoiceParams
- func (vp *VoiceParams) NewSpeakData(text string) *SpeakData
- func (vp *VoiceParams) SsmlContentToSpeech(hc *http.Client, ssml string, audioOutput AudioOutput, region, token string) (io.ReadCloser, error)
- func (vp *VoiceParams) TextToSpeech(hc *http.Client, text string, audioOutput AudioOutput, region, token string) (io.ReadCloser, error)
- type VoicesListResponse
Constants ¶
View Source
const ( DefaultAudioOutput = Audio48khz192kbpsMonoMp3 DefaultAudioOutputExt = ".mp3" )
View Source
const (
OcpApimSubscriptionKeyHeader = "Ocp-Apim-Subscription-Key"
)
Variables ¶
This section is empty.
Functions ¶
func IssueToken ¶ added in v0.1.18
func IssueTokenUrl ¶ added in v0.1.18
func NewSynthesizer ¶
func NewSynthesizer(hc *http.Client, region, key string, audioOutput AudioOutput, voiceParams ...string) (tts_integration.Synthesizer, error)
func SsmlToSpeech ¶
func SsmlToSpeech(hc *http.Client, ssml []byte, audioOutput AudioOutput, region, token string) (io.ReadCloser, error)
func TextToSpeech ¶
func TextToSpeech(hc *http.Client, text string, audioOutput AudioOutput, region, token string, voiceParams ...string) (io.ReadCloser, error)
func TextToSpeechUrl ¶
func VoicesListUrl ¶
Types ¶
type AudioOutput ¶
type AudioOutput string
const ( Audio16khz32kbpsMonoOpus AudioOutput = "audio-16khz-16bit-32kbps-mono-opus" Audio24khz24kbpsMonoOpus AudioOutput = "audio-24khz-16bit-24kbps-mono-opus" Audio24khz48kbpsMonoOpus AudioOutput = "audio-24khz-16bit-48kbps-mono-opus" Audio16khz32kbpsMonoMp3 AudioOutput = "audio-16khz-32kbitrate-mono-mp3" Audio16khz64kbpsMonoMp3 AudioOutput = "audio-16khz-64kbitrate-mono-mp3" Audio16khz128kbpsMonoMp3 AudioOutput = "audio-16khz-128kbitrate-mono-mp3" Audio24khz48kbpsMonoMp3 AudioOutput = "audio-24khz-48kbitrate-mono-mp3" Audio24khz96kbpsMonoMp3 AudioOutput = "audio-24khz-96kbitrate-mono-mp3" Audio24khz160kbpsMonoMp3 AudioOutput = "audio-24khz-160kbitrate-mono-mp3" Audio48khz96kbpsMonoMp3 AudioOutput = "audio-48khz-96kbitrate-mono-mp3" Audio48khz192kbpsMonoMp3 AudioOutput = "audio-48khz-192kbitrate-mono-mp3" Ogg16khzOpus AudioOutput = "ogg-16khz-16bit-mono-opus" Ogg24khzOpus AudioOutput = "ogg-24khz-16bit-mono-opus" Ogg48khzOpus AudioOutput = "ogg-48khz-16bit-mono-opus" Raw8khz8bitAlaw AudioOutput = "raw-8khz-8bit-mono-alaw" Raw8khz8bitMulaw AudioOutput = "raw-8khz-8bit-mono-mulaw" Raw8khz16bitPCM AudioOutput = "raw-8khz-16bit-mono-pcm" Raw16khzPCM AudioOutput = "raw-16khz-16bit-mono-pcm" Raw16khzTrueSilk AudioOutput = "raw-16khz-16bit-mono-truesilk" Raw22khzPCM AudioOutput = "raw-22050hz-16bit-mono-pcm" Raw24khzPCM AudioOutput = "raw-24khz-16bit-mono-pcm" Raw24khzTrueSilk AudioOutput = "raw-24khz-16bit-mono-truesilk" Raw44khzPCM AudioOutput = "raw-44100hz-16bit-mono-pcm" Raw48khzPCM AudioOutput = "raw-48khz-16bit-mono-pcm" WebM16khzOpus AudioOutput = "webm-16khz-16bit-mono-opus" WebM24khz24kbpsOpus AudioOutput = "webm-24khz-16bit-24kbps-mono-opus" WebM24khzOpus AudioOutput = "webm-24khz-16bit-mono-opus" Riff8khzAlaw AudioOutput = "riff-8khz-8bit-mono-alaw" Riff8khzMulaw AudioOutput = "riff-8khz-8bit-mono-mulaw" Riff8khzPCM AudioOutput = "riff-8khz-16bit-mono-pcm" Riff22khzPCM AudioOutput = "riff-22050hz-16bit-mono-pcm" Riff24khzPCM AudioOutput = "riff-24khz-16bit-mono-pcm" Riff44khzPCM AudioOutput = "riff-44100hz-16bit-mono-pcm" Riff48khzPCM AudioOutput = "riff-48khz-16bit-mono-pcm" )
func (AudioOutput) String ¶
func (ao AudioOutput) String() string
type SpeakData ¶
type SpeakData struct { XMLName xml.Name `xml:"speak"` Version string `xml:"version,attr"` Lang string `xml:"xml:lang,attr,omitempty"` Voice *VoiceParams `xml:"voice"` }
func NewSpeakData ¶
type Synthesizer ¶
type Synthesizer struct {
// contains filtered or unexported fields
}
func (*Synthesizer) DecorateWithPauses ¶
func (s *Synthesizer) DecorateWithPauses(text string, d time.Duration) (string, tts_integration.SynthesisInputType)
func (*Synthesizer) IsNameRequired ¶
func (s *Synthesizer) IsNameRequired() bool
func (*Synthesizer) IsSSMLSupported ¶
func (s *Synthesizer) IsSSMLSupported() bool
func (*Synthesizer) IsWriterRequired ¶
func (s *Synthesizer) IsWriterRequired() bool
func (*Synthesizer) RefreshToken ¶ added in v0.1.18
func (s *Synthesizer) RefreshToken() error
func (*Synthesizer) VoicesStrings ¶
func (s *Synthesizer) VoicesStrings(params ...string) ([]string, error)
type VoiceParams ¶
type VoiceParams struct { Name string `xml:"name,attr"` Lang string `xml:"xml:lang,attr,omitempty"` Gender string `xml:"xml:gender,attr,omitempty"` Text string `xml:",chardata"` }
func NewVoiceParams ¶
func NewVoiceParams(params ...string) *VoiceParams
func (*VoiceParams) NewSpeakData ¶
func (vp *VoiceParams) NewSpeakData(text string) *SpeakData
func (*VoiceParams) SsmlContentToSpeech ¶ added in v0.1.18
func (vp *VoiceParams) SsmlContentToSpeech(hc *http.Client, ssml string, audioOutput AudioOutput, region, token string) (io.ReadCloser, error)
func (*VoiceParams) TextToSpeech ¶
func (vp *VoiceParams) TextToSpeech(hc *http.Client, text string, audioOutput AudioOutput, region, token string) (io.ReadCloser, error)
type VoicesListResponse ¶
type VoicesListResponse struct { Name string `json:"Name"` DisplayName string `json:"DisplayName"` LocalName string `json:"LocalName"` ShortName string `json:"ShortName"` Gender string `json:"Gender"` Locale string `json:"Locale"` LocaleName string `json:"LocaleName"` SampleRateHertz string `json:"SampleRateHertz"` VoiceType string `json:"VoiceType"` Status string `json:"Status"` WordsPerMinute string `json:"WordsPerMinute,omitempty"` StyleList []string `json:"StyleList,omitempty"` SecondaryLocaleList []string `json:"SecondaryLocaleList,omitempty"` RolePlayList []string `json:"RolePlayList,omitempty"` }
func VoicesList ¶
func VoicesList(hc *http.Client, region, token string) ([]*VoicesListResponse, error)
func (*VoicesListResponse) String ¶
func (vlr *VoicesListResponse) String() string
Click to show internal directories.
Click to hide internal directories.