TeToS: A Unified Text-to-Speech Interface
TeToS is a versatile and efficient tool designed to unify multiple Text-to-Speech (TTS) providers under one interface. This open-source project is geared towards making the integration of different TTS services seamless, enabling users to switch between various providers with minimal effort.
Supported TTS Providers
TeToS supports a wide range of TTS providers, each with specific requirements:
- Edge-TTS: A straightforward TTS solution requiring no additional keys or configurations.
- OpenAI TTS: Requires an OpenAI API key to authenticate and access their TTS services.
- Azure TTS: Needs a speech key and region, provided by Microsoft’s Azure Speech service.
- Google TTS: Enabled through the Google Cloud Console, this provider requires setting an environment variable pointing to a service account key file.
- Volcengine TTS (火山引擎): Requires an access key, secret key, and app key to access the service.
- Baidu TTS: Users must have an API key and secret key, obtainable from Baidu's console.
- Minimax TTS: Needs an API key and group ID. These can be acquired from the Minimax console.
- 迅飞 TTS: Requires an app ID, API key, and API secret to function.
- Fish Audio: Needs an API key for access.
Installation
TeToS is compatible with Python 3.8 and above. To install, simply run the following command:
pip install tetos
Command-Line Interface (CLI) Usage
TeToS provides a straightforward command-line interface for executing TTS tasks. The basic syntax is:
tetos PROVIDER [PROVIDER_OPTIONS] TEXT [--output FILE]
For a comprehensive list of providers and options, the tetos --help
command can be executed.
Example Commands
- Convert text to speech using Google TTS:
tetos google "Hello, world!"
- Using Azure TTS and saving output to a file:
tetos azure "Hello, world!" --output output.mp3
- Edge-TTS with specified language:
tetos edge --lang zh-CN "你好,世界!"
- OpenAI TTS with specified voice:
tetos openai --voice echo "Hello, world!"
API Usage
Developers can also leverage TeToS’s API for more customized integrations. For example, using Azure TTS can be as simple as:
from tetos.azure import AzureSpeaker
speaker = AzureSpeaker(speech_key='...', speech_region='...')
speaker.say('Hello, world!', 'output.mp3')
Different providers may require different initialization parameters.
Proxy Support
TeToS respects environment variables for proxies such as HTTP_PROXY
, HTTPS_PROXY
, ALL_PROXY
, and NO_PROXY
, making it adaptable for various network configurations.
Future Enhancements
While TeToS already supports several leading TTS providers, it continues to evolve. Current enhancements in the pipeline include:
- Completed support for Google TTS.
- Upcoming support for SSML (Speech Synthesis Markup Language).
License
TeToS is licensed under the Apache License 2.0, ensuring it remains free for both personal and commercial use.