The Multilingual Text-to-Speech Converter is a web-based application that allows users to input text and convert it into speech in various languages. This project integrates Google's Cloud Text-to-Speech API and Translation API to deliver high-quality speech synthesis in multiple languages. Users can enter text, choose their preferred language, and listen to the generated speech directly in their browser.
This application is built using Flask, a lightweight Python web framework, and leverages HTML5's audio capabilities for seamless playback of the synthesized speech. The project is designed to be user-friendly, enabling real-time speech synthesis without the need for file downloads.
- Multilingual Support: Convert text to speech in various languages including English, Spanish, French, German, and more.
- Real-time Speech Playback: Listen to the synthesized speech directly in the browser using an HTML5 audio player.
- Google Cloud Integration: Utilizes Google's Text-to-Speech and Translation APIs for accurate language processing and high-quality speech synthesis.
- Simple Web Interface: A clean and straightforward user interface for easy text input and language selection.
- Flask: A lightweight WSGI web application framework for Python.
- Google Cloud Text-to-Speech API: Provides speech synthesis capabilities.
- Google Cloud Translation API: Allows for text translation into different languages.
- HTML5 Audio: Enables in-browser audio playback.
- Python 3.8+
- Google Cloud SDK (for authentication and API access)
- A Google Cloud Project with Text-to-Speech and Translation APIs enabled
git clone https://github.com/your-username/multilingual-text-to-speech.git
cd multilingual-text-to-speech
python -m venv venv
For Windows:
venv\Scripts\activate
For macOS/Linux:
source venv/bin/activate
pip install -r requirements.txt
Create a service account in your Google Cloud Console and download the JSON key file.
Set the environment variable to authenticate with Google Cloud services:
GOOGLE_APPLICATION_CREDENTIALS=path_to_your_service_account_file.json
Or, on macOS/Linux:
export GOOGLE_APPLICATION_CREDENTIALS="path_to_your_service_account_file.json"
python app.py
Visit http://127.0.0.1:5000/ in your browser to use the application.
Enter the text you want to convert to speech. Select the desired language from the dropdown menu. Click "Convert to Speech". The synthesized speech will play directly in the audio player below the form. Contributing Contributions are welcome! Please feel free to submit a Pull Request or open an issue for any bugs or feature requests.
Google Cloud Platform for providing the Text-to-Speech and Translation APIs. Flask for the simple and powerful web framework. The open-source community for their contributions and support.