# Muryar Hausa — Hausa Text-to-Speech
A Flask + htmx web app that converts Hausa text into speech using two backends:
- **gTTS** — Google Translate's TTS API (`lang='ha'`). Fast, needs internet, no setup cost.
- **MMS-TTS** (`facebook/mms-tts-hau`) — Meta's neural VITS model fine-tuned for Hausa.
More natural-sounding, runs locally/offline once downloaded, but heavier (needs `torch`).
## Features
- Single-sentence synthesis with a live progress bar
- **Batch mode**: paste up to 25 lines, each becomes its own audio clip, with a real
per-item progress bar streamed over Server-Sent Events, plus a "download all as .zip" button
- Session-based history panel with replay/download
- Per-IP rate limiting (in-memory, no Redis needed)
- Automatic cleanup of generated audio files older than `AUDIO_MAX_AGE_MINUTES`
- Dark theme with a subtle CSS-only Islamic geometric pattern background
## Project structure
```
hausa-tts/
├── app.py # Flask routes, rate limiter, cleanup thread, batch/SSE
├── tts_engine.py # gTTS + HF MMS-TTS wrapper
├── requirements.txt # full deps (includes torch/transformers for MMS-TTS)
├── requirements-render.txt # lean deps for constrained hosts (gTTS only)
├── Procfile # gunicorn start command
├── render.yaml # Render blueprint (one-click deploy config)
├── templates/
│ ├── base.html
│ ├── index.html
│ ├── _result.html # htmx partial for single synthesis result
│ ├── _batch_result.html # initial batch container (opens SSE connection)
│ ├── _batch_progress.html # SSE-streamed progress fragment
│ ├── _history.html
│ └── _error.html
└── static/
├── css/style.css
└── audio/ # generated mp3/wav/zip files land here
```
## Local setup
```bash
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install -r requirements.txt
python app.py
```
Then open `
localhost`.
### First run with MMS …