Realistic Voice Cloning and TTS using Zyphra Zonos API - n8n Workflow

Automate realistic voice cloning using this advanced n8n workflow. Integrate the Zyphra Zonos API for text-to-speech generation, local file handling, and robust error response management using custom n8n nodes.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

Developers and engineers building custom text-to-speech (TTS) solutions.
Content creators requiring dynamic, voice-cloned narration.
Users seeking ready-to-use n8n templates for advanced AI/audio generation tasks.
Technical users needing reliable local file handling within an n8n automation.

Overview

Integrating complex voice cloning APIs requires meticulous handling of file formats, encoding, and parameters. This specialized n8n workflow provides a complete solution for leveraging the Zyphra Zonos text-to-speech API. By starting with an external webhook, the workflow accepts input text, a local path to a voice sample, and granular control over speech emotion and rate. It addresses a core technical challengeโ€”converting the local binary file into the necessary base64 format required by the APIโ€”using a dedicated n8n node. This ensures that anyone deploying this n8n workflow can reliably perform voice cloning, complete with built-in error handling for file access and API connection issues, offering a superior and predictable automation experience compared to manual scripting.

How it Works

This automation is initiated by an incoming HTTP POST request to a defined n8n trigger endpoint /voice-clone.


  1. Trigger & Parameter Setup: The Webhook Trigger receives the POST request, which contains the text to be spoken, the path to the sample voice file (samplevoicepath), and various optional parameters like emotion levels and speakingrate. The Set Clone Parameters n8n node then standardizes and sets all necessary parameters, applying defaults where input is missing.

  2. File Input and Encoding: The Read Sample Voice n8n node attempts to access the local voice sample specified. If successful, the audio binary data is passed to the Base64 convertor (a Code n8n node), which encodes the audio into a base64 string, preparing it for the API payload.

  3. Validation: The Check File Loaded If n8n node validates the existence of the binary data. If the file cannot be read, the flow branches immediately to the File Error Response.

  4. API Call: If the file is valid, the Call Zyphra Clone API n8n node sends a complex JSON body, including the base64-encoded audio and all text/emotion parameters, to the Zyphra endpoint. This request requires a configured API key.

  5. Output & Error Management: The API call has two paths. On successful response (containing the generated audio binary data), the workflow proceeds to Save Cloned Audio. If the API fails, the flow branches to the API Error Response n8n node.

  6. Saving and Responding: The Save Cloned Audio n8n node writes the generated audio to the specified local outputpath. Finally, either the successful result payload or one of the detailed error payloads (File Error or API Error) is passed to the Webhook Response n8n node, completing the execution of this robust n8n workflow.

Installation Guide

To deploy and utilize this powerful n8n workflow, follow these steps:


  1. Import: Copy the entire provided JSON data and import it into your n8n instance via the Workflows tab -> New -> Import From JSON.

  2. Activate Webhook: Once imported, activate the Webhook Trigger node. Note down the unique URL provided by n8n.

  3. Configure API Key: Open the Call Zyphra Clone API HTTP Request n8n node. Under Header Parameters, locate the X-API-Key field. Replace the placeholder value (put-your-API-key-here) with your actual Zyphra API key.

  4. Local File Access: Ensure your n8n host has the necessary read/write permissions for the paths specified in your webhook input (samplevoicepath and output_path). Since this n8n workflow deals with local files, this is crucial for the Read Sample Voice and Save Cloned Audio n8n node operations.

  5. Test: Use a tool like Postman to send a POST request containing the required parameters to your new n8n trigger URL, testing both successful cloning and error paths.

Node Details

Webhook Trigger (n8n trigger): Starts the n8n workflow upon receiving a POST request at the /voice-clone endpoint.
Set Clone Parameters (Set n8n node): Extracts and standardizes input parameters (text, emotion levels, file paths) from the webhook payload, ensuring all variables needed later are available.
Read Sample Voice (Read/Write File n8n node): Reads the source audio file from the local filesystem path provided by the user. Configured to continue on error to allow for explicit error reporting.
Base64 convertor (Code n8n node): A custom n8n node that converts the binary audio data read from the local file into a Base64 string required by the Zyphra API payload.
Check File Loaded (If n8n node): Validates if the Read Sample Voice n8n node successfully loaded binary data, branching the n8n workflow to handle missing file errors.
Call Zyphra Clone API (HTTP Request n8n node): The central function, sending the JSON payload (including text, emotions, and Base64 voice sample) to the Zyphra API to generate the cloned voice. Requires custom header authentication.
Save Cloned Audio (Read/Write File n8n node): Writes the binary audio response received from the Zyphra API to a local file, dynamically naming it with a timestamp.
Error Responses (Set n8n nodes): File Error Response and API Error Response nodes create structured JSON messages detailing the cause of failure, which is returned by the final n8n trigger response.


  • Webhook Response (Respond to Webhook n8n node): Sends the final success or detailed error JSON payload back to the external caller who initiated the n8n workflow.

Related n8n Workflows

Free

Nodes: 8 Nodes
Updated: December 26 2025
View all
Created by
Tiartyos
Tiartyos

๐ŸŽฎ Gaming // ๐Ÿ’ป Coding // ๐ŸŽจ Creating Pro-AI ๐Ÿค– | Open Source ๐ŸŒŸ | ๐ŸงŸโ€โ™‚๏ธ Horror junkie | ๐Ÿœ Anime lover Turning caffeine into questionable code since 2017 โ˜•

Featured*