Downloads · 30 days
0
Hari7718/EdgeSanskrit-TTS
EdgeSanskrit-TTS is a text-to-speech model from Hari7718. Use it when you need text read aloud. The card lists the license as mit.
<div align="center" <h1🕉️ EdgeSanskrit-TTS</h1 <h3The Ultimate Offline Sanskrit Chanting & Text-to-Speech Engine</h3
Downloads · 30 days
0
Access
Public
Updated Jul 9, 2026
Repo size
1.5 GB
Likes
0
Public
Click a slice to open those files.
.safetensors1.4 GB · 94%
From the Hugging Face model README
EdgeSanskrit-TTS is a high-speed, dependency-free Sanskrit Text-to-Speech (TTS) engine designed to run efficiently on the edge (CPUs, local machines, and low-resource environments).
It achieves faster-than-real-time CPU inference while delivering high-quality Sanskrit pronunciation, bypassing complex OS-level dependencies (like espeak-ng) and solving the classic Hindi schwa-deletion issue (pronouncing Rama as Ram).
IndicF5 and Vocos) are bundled natively in the HuggingFace Model Repo. Clone it and run it completely offline.्).ः) are echoed with the preceding vowel (e.g., नमः $\rightarrow$ namaha, श्रीपतिः $\rightarrow$ śrīpatihi).ं) are resolved to their matching varga nasal consonant depending on the following letter (Velar $\rightarrow$ ŋ, Palatal $\rightarrow$ ɲ, Retroflex $\rightarrow$ ɳ, Dental $\rightarrow$ n, Labial $\rightarrow$ m).This repository contains everything (code + gigabytes of AI model weights). Because GitHub blocks files over 100MB, the full offline package is hosted on HuggingFace.
(Ensure you have Git LFS installed)
# Downloads ~1.5GB of code and models
git clone https://huggingface.co/Hari7718/EdgeSanskrit-TTS
cd EdgeSanskrit-TTS
# Install IndicF5 directly from the AI4Bharat repository fork
pip install "git+https://github.com/ai4bharat/IndicF5.git@13f7c4d627cc10111aea8fe9c0039462cacacdc7"
# Install other requirements
pip install -r requirements.txt
Start the beautiful local web server:
uvicorn app:app --host 127.0.0.1 --port 8000 --reload
Open your browser to http://127.0.0.1:8000 to access the UI!
If you prefer the command line, you can generate audio directly using the provided python scripts.
python generate_sanskrit_v2.py "धर्मक्षेत्रे कुरुक्षेत्रे समवेता युयुत्सवः" --meter anushtubh --output chant.wav
Want to type in English? Add your OpenRouter API key to .env (OPENROUTER_API_KEY=sk-or-...) and run:
python generate_from_english.py --text "The warrior stands on the battlefield of Kurukshetra" --output dramatic_chant.wav
EdgeSanskrit utilizes a state-of-the-art Flow-Matching Diffusion Transformer (DiT).
graph TD
A[English Input] -->|OpenRouter Auto-Translate| B(Devanagari Sanskrit)
A2[Devanagari Input] --> B
B --> C(Sanskrit Phonemizer & Sandhi Engine)
C -->|Visarga Echo| D[echo: ha, hi, hu...]
C -->|Anusvara Sandhi| E[nasal: ŋ, ɲ, ɳ, n, m]
C -->|Inherents| F[Retain short 'a' vowel]
D & E & F --> G(Kannada Script Routing)
G --> H(IndicF5 Flow-Matching DiT)
H -->|Bundled Offline Weights| I[Vocos Vocoder]
I --> J[Concatenate & Stitch Audio Chunks]
J --> K[24kHz Authentic Audio Output]
| Feature | Standard Hindi TTS | EdgeSanskrit (IndicF5) |
|---|---|---|
| Parameters | 82M | 337M |
| Voice source | Conversational Hindi | Real Sanskrit chanting (Prof. Prathosh, IISc) |
| Prosody & Tone | Flat / Conversational | Zero-shot cloning of swara, pace & timbre |
| Schwa Deletion | ❌ Yes (Cuts words short) | ✅ No (Authentic pronunciations) |
| Text Routing | Devanagari → IPA | Devanagari → Kannada |
The key insight: the "authentic Indian touch" comes from the reference audio, not just the model. The reference WAVs in our bundled bank are recordings of an actual Sanskrit chanter. IndicF5 clones the voice timbre, pitch contour (swara), and chanting rhythm from those 5-12 second clips for any new verse.
Sanskrit is completely phonetic. The phonemizer maps Devanagari characters using the following rules:
| Devanagari | Dependent Sign | IPA Translation |
|---|---|---|
| अ | - | a |
| आ | ा | aː |
| इ | ि | i |
| ई | ी | iː |
| उ | ु | u |
| ऊ | ू | uː |
| ऋ | ृ | ɾɪ |
| ए | े | e |
| ऐ | ै | aɪ |
| ओ | ो | o |
| औ | ौ | aʊ |
| ऽ | - | ː (Length Mark) |
| Varga | Unvoiced (Unasp / Asp) | Voiced (Unasp / Asp) | Nasal |
|---|---|---|---|
| Velar | क (k), ख (kʰ) | ग (ɡ), घ (ɡʰ) | ङ (ŋ) |
| Palatal | च (tʃ), छ (tʃʰ) | ज (dʒ), झ (dʒʰ) | ञ (ɲ) |
| Retroflex | ट (ʈ), ठ (ʈʰ) | ड (ɖ), ढ (ɖʰ) | ण (ɳ) |
| Dental | त (t), थ (tʰ) | द (d), ध (dʰ) | न (n) |
| Labial | प (p), फ (pʰ) | ब (b), भ (bʰ) | म (m) |
j), र (r), ल (l), व (v)ʃ), ष (ʂ), स (s), ह (h)Tested using Bhagavad Gita Verse 1.1 (Anushtubh Meter):
धर्मक्षेत्रे कुरुक्षेत्रे समवेता युयुत्सवः । मामकाः पाण्डवाश्चैव किमकुर्वत संजय ॥
EdgeSanskrit stands on the shoulders of these incredible open-source projects:
Built with ❤️ for Sanskrit, Vedas, and Open Source AI.