Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jesseward/azuretexttospeech
A Go library for Azure's Cognitive Services text-to-speech API.
https://github.com/jesseward/azuretexttospeech
azure cognitive-services go golang speech-services text-to-speech tts
Last synced: 3 months ago
JSON representation
A Go library for Azure's Cognitive Services text-to-speech API.
- Host: GitHub
- URL: https://github.com/jesseward/azuretexttospeech
- Owner: jesseward
- License: mit
- Created: 2019-03-11T16:32:37.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-11-29T20:27:43.000Z (almost 4 years ago)
- Last Synced: 2024-06-20T15:01:50.975Z (5 months ago)
- Topics: azure, cognitive-services, go, golang, speech-services, text-to-speech, tts
- Language: Go
- Size: 36.1 KB
- Stars: 8
- Watchers: 1
- Forks: 9
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-golang-repositories - azuretexttospeech - to-speech API. (Repositories)
README
# AzureTextToSpeech Client #
![Execute Test Cases](https://github.com/jesseward/azuretexttospeech/workflows/Execute%20Test%20Cases/badge.svg)
This package provides a client for Azure's Cognitive Services (speech services) Text To Speech API. Users of the client
can specify the lanaguage (`Region` type), a string containing the desired text to speak as well as the gender (`Gender` type) in which the audiofile should be rendered. The library fetches the audio rendered in the format of your choice (see `AudioOutput` types for supported formats).API documents of interest
* Text to speech [Azure pricing details](https://azure.microsoft.com/en-us/pricing/details/cognitive-services/speech-services/). Note there is a *free* tier available.
* Text to speech, speech services [API specifications](https://docs.microsoft.com/en-us/azure/cognitive-services/speech-service/rest-apis#text-to-speech-api).## Requirements ##
A Cognitive Services (kind=Speech Services) API key is required to access the URL. This service can be enabled at the Azure portal.
## Howto ##
The following will synthesize the string `64 BASIC BYTES FREE. READY.`, using the en-US locale, rending with a female voice. The output file format is a 16khz 32kbit single channel MP3 audio file.
```golang
import tts "github.com/jesseward/azuretexttospeech"
func main() {
# See TextToSpeechAPI and TokenRefreshAPI types for list of endpoints and regions.
azureSpeech, _ := tts.New("YOUR-API-KEY", tts.RegionEastUS)
ctx := context.Background()
payload, _ := az.SynthesizeWithContext(
ctx,
"64 BASIC BYTES FREE. READY.",
tts.LocaleEnUS, // Region type
tts.GenderFemale, // Gender type
tts.Audio16khz32kbitrateMonoMp3) // AudioOutput type
// the response `payload` is your byte array containing audio data.
}
```