TTS icon

TTS

Convert text to speech using EdgeTTS

Overview

This node converts input text into speech audio using the EdgeTTS library, which leverages Microsoft's Edge text-to-speech capabilities. It supports selecting from a wide range of voices, adjusting pitch, rate, and volume of the speech output. The node is useful for automating voice generation for applications like voice assistants, accessibility tools, or content narration.

Use Case Examples

  1. Convert a text message into an MP3 audio file with a specific voice for use in a voice assistant.
  2. Generate spoken audio from text content for accessibility in an app.
  3. Create audio narration from text for video or presentation content.

Properties

Name Meaning
Text The text string to be converted into speech audio.
Voice The voice model to use for speech synthesis, selected from a large list of supported voices representing different languages and accents.
Pitch Adjusts the pitch of the synthesized speech, specified as a percentage string (e.g., '0%').
Rate Adjusts the speaking rate of the synthesized speech, specified as a percentage string (e.g., '0%').
Volume Adjusts the volume of the synthesized speech, specified as a percentage string (e.g., '0%').

Output

Binary

Outputs the generated speech audio as an MP3 file in binary format.

JSON

  • filename - The generated audio file name with a timestamp and random suffix.

Dependencies

  • Uses the EdgeTTS library for text-to-speech conversion.
  • Requires a temporary file system path to store the generated MP3 before encoding to base64.
  • Uses system 'base64' command to encode the audio file.

Troubleshooting

  • Ensure the system has the 'base64' command available, as it is used to encode the audio file to base64 format.
  • Temporary file creation and deletion permissions must be granted for the /tmp directory or equivalent.
  • If the node fails, check the error message for issues related to voice selection or text input validity.
  • The node throws a NodeOperationError on failure unless 'Continue On Fail' is enabled, in which case it returns the error message in the output JSON.

Discussion