Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var MapAudioFileExtensions = map[string]string{
"RAW16khz16bitMonoPCM": "raw",
"RAW24khz16bitMonoPCM": "raw",
"RAW48khz16bitMonoPCM": "raw",
"RAW8khz8bitMonoMulaw": "raw",
"RAW8khz8bitMonoAlaw": "raw",
"AUDIO16khz32kbitrateMonoMP3": "mp3",
"AUDIO16khz128kbitrateMonoMP3": "mp3",
"AUDIO24khz96kbitrateMonoMP3": "mp3",
"AUDIO48khz96kbitrateMonoMP3": "mp3",
"RAW16khz16bitMonoTruesilk": "raw",
"WEBM16khz16bitMonoOpus": "opus",
"OGG16khz16bitMonoOpus": "opus",
"OGG48khz16bitMonoOpus": "opus",
"RIFF16khz16bitMonoPCM": "wav",
"RIFF24khz16bitMonoPCM": "wav",
"RIFF48khz16bitMonoPCM": "wav",
"RIFF8khz8bitMonoMulaw": "wav",
"RIFF8khz8bitMonoAlaw": "wav",
"AUDIO16khz64kbitrateMonoMP3": "mp3",
"AUDIO24khz48kbitrateMonoMP3": "mp3",
"AUDIO24khz160kbitrateMonoMP3": "mp3",
"AUDIO48khz192kbitrateMonoMP3": "mp3",
"RAW24khz16bitMonoTruesilk": "raw",
"WEBM24khz16bitMonoOpus": "webm",
"OGG24khz16bitMonoOpus": "ogg",
}
var MapAudioToFormatid = map[string]AudioOutput{ "RAW16khz16bitMonoPCM": RAW16khz16bitMonoPCM, "RAW24khz16bitMonoPCM": RAW24khz16bitMonoPCM, "RAW48khz16bitMonoPCM": RAW48khz16bitMonoPCM, "RAW8khz8bitMonoMulaw": RAW8khz8bitMonoMulaw, "RAW8khz8bitMonoAlaw": RAW8khz8bitMonoAlaw, "AUDIO16khz32kbitrateMonoMP3": AUDIO16khz32kbitrateMonoMP3, "AUDIO16khz128kbitrateMonoMP3": AUDIO16khz128kbitrateMonoMP3, "AUDIO24khz96kbitrateMonoMP3": AUDIO24khz96kbitrateMonoMP3, "AUDIO48khz96kbitrateMonoMP3": AUDIO48khz96kbitrateMonoMP3, "RAW16khz16bitMonoTruesilk": RAW16khz16bitMonoTruesilk, "WEBM16khz16bitMonoOpus": WEBM16khz16bitMonoOpus, "OGG16khz16bitMonoOpus": OGG16khz16bitMonoOpus, "OGG48khz16bitMonoOpus": OGG48khz16bitMonoOpus, "RIFF16khz16bitMonoPCM": RIFF16khz16bitMonoPCM, "RIFF24khz16bitMonoPCM": RIFF24khz16bitMonoPCM, "RIFF48khz16bitMonoPCM": RIFF48khz16bitMonoPCM, "RIFF8khz8bitMonoMulaw": RIFF8khz8bitMonoMulaw, "RIFF8khz8bitMonoAlaw": RIFF8khz8bitMonoAlaw, "AUDIO16khz64kbitrateMonoMP3": AUDIO16khz64kbitrateMonoMP3, "AUDIO24khz48kbitrateMonoMP3": AUDIO24khz48kbitrateMonoMP3, "AUDIO24khz160kbitrateMonoMP3": AUDIO24khz160kbitrateMonoMP3, "AUDIO48khz192kbitrateMonoMP3": AUDIO48khz192kbitrateMonoMP3, "RAW24khz16bitMonoTruesilk": RAW24khz16bitMonoTruesilk, "WEBM24khz16bitMonoOpus": WEBM24khz16bitMonoOpus, "OGG24khz16bitMonoOpus": OGG24khz16bitMonoOpus, }
Functions ¶
func GenderStrings ¶
func GenderStrings() []string
GenderStrings returns a slice of all String values of the enum
func LocaleStrings ¶
func LocaleStrings() []string
LocaleStrings returns a slice of all String values of the enum
Types ¶
type AudioOutput ¶
type AudioOutput int
const ( RAW16khz16bitMonoPCM AudioOutput = iota RAW24khz16bitMonoPCM RAW48khz16bitMonoPCM RAW8khz8bitMonoMulaw RAW8khz8bitMonoAlaw AUDIO16khz32kbitrateMonoMP3 AUDIO16khz128kbitrateMonoMP3 AUDIO24khz96kbitrateMonoMP3 AUDIO48khz96kbitrateMonoMP3 RAW16khz16bitMonoTruesilk WEBM16khz16bitMonoOpus OGG16khz16bitMonoOpus OGG48khz16bitMonoOpus RIFF16khz16bitMonoPCM RIFF24khz16bitMonoPCM RIFF48khz16bitMonoPCM RIFF8khz8bitMonoMulaw RIFF8khz8bitMonoAlaw AUDIO16khz64kbitrateMonoMP3 AUDIO24khz48kbitrateMonoMP3 AUDIO24khz160kbitrateMonoMP3 AUDIO48khz192kbitrateMonoMP3 RAW24khz16bitMonoTruesilk WEBM24khz16bitMonoOpus OGG24khz16bitMonoOpus )
func (AudioOutput) String ¶
func (a AudioOutput) String() string
type AzureCSTextToSpeech ¶
type AzureCSTextToSpeech struct { RegionVoiceMap RegionVoiceMap SubscriptionKey string // API key for Azure's Congnitive Speech services TokenRefreshDoneCh chan bool // channel to stop the token refresh goroutine. HttpProxy string // contains filtered or unexported fields }
AzureCSTextToSpeech stores configuration and state information for the TTS client.
func New ¶
func New(subscriptionKey string, region Region, proxy string) (*AzureCSTextToSpeech, error)
New returns an AzureCSTextToSpeech object.
func (*AzureCSTextToSpeech) Synthesize ¶
func (az *AzureCSTextToSpeech) Synthesize(speechText string, locale Locale, name, pitch, rate string, audioOutput AudioOutput) ([]byte, error)
Synthesize directs to SynthesizeWithContext. A new context.Withtimeout is created with the timeout as defined by synthesizeActionTimeout
func (*AzureCSTextToSpeech) SynthesizeWithContext ¶
func (az *AzureCSTextToSpeech) SynthesizeWithContext(ctx context.Context, speechText string, locale Locale, name, pitch, rate string, audioOutput AudioOutput) ([]byte, error)
SynthesizeWithContext returns a bytestream of the rendered text-to-speech in the target audio format. `speechText` is the string of text in which a user wishes to Synthesize, `region` is the language/locale, `gender` is the desired output voice and `audioOutput` captures the audio format.
type ExtendedPropertyMap ¶
type ExtendedPropertyMap struct {
IsHighQuality48K string `json:"IsHighQuality48K,omitempty"`
}
type Gender ¶
type Gender int
Gender type for the digitized language
const ( // GenderMale , GenderFemale are the static Gender constants for digitized voices. // See Gender in https://docs.microsoft.com/en-us/azure/cognitive-services/speech-service/language-support#standard-voices for breakdown GenderMale Gender = iota // Male GenderFemale // Female )
func GenderString ¶
GenderString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.
func (Gender) IsAGender ¶
IsAGender returns "true" if the value is listed in the enum definition. "false" otherwise
func (Gender) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface for Gender
func (*Gender) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface for Gender
type Locale ¶
type Locale int
Locale references the language or locale for text-to-speech. See "locale" in https://docs.microsoft.com/en-us/azure/cognitive-services/speech-service/language-support#standard-voices
const ( LocaleafZA Locale = iota //af-ZA LocaleamET //am-ET LocalearAE //ar-AE LocalearBH //ar-BH LocalearDZ //ar-DZ LocalearEG //ar-EG LocalearIQ //ar-IQ LocalearJO //ar-JO LocalearKW //ar-KW LocalearLY //ar-LY LocalearMA //ar-MA LocalearQA //ar-QA LocalearSA //ar-SA LocalearSY //ar-SY LocalearTN //ar-TN LocalearYE //ar-YE LocalebgBG //bg-BG LocalebnBD //bn-BD LocalecaES //ca-ES LocalecsCZ //cs-CZ LocalecyGB //cy-GB LocaledaDK //da-DK LocaledeAT //de-AT LocaledeCH // de-CH LocaledeDE // de-DE LocaleelGR // el-GR LocaleenAU // en-AU LocaleenCA // en-CA LocaleenGB // en-GB LocaleenHK // en-HK LocaleenIE // en-IE LocaleenIN // en-IN LocaleenKE // en-KE LocaleenNG // en-NG LocaleenNZ // en-NZ LocaleenPH // en-PH LocaleenSG // en-SG LocaleenTZ // en-TZ LocaleenUS // en-US LocaleenZA // en-ZA LocaleesAR // es-AR LocaleesBO // es-BO LocaleesCL // es-CL LocaleesCO // es-CO LocaleesCR // es-CR LocaleesCU // es-CU LocaleesDO // es-DO LocaleesEC // es-EC LocaleesES // es-ES LocaleesGQ // es-GQ LocaleesGT // es-GT LocaleesHN // es-HN LocaleesMX // es-MX LocaleesNI // es-NI LocaleesPA // es-PA LocaleesPE // es-PE LocaleesPR // es-PR LocaleesPY // es-PY LocaleesSV // es-SV LocaleesUS // es-US LocaleesUY // es-UY LocaleesVE // es-VE LocaleetEE // et-EE LocalefaIR // fa-IR LocalefiFI // fi-FI LocalefilPH // fil-PH LocalefrBE // fr-BE LocalefrCA // fr-CA LocalefrCH // fr-CH LocalefrFR // fr-FR LocalegaIE // ga-IE LocaleglES // gl-ES LocaleguIN // gu-IN LocaleheIL // he-IL LocalehiIN // hi-IN LocalehrHR // hr-HR LocalehuHU // hu-HU LocaleidID // id-ID LocaleitIT // it-IT LocalejaJP // ja-JP LocalejvID // jv-ID LocalekmKH // km-KH LocalekoKR // ko-KR LocaleltLT // lt-LT LocalelvLV // lv-LV LocalemrIN // mr-IN LocalemsMY // ms-MY LocalemtMT // mt-MT LocalemyMM // my-MM LocalenbNO // nb-NO LocalenlBE // nl-BE LocalenlNL // nl-NL LocaleplPL // pl-PL LocaleptBR // pt-BR LocaleptPT // pt-PT LocaleroRO // ro-RO LocaleruRU // ru-RU LocaleskSK // sk-SK LocaleslSI // sl-SI LocalesoSO // so-SO LocalesuID // su-ID LocalesvSE // sv-SE LocaleswKE // sw-KE LocaleswTZ // sw-TZ LocaletaIN // ta-IN LocaletaLK // ta-LK LocaletaSG // ta-SG LocaleteIN // te-IN LocalethTH // th-TH LocaletrTR // tr-TR LocaleukUA // uk-UA LocaleurIN // ur-IN LocaleurPK // ur-PK LocaleuzUZ // uz-UZ LocaleviVN // vi-VN LocalezhCN // zh-CN LocalezhHK // zh-HK LocalezhTW // zh-TW LocalezuZA // zu-ZA )
func LocaleString ¶
LocaleString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.
func (Locale) IsALocale ¶
IsALocale returns "true" if the value is listed in the enum definition. "false" otherwise
func (Locale) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface for Locale
func (*Locale) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface for Locale
type Region ¶
type Region int
Region references the locations of the availability of standard voices. See https://docs.microsoft.com/en-us/azure/cognitive-services/speech-service/regions#standard-voices
const ( // Azure regions and their endpoints that support the Text To Speech service. RegionAustraliaEast Region = iota RegionBrazilSouth RegionCanadaCentral RegionCentralUS RegionEastAsia RegionEastUS RegionEastUS2 RegionFranceCentral RegionIndiaCentral RegionJapanEast RegionJapanWest RegionKoreaCentral RegionNorthCentralUS RegionNorthEurope RegionSouthCentralUS RegionSoutheastAsia RegionUKSouth RegionWestEurope RegionWestUS RegionWestUS2 )
type RegionVoiceMap ¶
type RegionVoiceMap map[supportedVoices]string