Google Cloud Text-to-Speech icon

Google Cloud Text-to-Speech

Consume Google Cloud Text-to-Speech API

Actions2

Overview

This node integrates with the Google Cloud Text-to-Speech API to provide two main functionalities: synthesizing speech from text and listing available voices. Specifically, for the Voice - List operation, it retrieves a list of available synthetic voices that can be used for speech synthesis. Users can optionally filter the voices by language code to narrow down the results.

This operation is useful when you want to dynamically discover which voices are supported by Google Cloud TTS for a particular language or region before performing speech synthesis. For example, you might use this to populate a dropdown menu in your workflow UI or to select an appropriate voice programmatically based on user preferences.

Properties

Name Meaning
Language Code Filter Optional string to filter the list of voices by a specific language code (e.g., "de-DE").

Output

The output JSON contains the following fields:

  • voices: An array of voice objects returned by the Google Cloud Text-to-Speech API. Each voice object typically includes details such as the voice name, supported language codes, gender, and natural sample rate.
  • totalCount: The total number of voices returned in the list.

Example output structure:

{
  "voices": [
    {
      "name": "en-US-Wavenet-D",
      "languageCodes": ["en-US"],
      "ssmlGender": "MALE",
      "naturalSampleRateHertz": 24000
    },
    ...
  ],
  "totalCount": 10
}

No binary data is produced by this operation.

Dependencies

  • Requires valid Google Cloud credentials configured in n8n, either via:
    • An OAuth2 API credential with appropriate scopes for Google Cloud Platform.
    • A service account key credential with access to the Text-to-Speech API.
  • The node uses the official @google-cloud/text-to-speech library internally.
  • Network access to https://texttospeech.googleapis.com is required.

Troubleshooting

  • No valid credentials found error: This occurs if neither OAuth2 nor service account credentials are properly configured. Ensure you have set up one of these credentials with the necessary permissions.
  • Empty voices list: If filtering by language code returns no voices, verify that the language code is correct and supported by Google Cloud TTS.
  • API errors: Any API-related errors will be surfaced as node execution errors. Check your Google Cloud project quota and API enablement status.
  • Continue on Fail: If enabled, the node will continue processing other items even if one fails, returning error messages in the output JSON.

Links and References

Discussion