Signpost AI Logo
WorkersTools

TTS

📸 Screenshots

Here are visual examples of this section:

Tts - Worker Configuration Interface Tts - Worker Configuration Interface

1. Overview and Purpose

The Tts Worker is designed to convert text into speech using either Google's Text-to-Speech API or OpenAI's TTS API. You can choose which engine to use via the configuration parameters.

  • Google TTS: Detects the language of the input text, fetches available voices, and selects the best voice for the detected language. If no voice is available for the detected language, it falls back to English.
  • OpenAI TTS: Uses OpenAI's high-quality text-to-speech API with natural-sounding voices.

2. Configuration Parameters

The Tts Worker supports the following configuration parameter:

  • Engine: Choose between "Google" (default) or "OpenAI" for text-to-speech conversion

3. Input/Output Handles

The Tts Worker has two NodeIO fields: input and output. The input field accepts the text to be converted into speech, while the output field returns the speech data.

4. Usage Examples with Code

const ttsWorker = new TTSWorker();
const text = "Hello, world!";
ttsWorker.fields.input.write(text);
await ttsWorker.run();
const speech = ttsWorker.fields.output.read();

5. Integration Examples

The Tts Worker can be integrated into any application that requires text-to-speech functionality. For example, it can be used in an e-learning platform to read out course content to users, or in a customer service chatbot to provide voice responses.

6. Best Practices

  • For Google TTS: Ensure that the input text is in a language supported by Google's Text-to-Speech API. The engine will automatically detect the language and select an appropriate voice.
  • For OpenAI TTS: Ensure you have a valid OpenAI API key configured. OpenAI TTS supports multiple languages and provides high-quality natural-sounding voices.
  • Handle any errors that may occur during the text-to-speech conversion process, such as network errors or API errors.
  • Choose the engine based on your needs:
    • Use Google TTS if you need automatic language detection and a wide variety of voices
    • Use OpenAI TTS if you prefer OpenAI's natural-sounding voices and have an OpenAI API key

7. Troubleshooting Tips

  • If the text-to-speech conversion fails, check the error message for details. It may be due to:
    • Missing or invalid API keys (Google API key for Google TTS, OpenAI API key for OpenAI TTS)
    • Network connectivity issues
    • Unsupported language (for Google TTS)
    • API rate limits or quota exceeded
  • If using Google TTS and the detected language is not what you expected, check the input text for any errors or inconsistencies in language use.
  • Ensure your API keys are properly configured in the Settings > API Keys section before using the TTS worker.