{
  "id": "WpWjbLrM1gsiV3Dh",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "AI-Powered Multilingual Audio Content Generator with Quality Control",
  "tags": [],
  "nodes": [
    {
      "id": "b5dc5fcf-4eb7-4edc-bc12-7bddde83da02",
      "name": "Start Workflow",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        512,
        1264
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "32687fae-8270-4cdf-8ca3-412b3b380442",
      "name": "Workflow Configuration",
      "type": "n8n-nodes-base.set",
      "position": [
        736,
        1264
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "id-1",
              "name": "chineseScript",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__Chinese text to translate__>"
            },
            {
              "id": "id-2",
              "name": "elevenLabsApiKey",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__Your ElevenLabs API key__>"
            },
            {
              "id": "id-3",
              "name": "elevenLabsVoiceId",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__ElevenLabs voice ID__>"
            },
            {
              "id": "id-4",
              "name": "googleDriveFolderId",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__Google Drive folder ID for uploads__>"
            },
            {
              "id": "id-5",
              "name": "slackChannel",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__Slack channel ID for notifications__>"
            },
            {
              "id": "id-6",
              "name": "qualityThreshold",
              "type": "number",
              "value": 7
            }
          ]
        },
        "includeOtherFields": true
      },
      "typeVersion": 3.4
    },
    {
      "id": "c3ac9bab-2b6b-40c3-a217-5581e21e6699",
      "name": "Translate to English",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        960,
        1008
      ],
      "parameters": {
        "modelId": {
          "mode": "id",
          "value": "gpt-4o"
        },
        "options": {
          "instructions": "You are a professional translator specializing in Chinese to English translation. Your task is to translate the provided Chinese text into natural, fluent English while preserving the original tone, context, and intent. Ensure the translation is suitable for text-to-speech conversion, avoiding awkward phrasing or unnatural sentence structures. Maintain cultural nuances and idiomatic expressions where appropriate. Return ONLY the translated English text without any additional commentary or explanations."
        },
        "responses": {
          "values": [
            {
              "content": "={{ $('Workflow Configuration').first().json.chineseScript }}"
            }
          ]
        },
        "builtInTools": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "0f931829-a7a2-44cb-a9cc-aff0f7c1d730",
      "name": "Translate to Spanish",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        960,
        1168
      ],
      "parameters": {
        "modelId": {
          "mode": "id",
          "value": "gpt-4o"
        },
        "options": {
          "instructions": "You are a professional translator specializing in Chinese to Spanish translation. Your task is to translate the provided Chinese text into natural, fluent Spanish while preserving the original tone, context, and intent. Ensure the translation is suitable for text-to-speech conversion, avoiding awkward phrasing or unnatural sentence structures. Maintain cultural nuances and idiomatic expressions where appropriate. Return ONLY the translated Spanish text without any additional commentary or explanations."
        },
        "responses": {
          "values": [
            {
              "content": "={{ $('Workflow Configuration').first().json.chineseScript }}"
            }
          ]
        },
        "builtInTools": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "1608edde-1c31-4f57-b4e4-18fff60263be",
      "name": "Translate to French",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        960,
        1360
      ],
      "parameters": {
        "modelId": {
          "mode": "id",
          "value": "gpt-4o"
        },
        "options": {
          "instructions": "You are a professional translator specializing in Chinese to French translation. Your task is to translate the provided Chinese text into natural, fluent French while preserving the original tone, context, and intent. Ensure the translation is suitable for text-to-speech conversion, avoiding awkward phrasing or unnatural sentence structures. Maintain cultural nuances and idiomatic expressions where appropriate. Return ONLY the translated French text without any additional commentary or explanations."
        },
        "responses": {
          "values": [
            {
              "content": "={{ $('Workflow Configuration').first().json.chineseScript }}"
            }
          ]
        },
        "builtInTools": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "26108d78-2ecd-462f-9f70-c135dd3abf8a",
      "name": "Generate English Audio (ElevenLabs)",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1888,
        1040
      ],
      "parameters": {
        "url": "=https://api.elevenlabs.io/v1/text-to-speech/{{ $('Workflow Configuration').first().json.elevenLabsVoiceId }}",
        "method": "POST",
        "options": {
          "response": {
            "response": {
              "responseFormat": "file",
              "outputPropertyName": "audio_english"
            }
          }
        },
        "jsonBody": "={ \"text\": $json.message.content, \"model_id\": \"eleven_multilingual_v2\", \"voice_settings\": { \"stability\": 0.5, \"similarity_boost\": 0.75 } }",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "headerParameters": {
          "parameters": [
            {
              "name": "xi-api-key",
              "value": "={{ $('Workflow Configuration').first().json.elevenLabsApiKey }}"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "typeVersion": 4.3
    },
    {
      "id": "44fd588f-5acf-4173-bb32-9930b3ab5bf2",
      "name": "Quality Check Translation",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        1328,
        1008
      ],
      "parameters": {
        "modelId": {
          "mode": "id",
          "value": "gpt-4o"
        },
        "options": {
          "instructions": "You are a translation quality assessor. Evaluate the English translation of the Chinese text based on:\n1. Accuracy of meaning and context\n2. Natural fluency and readability\n3. Preservation of tone and intent\n4. Suitability for text-to-speech\n5. Cultural appropriateness\n\nProvide a quality score from 1-10 and return ONLY a JSON object in this exact format:\n{\"score\": 8, \"issues\": \"Brief description of any issues or improvements needed\"}"
        },
        "responses": {
          "values": [
            {
              "content": "=Original Chinese: {{ $('Workflow Configuration').first().json.chineseScript }}\n\nEnglish Translation: {{ $json.message.content }}"
            }
          ]
        },
        "builtInTools": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "47281f90-21a3-496e-893e-598384b6acf9",
      "name": "Check Quality Score",
      "type": "n8n-nodes-base.if",
      "position": [
        1664,
        1072
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "leftValue": "",
            "caseSensitive": false,
            "typeValidation": "loose"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "id-1",
              "operator": {
                "type": "string",
                "operation": "contains"
              },
              "leftValue": "={{ $('Quality Check Translation').item.json.message.content }}",
              "rightValue": "score"
            },
            {
              "id": "id-2",
              "operator": {
                "type": "boolean",
                "operation": "true"
              },
              "leftValue": "={{ JSON.parse($('Quality Check Translation').item.json.message.content).score >= $('Workflow Configuration').first().json.qualityThreshold }}"
            }
          ]
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "59db8226-3550-4294-9bae-6ffa88915aff",
      "name": "Calculate Audio Metrics",
      "type": "n8n-nodes-base.code",
      "position": [
        1664,
        1360
      ],
      "parameters": {
        "jsCode": "const items = $input.all();\nconst results = [];\n\nfor (const item of items) {\n  const binaryKey = Object.keys(item.binary || {})[0];\n  if (binaryKey && item.binary[binaryKey]) {\n    const audioData = item.binary[binaryKey];\n    const sizeInBytes = audioData.data ? Buffer.from(audioData.data, 'base64').length : 0;\n    const sizeInKB = (sizeInBytes / 1024).toFixed(2);\n    \n    // Determine language from binary key\n    let language = 'Unknown';\n    if (binaryKey.includes('spanish')) language = 'Spanish';\n    else if (binaryKey.includes('french')) language = 'French';\n    else if (binaryKey.includes('german')) language = 'German';\n    \n    results.push({\n      json: {\n        ...item.json,\n        language: language,\n        audioSizeKB: sizeInKB,\n        audioFormat: 'mp3',\n        generatedAt: new Date().toISOString()\n      },\n      binary: item.binary\n    });\n  }\n}\n\nreturn results;"
      },
      "typeVersion": 2
    },
    {
      "id": "33ae6e12-af7d-4566-b0f9-447bea24b216",
      "name": "Combine All Audio Files",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        2352,
        1136
      ],
      "parameters": {
        "options": {},
        "aggregate": "aggregateAllItemData",
        "destinationFieldName": "allAudioFiles"
      },
      "typeVersion": 1
    },
    {
      "id": "03d8e439-096a-4af7-b193-28cc8fe949bd",
      "name": "Upload to Google Drive",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        2576,
        1136
      ],
      "parameters": {
        "name": "=chinese_translation_{{ $json.language }}_{{ $now.toFormat('yyyyMMdd_HHmmss') }}.mp3",
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive"
        },
        "options": {},
        "folderId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Workflow Configuration').first().json.googleDriveFolderId }}"
        }
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "2693d386-019d-4f43-9c2d-b19626eebea2",
      "name": "Send Slack Notification",
      "type": "n8n-nodes-base.slack",
      "position": [
        2800,
        1136
      ],
      "parameters": {
        "text": "=\u2705 *Multilingual Audio Generation Complete*\n\n\ud83d\udcdd *Original Script:* {{ $('Workflow Configuration').first().json.chineseScript.substring(0, 100) }}...\n\n\ud83c\udf0d *Languages Generated:* English, Spanish, French, German\n\ud83d\udcca *Total Files:* {{ $json.allAudioFiles.length }}\n\ud83d\udcbe *Google Drive Folder:* {{ $('Workflow Configuration').first().json.googleDriveFolderId }}\n\n\ud83d\udd17 *Files uploaded successfully to Google Drive*",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Workflow Configuration').first().json.slackChannel }}"
        },
        "otherOptions": {},
        "authentication": "oAuth2"
      },
      "credentials": {
        "slackOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.4
    },
    {
      "id": "3e8e6f8c-010f-40f3-97b9-b134d931dac5",
      "name": "Add Language Metadata",
      "type": "n8n-nodes-base.set",
      "position": [
        2112,
        1040
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "id-1",
              "name": "language",
              "type": "string",
              "value": "English"
            },
            {
              "id": "id-2",
              "name": "audioFormat",
              "type": "string",
              "value": "mp3"
            },
            {
              "id": "id-3",
              "name": "generatedAt",
              "type": "string",
              "value": "={{ $now.toISO() }}"
            },
            {
              "id": "id-4",
              "name": "translationQuality",
              "type": "string",
              "value": "={{ $('Quality Check Translation').first().json.message.content }}"
            }
          ]
        },
        "includeOtherFields": true
      },
      "typeVersion": 3.4
    },
    {
      "id": "7b30713c-9d15-4a91-b962-2f1efca3d1a7",
      "name": "Translate to German",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        960,
        1552
      ],
      "parameters": {
        "modelId": {
          "mode": "id",
          "value": "gpt-4o"
        },
        "options": {
          "instructions": "You are a professional translator specializing in Chinese to German translation. Your task is to translate the provided Chinese text into natural, fluent German while preserving the original tone, context, and intent. Ensure the translation is suitable for text-to-speech conversion, avoiding awkward phrasing or unnatural sentence structures. Maintain cultural nuances and idiomatic expressions where appropriate. Return ONLY the translated German text without any additional commentary or explanations."
        },
        "responses": {
          "values": [
            {
              "content": "={{ $('Workflow Configuration').first().json.chineseScript }}"
            }
          ]
        },
        "builtInTools": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "1e4b8fb9-69ee-4b31-80ec-275307d0fc81",
      "name": "Generate audio in German",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        1328,
        1552
      ],
      "parameters": {
        "options": {},
        "resource": "audio"
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "090fa3fb-dc08-48ed-ba1d-6a6a4d49f2f1",
      "name": "Generate audio in French",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        1328,
        1360
      ],
      "parameters": {
        "options": {},
        "resource": "audio"
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "6c703f8e-905a-4b57-bd33-259aec7ec791",
      "name": "Generate audio in Spanish",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        1328,
        1168
      ],
      "parameters": {
        "options": {},
        "resource": "audio"
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "987869db-dc00-4f32-8d57-cef47a2ed38a",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1696,
        576
      ],
      "parameters": {
        "color": 6,
        "width": 512,
        "height": 304,
        "content": "## Prerequisites\nAI translation API access (OpenAI/DeepL), ElevenLabs account with sufficient character quota\n## Use Cases\nE-learning course localization, podcast multilingual distribution\n## Customization\nAdd additional languages, modify quality score thresholds\n## Benefits\nReduces content localization time by 95%, eliminates voice talent costs"
      },
      "typeVersion": 1
    },
    {
      "id": "21b949d7-d48e-43b5-b5dd-d2eb65ed7c6c",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1280,
        624
      ],
      "parameters": {
        "width": 400,
        "height": 256,
        "content": "## Setup Steps\n1. Configure AI translation service credentials for multilingual processing \n2. Add ElevenLabs API key and select voice models for each target language \n3. Set quality threshold scores for translation validation gates \n4. Connect Google Drive with designated folder for audio storage \n5. Configure Slack webhook for team notifications with custom message"
      },
      "typeVersion": 1
    },
    {
      "id": "50e80693-c3d8-4c7a-9700-e3d5ae226012",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        480,
        656
      ],
      "parameters": {
        "width": 784,
        "height": 224,
        "content": "## How It Works\nThis workflow automates multilingual audio content creation for content creators, educators, and marketing teams distributing materials globally. It solves the challenge of producing high-quality, translated audio content at scale without manual intervention. Starting with source text, the system translates content into English, Spanish, French, and German using AI translation services, validates translation quality through automated scoring, generates natural-sounding audio using ElevenLabs text-to-speech technology, calculates audio metrics for quality assurance, combines all language versions into a single package, uploads to Google Drive for centralized storage, and sends Slack notifications for team collaboration. The workflow eliminates weeks of manual translation and voice recording work while maintaining consistent quality across all language variants."
      },
      "typeVersion": 1
    },
    {
      "id": "9e259c19-d881-42e5-86a9-bec47bb008c5",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2288,
        912
      ],
      "parameters": {
        "color": 7,
        "width": 688,
        "height": 544,
        "content": "## Packaging, Distribution & Notification\n**What:** Computes audio metrics, bundles all language files with metadata, uploads the package \n**Why:** Ensures quality validation, centralized access, and fast handoff for publishing workflows.\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "7f45993b-0942-45b6-b743-b7966fa79ee6",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1232,
        912
      ],
      "parameters": {
        "color": 7,
        "width": 1040,
        "height": 880,
        "content": "## Audio Generation\n**What:** Produces natural voice audio for each validated translation using ElevenLabs.\n**Why:** Automates professional voice-over creation without studio costs."
      },
      "typeVersion": 1
    },
    {
      "id": "c0e344cd-1769-451d-a718-cdc52a0d83df",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        480,
        912
      ],
      "parameters": {
        "color": 7,
        "width": 736,
        "height": 880,
        "content": "\n## Multilingual Translation & Validation\n**What:** Translates source text into four target languages and checks quality scores.\n**Why:** Ensures translation accuracy before audio generation, avoiding rework."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "availableInMCP": false,
    "executionOrder": "v1"
  },
  "versionId": "455c16bc-429e-4006-a524-d4080089750b",
  "connections": {
    "Start Workflow": {
      "main": [
        [
          {
            "node": "Workflow Configuration",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Quality Score": {
      "main": [
        [
          {
            "node": "Generate English Audio (ElevenLabs)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Translate to French": {
      "main": [
        [
          {
            "node": "Generate audio in French",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Translate to German": {
      "main": [
        [
          {
            "node": "Generate audio in German",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Translate to English": {
      "main": [
        [
          {
            "node": "Quality Check Translation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Translate to Spanish": {
      "main": [
        [
          {
            "node": "Generate audio in Spanish",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Add Language Metadata": {
      "main": [
        [
          {
            "node": "Combine All Audio Files",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload to Google Drive": {
      "main": [
        [
          {
            "node": "Send Slack Notification",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Workflow Configuration": {
      "main": [
        [
          {
            "node": "Translate to English",
            "type": "main",
            "index": 0
          },
          {
            "node": "Translate to Spanish",
            "type": "main",
            "index": 0
          },
          {
            "node": "Translate to French",
            "type": "main",
            "index": 0
          },
          {
            "node": "Translate to German",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Calculate Audio Metrics": {
      "main": [
        [
          {
            "node": "Combine All Audio Files",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Combine All Audio Files": {
      "main": [
        [
          {
            "node": "Upload to Google Drive",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate audio in French": {
      "main": [
        [
          {
            "node": "Calculate Audio Metrics",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate audio in German": {
      "main": [
        [
          {
            "node": "Calculate Audio Metrics",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate audio in Spanish": {
      "main": [
        [
          {
            "node": "Calculate Audio Metrics",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Quality Check Translation": {
      "main": [
        [
          {
            "node": "Check Quality Score",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate English Audio (ElevenLabs)": {
      "main": [
        [
          {
            "node": "Add Language Metadata",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}