Google Cloud Text-to-Speech API Client Library for Go
Package texttospeech offers a Client to interact with Google Cloud Text-to-Speech API.
NOTE: this package actually offers the v1beta1 version of the API, so it could stop working in case of breaking changes made by Google engineers.
Documentation
Documentation is available on GoDoc.
Usage example
The samples folder contains a minimal application to help you understand how to use the package.
Authentication
The package requires valid authentication credentials to access Google Cloud Text-to-Speech API.
-
Create a project with the Google Cloud Console, and enable the Text-to-Speech API.
-
From the Cloud Console, create a service account, download its json credentials file, then set the GOOGLE_APPLICATION_CREDENTIALS
environment variable:
export GOOGLE_APPLICATION_CREDENTIALS=/path/to/your-project-credentials.json
For more information about Authentication, please consult Google's Authentication Overview.
Run the sample
Before running the example you must first install the Text-to-Speech API client:
go get -u github.com/giefferre/texttospeech
To run the example:
go run synthesize.go en "Hello world" output.mp3
Reference
This library is inspired by: