A full-stack, web-based real-time Text-to-Speech (TTS) application built using open-source and freely available models.
The platform enables expressive, multilingual voice generation with real-time audio playback through a modern web interface.
This system is designed strictly for voice generation and experimentation.
Evaluation, scoring, sentiment analysis, or decision-making based on generated speech is intentionally out of scope.
Python | React | Docker | MongoDB
To build a real-time voice AI platform that demonstrates the capabilities of open-source text-to-speech systems without relying on paid or proprietary APIs.
The application aims to:
- Generate natural-sounding speech in real time
- Support multilingual and expressive voice output
- Allow control over emotion, pitch, and speed
- Run locally and in containers using Docker
- Remain fully open-source and vendor-independent
- Real-time text-to-speech generation
- Browser-based audio playback
- Emotion and speaking style control
- Pitch and speech speed adjustment
- Multilingual voice generation
- Optional voice cloning using short voice samples
- One-click voice generation
- Responsive interface for desktop and mobile devices
- Low-latency audio streaming
- Open-source TTS models
- REST-based frontend–backend communication
- Dockerized local deployment
- Cloud-hosted live demo
- Modular and extensible architecture
- No user profiling or behavioral analysis
- No scoring, ranking, or evaluation logic
- No sentiment or emotion detection
- Controlled file uploads for voice samples
- Secure API communication
- Configuration managed through environment variables
The application includes built-in content safety checks to prevent misuse of the voice generation system and to promote responsible AI usage.
- If the input text contains sensitive, abusive, or restricted language, the system does not generate voice output.
- If a user uploads or records audio containing sensitive or restricted speech, voice generation is blocked.
- Manually spoken input is validated before being processed by the system.
- Voice generation is skipped immediately when restricted content is detected.
- A user-facing popup message is displayed:
Input contains sensitive language
-
The request is safely rejected without being processed by the TTS engine.
-
No audio files are generated, streamed, or stored for restricted requests.
-
These safeguards are implemented to:
-
Ensure responsible and ethical use of voice AI
-
Prevent generation of harmful, abusive, or inappropriate speech
-
Enable safe public demonstrations and deployments of the system
- Voice quality evaluation or scoring
- Emotion or sentiment analysis
- User ranking or recommendations
- Hiring, selection, or decision-making logic
- Paid or proprietary text-to-speech APIs
- Built using React and TypeScript
- Provides user interface for text input and voice controls
- Handles real-time audio playback in the browser
- Python Flask application
- Handles text-to-speech requests
- Streams generated audio back to the frontend
- Open-source and freely available TTS models
- Runs locally without external API dependency
- Docker and Docker Compose for containerized execution
- Supports both local development and cloud deployment
- React
- TypeScript
- Vite
- HTML5 and CSS3
- Web Audio API
- ESLint
- Python
- Flask
- RESTful APIs
- Open-source TTS models
- Real-time audio generation and streaming
- Docker
- Docker Compose
- Node.js and npm
- Environment variables using
.env - Git and GitHub
opensource-voice-ai/
│
├── backend/
│ ├── app.py # Main API entry
│ ├── requirements.txt
│ │
│ ├── routes/
│ │ ├── __init__.py
│ │ ├── tts.py # TTS endpoint (core logic)
│ │ ├── translate.py # Translation logic
│ │ └── history.py # MongoDB history
│ │
│ └── __pycache__/
│
├── frontend/
│ ├── index.html
│ ├── vite.config.ts
│ ├── package.json
│ │
│ ├── public/
│ │
│ ├── src/
│ │ ├── main.tsx
│ │ ├── App.tsx
│ │ ├── App.css
│ │ ├── index.css
│ │
│ │ ├── components/
│ │ │ └── AudioVisualizer.tsx
│ │ │
│ │ ├── services/
│ │ │ └── ttsService.ts # API calls only
│ │ │
│ │ ├── assets/
│ │ └── types.ts
│
├── docker-compose.yml
├── Dockerfile
├── .env
├── README.md
└── .gitignore
-
Text input
-
Language or linguistic persona selection
-
Emotion or speaking style
-
Pitch control
-
Speed control
-
Optional voice sample (recorded or uploaded)
- Real-time streaming audio playback
- Downloadable audio file
- Displayed latency statistics
- User opens the web application.
- Clicks Get Started on the landing page.
- Enters text to be converted into speech.
- Selects language or linguistic persona.
- Chooses emotion or speaking style.
- Adjusts pitch and speech speed.
- Optionally records or uploads a voice sample.
- Clicks Generate Voice.
- Audio is synthesized and played in real time in the browser.
Live Web Application:
https://opensource-voice-ai.onrender.com/
This project can be run locally using deployed application or manual setup (recommended for full-stack testing)
- Python 3.12+
- Node.js 22+
- npm
- Docker and Docker Compose
- Modern web browser (Chrome, Firefox, Edge, Safari)
This option allows you to directly use the application without any local setup.
Live Application URL: https://opensource-voice-ai.onrender.com/
git clone https://github.com/Greeshmitha2702/opensource-voice-ai.git- Open a terminal and navigate to opensource-voice-ai:
cd opensource-voice-ai- Open a terminal and navigate to the backend folder:
cd backend- Install Python dependencies:
pip install -r requirements.txt- Start the backend server:
python -m uvicorn app:app --reload- Backend will be available at:
http://127.0.0.1:8000- Keep this terminal running.
- Open a new terminal and navigate to the frontend folder:
cd frontend- Install frontend dependencies (first time only):
npm install- Start the frontend development server:
npm run dev- Frontend will be available at:
http://localhost:5173/Docker provides a fully containerized setup that runs both the frontend and backend together, ensuring consistent behavior across environments.
-
Docker
-
Docker Compose
From the project root directory run:
docker compose up --build -dThis command:
Builds Docker images for both frontend and backend
Starts all services in detached mode
Automatically connects frontend and backend
To execute backend tests inside the running container:
docker exec -it voiceai-backend python backend/run_tests.py -v -sThis will:
Run all backend test cases
Display detailed logs and debug output in the terminal
Once the containers are running, the application will be accessible in your browser.
-
Frontend and backend services run inside Docker containers
-
Backend logs show successful API calls (e.g., /api/tts)
-
Text-to-Speech requests return 200 OK
-
Application works consistently across systems
-
Backend API: http://127.0.0.1:8000
-
Frontend UI: http://localhost:5173/
-
Docker setup ensures correct and complete full-stack output.
Endpoint:
POST /api/tts
Generates real-time text-to-speech audio based on the provided text and voice configuration.
Request Body (JSON):
text(string) – Input text to be converted into speechvoice(string) – Voice persona (e.g., "Karthik")emotion(string) – Speaking style or emotion (e.g., "Neutral", "Cheerful")speed(number) – Speech speed multiplier (e.g.,1.0)pitch(number) – Pitch adjustment value
Response:
- Audio stream (
audio/mpeg) returned as synthesized speech
Endpoint:
GET /api/history
Fetches the most recent voice synthesis history entries.
Response (JSON):
history– Array of history objects (see schema below)
Endpoint:
POST /api/history
Stores metadata related to a generated or uploaded voice sample.
Audio files themselves are not stored in the database.
Request Type:
multipart/form-data
Form Fields:
file– Recorded or uploaded audio filetext(string) – Input text or optional transcriptionvoice(string) – Voice personaemotion(string) – Emotion or style labelpitch(number) – Pitch valuespeed(number) – Speed value
Response (JSON):
{
"status": "ok"
}Voice History Collection (MongoDB)
Only metadata is stored in the database. Audio files are handled separately.
Each document follows the structure below:
"_id": "ObjectId",
"text": "string",
"voice": "string",
"emotion": "string",
"pitch": "number",
"speed": "number",
"timestamp": "ISODate"
}
-
text – Input text or transcription label
-
voice – Selected voice persona
-
emotion – Emotion or speaking style
-
pitch – Pitch adjustment value
-
speed – Speech speed multiplier
-
timestamp – Time of creation
- Short and medium-length text inputs generate speech with low latency
- Emotion, pitch, and speed controls are reflected accurately in output audio
- Multilingual text inputs work correctly for supported languages
- Browser-based audio playback works without additional plugins
- Dockerized setup provides consistent behavior across environments
- Very long text inputs may increase processing time and latency
- Large TTS models may cause memory issues on low-resource systems
- First request after backend inactivity may experience cold-start delay
- Voice cloning quality depends on clarity and duration of sample audio
- High concurrent requests may reduce real-time performance
- Network interruptions can affect audio streaming
- Chunk-based processing for long text inputs
- Model optimization for faster inference and lower memory usage
- Improved concurrency handling for multiple users
- Enhanced error handling and user feedback
- Expanded language and voice persona support
- Optional offline-only mode
- Audio caching for repeated requests
- User authentication for personalized voice history
Contributions are welcome.
You may:
- Submit pull requests for improvements or new features
- Open issues to report bugs or suggest enhancements
Please ensure contributions follow the existing project structure and coding standards.
- Afreen Dudekula
- Bingumala Lakshmi Greeshmitha
This project is licensed under the MIT License.
See the LICENSE file for complete details.
- Open-source Text-to-Speech research community
- Flask framework and community
- React and Vite ecosystem
- Web Audio API
- Docker and open-source container tooling