You can get a complete list of all the supported voices by
calling the voices:list
endpoint of the API. You can also find the
complete list of voices available on the
Supported Voices page.
The following code snippets demonstrate how to list the voices available in the Text-to-Speech API for text-to-speech synthesis.
These samples require that you have set up
gcloud
and have created and activated a service account. For
information about setting up gcloud
, and also creating and
activating a service account, see
Quickstart:Text-to-Speech.
Protocol
Refer to the voices:list API endpoint for complete details.
To get a list of the available voices for text-to-speech synthesis, make a GET request to the voices:list API endpoint.
curl -H "Authorization: Bearer "$(gcloud auth application-default print-access-token) \ -H "Content-Type: application/json; charset=utf-8" \ "https://texttospeech.googleapis.com/v1/voices"
The Text-to-Speech API returns a JSON-formatted result that looks similar to the following:
{ "voices": [ { "languageCodes": [ "es-ES" ], "name": "es-ES-Standard-A", "ssmlGender": "FEMALE", "naturalSampleRateHertz": 24000 }, { "languageCodes": [ "ja-JP" ], "name": "ja-JP-Standard-A", "ssmlGender": "FEMALE", "naturalSampleRateHertz": 22050 }, { "languageCodes": [ "pt-BR" ], "name": "pt-BR-Standard-A", "ssmlGender": "FEMALE", "naturalSampleRateHertz": 24000 }, ... ] }
Go
Java
Node.js
Python
Additional languages
C#: Please follow the C# setup instructions on the client libraries page and then visit the Text-to-Speech reference documentation for .NET.
PHP: Please follow the PHP setup instructions on the client libraries page and then visit the Text-to-Speech reference documentation for PHP.
Ruby: Please follow the Ruby setup instructions on the client libraries page and then visit the Text-to-Speech reference documentation for Ruby.