Hear Sanskrit spoken by Alpa
Waking Alpa’s voice…
Type your own
Sanskrit in Devanagari, or switch on Latin typing below. Up to 1,000 characters.
ITRANS: A or aa आ I ई U ऊ RRi ऋ e ए ai ऐ T ट t त N ण n न sh श Sh ष kSh क्ष j~n ज्ञ M ं H ः . । .a ऽ Capitals matter, and the final a is typed: rAma राम, rAm राम्.
About Alpa
Alpa (अल्प, “small”) reads Sanskrit aloud, and all of it happens in this page. A small reader written in JavaScript turns your Devanagari into Sanskrit sounds and marks each syllable light or heavy (laghu or guru); a voice model of 4.5 million parameters turns those into speech, running in your browser with ONNX Runtime Web. The 21 MB model file is downloaded from Hugging Face and, where your browser allows, kept for your next visit. Your text is not sent anywhere.
How it was made
Alpa began as tiny-voca, an English voice model by Muhammed Nazeem. Two of its tables, 9,600 of its 4.5 million numbers (0.2%), were rewritten by hand: each Sanskrit sound starts from the nearest English one, and ट ड ण ष, which English lacks, start partly as English “r”, because both curl the tongue back. Then it trained for 100 minutes on a four-core CPU with 3.5 hours of Sanskrit speech from AI4Bharat’s Rasa recordings. No GPU was used.
How well, and how fast
- 3.0%of phonemes misread by a Sanskrit speech recogniser (Su-śrotā) on 148 sentences Alpa never trained on, against 3.3% for the human recordings it learned from. A recogniser is not an ear: one listener has checked a handful of lines.
- 12×faster than real time, or about that, in desktop Chromium on one thread. Alpa has not yet been timed on a real phone; the line under the orb shows how fast it is on yours.
- 18 MBfor the model itself (23 MB in the browser format), 4.5 million parameters, Apache-2.0.
Limits
- An early preview (v0.1.1) with one trained voice, learned from 3.5 hours of speech. The voice can sound flatter than larger systems.
- ण and न are not yet fully distinct to a listener.
- A visarga at the end of a word is sometimes weak.
- It speaks; it does not chant. Vedic accents are not spoken.
- Text is read as written: every written vowel is spoken, including the final a, and sandhi is neither applied nor undone.
- Digits and Latin letters are not spoken. The model takes at most 512 sounds at a time, so longer text is split at daṇḍas.
- Untested: single words on their own, very long compounds, long passages.
The verses
Each verse here was compared letter for letter with its text on Sanskrit Wikisource (the link under each verse goes to the exact page version), and spoken through the model once before it was added. The transliteration is IAST.
Credits
- tiny-voca by Muhammed Nazeem (Apache-2.0): the model design, the training recipe, the browser export and the starting weights.
- Rasa by AI4Bharat (CC-BY-4.0): the recordings Alpa learned from.
- Vāgdhenu and Su-śrotā by Prathosh A P, Indian Institute of Science: Alpa’s pronunciation and scansion rules follow Vāgdhenu’s, and Su-śrotā measured the result.
- Verse texts from Sanskrit Wikisource; transliteration by indic-transliteration.
- ONNX Runtime Web by Microsoft (MIT). Typefaces: Tiro Devanagari Sanskrit by Tiro Typeworks and Inter by Rasmus Andersson (both SIL Open Font License 1.1).
Alpa is an independent project. None of the people or groups above has reviewed or endorsed it.