Audio Generation Pipeline using Self-Hosted TTS and Google Drive - n8n Workflow

Automate text-to-speech conversion using a self-hosted Bark model integrated into an n8n workflow. Reads text scripts from Google Drive, generates WAV audio, and uploads results.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • Content creators, podcasters, or media producers needing efficient batch audio production.

  • Users running a self-hosted n8n environment capable of executing custom Python scripts.

  • Developers seeking robust n8n templates for integrating command-line AI tools with cloud storage.

Overview

Generating high-quality audio from large batches of text scripts can be complex and expensive if relying solely on third-party APIs. This powerful n8n workflow solves this by creating a robust, server-side automation pipeline. It uses Google Drive to manage input and output files while leveraging the speed and customization of a self-hosted text-to-speech (TTS) engine (like Bark, as implied by the setup). The n8n node configuration is specifically designed to handle file I/O, download, local processing, and re-upload seamlessly. This specific n8n workflow is an excellent example of using n8n to bridge cloud services with custom local computational resources, providing scalable and secure audio generation. Utilizing this n8n template streamlines the entire content production lifecycle.

How it Works

This comprehensive n8n workflow follows a strict sequential process driven by its trigger:


  1. Trigger Activation: The n8n workflow is started either manually via the Start: Manual Test or externally via the Start: External Trigger n8n node, which accepts two Google Drive folder IDs: idreposcript (input) and idrepoaudio (output).

  2. Input Aggregation: The Aggregate Inputs n8n node ensures both required folder IDs are consolidated for subsequent steps.

  3. Script Retrieval: The Get Scripts Google Drive n8n node lists all text files within the input script folder.

  4. Batch Looping: The Loop Scripts n8n node splits the retrieved list into individual items, initiating a loop for processing each file.

  5. Download & Save: Inside the loop, the Download Script n8n node fetches the content of the current text file, and the Save Script n8n node writes this content to a temporary location (/tmp/script.txt).

  6. Voice Generation: The pivotal step is handled by the Generate WAV Execute Command n8n node. This n8n node executes a custom shell command calling the Python script (/scripts/generatevoice.py), passing the input script file and specifying the unique output WAV file name based on the original script name.

  7. Read Output: The Read Audio n8n node reads the newly generated WAV file back into the n8n workflow.

  8. Upload: Finally, the Upload Audio Google Drive n8n node transfers the resulting audio file to the designated idrepo_audio folder, completing the cycle for that script. The n8n workflow then moves to the next script in the batch.

Installation Guide

To deploy this powerful n8n template, follow these steps:


  1. Import: Copy the provided n8n workflow JSON and import it into your n8n instance.

  2. Google Drive Credentials: Set up or select an existing OAuth2 credential for the Google Drive n8n node. This account must have read access to the input script folder and write access to the output audio folder.

  3. Custom Script Setup: This n8n workflow relies heavily on an external dependency. Ensure that a Python environment with the required text-to-speech models (like Bark) is set up, and the generation script (generatevoice.py) is accessible at the path specified in the Generate WAV n8n node (/scripts/generatevoice.py). This typically means mounting the script volume if running n8n in Docker.

  4. Testing: Use the Start: Manual Test path to define test folder IDs in the Test Values n8n node, ensuring the overall n8n workflow executes correctly and interacts with your custom script.

Node Details

Start: External Trigger (n8n trigger): The primary entry point for production use. It accepts dynamic input parameters (folder IDs) necessary for the n8n workflow execution.
Google Drive (Get Scripts): Lists all files in the designated input script folder. This n8n node uses the folder ID passed from the initial trigger.
Split In Batches (Loop Scripts): Manages flow control, ensuring that each script file is processed sequentially, which is crucial for resource-intensive tasks like audio generation.
Google Drive (Download Script): Downloads the binary content of the specific text file within the loop.
Read/Write File (Save Script & Read Audio): These n8n nodes handle temporary local file storage. Save Script writes the text input, and Read Audio reads the generated WAV output.
Execute Command (Generate WAV): The core processing n8n node. It executes a self-hosted Python script to perform the text-to-speech conversion. The command uses expression logic to dynamically name the output file.


  • Google Drive (Upload Audio): The final n8n node in the loop, responsible for securely uploading the resulting audio file to the output repository, completing the objective of the n8n workflow.

Related n8n Workflows

Free

Nodes: 9 Nodes
Updated: December 26 2025
View all
Created by
Flavien
Flavien

Featured*