n8n community node for Google Cloud Text-to-Speech API
npm install n8n-nodes-google-cloud-tts``bash`
npm install n8n-nodes-google-cloud-tts
For Docker-based deployments, add the following to your n8n Dockerfile:
`dockerfile`
RUN npm install -g n8n-nodes-google-cloud-tts
#### Synthesize
- Description: Convert text to speech using Google Cloud Text-to-Speech API
- Parameters:
- text: The text to convert to speech (required)languageCode
- : Language code (e.g., 'de-DE', 'en-US')voiceName
- : Specific voice name (optional)voiceGender
- : Voice gender (NEUTRAL, MALE, FEMALE)audioEncoding
- : Audio format (MP3, LINEAR16, OGG_OPUS)speakingRate
- : Speaking speed (0.25 to 4.0)pitch
- : Voice pitch (-20.0 to 20.0)outputFormat
- : Return format (Base64 String or Binary Data)
#### List
- Description: List available voices from Google Cloud Text-to-Speech
- Parameters:
- languageCodeFilter: Filter voices by language code (optional)
This node supports two authentication methods:
1. Google OAuth2 API (Recommended) - Use n8n's built-in Google OAuth2 credentials
2. Service Account Key - Traditional JSON key file approach
1. Create a Google Cloud Project:
- Go to Google Cloud Console
- Create a new project or select an existing one
2. Enable the Text-to-Speech API:
- Navigate to "APIs & Services" > "Library"
- Search for "Cloud Text-to-Speech API"
- Click "Enable"
3. Configure in n8n:
- Create new credentials of type "Google OAuth2 API" (this is n8n's standard Google OAuth2 credential)
- Set the scope to include: https://www.googleapis.com/auth/cloud-platform
- Complete the OAuth flow by signing in with Google
- This credential can be reused for multiple Google Cloud services
1. Create Service Account:
- Go to "IAM & Admin" > "Service Accounts"
- Click "Create Service Account"
- Give it a name and description
- Assign the "Cloud Text-to-Speech User" role
- Generate and download the JSON key file
2. Configure in n8n:
- Create new credentials of type "Google Cloud Text-to-Speech API"
- Paste the entire JSON key file content into the "Service Account Key" field
- Optionally set the Project ID
- n8n version: 0.198.0 or later
- Node.js: 18.10 or later
1. Add the Google Cloud TTS node to your workflow
2. Select "Speech" > "Synthesize"
3. Configure the parameters:
``
Text: "Hello, this is a test message in German."
Language Code: de-DE
Voice Gender: FEMALE
Audio Encoding: MP3
4. Run the workflow
The node will return the synthesized speech as either:
- Base64 String: Audio data encoded as base64
- Binary Data: Direct binary audio file
`json`
{
"nodes": [
{
"name": "Start",
"type": "n8n-nodes-base.start",
"position": [250, 300]
},
{
"name": "Google Cloud TTS",
"type": "n8n-nodes-google-cloud-tts.googleCloudTts",
"position": [450, 300],
"parameters": {
"resource": "speech",
"operation": "synthesize",
"text": "={{ $json.message }}",
"languageCode": "de-DE",
"voiceGender": "FEMALE",
"outputFormat": "binary"
}
}
]
}
Use the "Voice" > "List" operation to discover available voices:
`json`
{
"parameters": {
"resource": "voice",
"operation": "list",
"languageCodeFilter": "de-DE"
}
}
The node supports all languages available in Google Cloud Text-to-Speech, including:
- German (de-DE): Multiple neural and WaveNet voices
- English (en-US, en-GB): Wide variety of voices
- Spanish (es-ES): Male and female voices
- French (fr-FR): Multiple voice options
- Italian (it-IT): Neural voices available
- Portuguese (pt-BR): Brazilian Portuguese
- Japanese (ja-JP): Natural-sounding voices
- Chinese (zh-CN): Mandarin Chinese
- Korean (ko-KR): Korean voices
For a complete list, use the "List Voices" operation.
`javascript
// Input data
[
{
"text": "Hello World",
"language": "en-US"
},
{
"text": "Hallo Welt",
"language": "de-DE"
},
{
"text": "Bonjour le monde",
"language": "fr-FR"
}
]
// Node configuration
{
"text": "={{ $json.text }}",
"languageCode": "={{ $json.language }}",
"voiceGender": "NEUTRAL",
"outputFormat": "binary"
}
`
`javascript`
// Use different voices based on content type
{
"text": "={{ $json.message }}",
"languageCode": "de-DE",
"voiceName": "={{ $json.isNews ? 'de-DE-News-K' : 'de-DE-Wavenet-F' }}",
"speakingRate": "={{ $json.isUrgent ? 1.2 : 1.0 }}"
}
`javascript``
// Process multiple texts in one workflow
{
"resource": "speech",
"operation": "synthesize",
"text": "={{ $json.texts.join('. ') }}",
"languageCode": "de-DE",
"outputFormat": "binary"
}
The node includes comprehensive error handling:
- Authentication errors: Invalid service account credentials
- API errors: Quota exceeded, invalid parameters
- Network errors: Connection timeout, DNS resolution
- Validation errors: Missing required parameters
Enable "Continue on Fail" in the node settings to handle errors gracefully in your workflow.
1. Batch Processing: Combine multiple short texts into longer requests
2. Caching: Store frequently used audio files to avoid repeated API calls
3. Audio Format: Use MP3 for smaller file sizes, LINEAR16 for highest quality
4. Voice Selection: Neural voices provide better quality but consume more quota
- Google Cloud Text-to-Speech Documentation
- n8n Community Nodes Documentation
- Voice Samples
- SSML Guide
For issues with this community node:
1. Check the n8n community forum
2. Review Google Cloud Text-to-Speech documentation
3. Open an issue in the project repository