Skip to content
Projects

About

Vāgdhenu — metered Sanskrit/Vedic chant text-to-speech (DiT + BigVGAN). Apache-2.0.

AI & Machine Learning

How these counts are measured

Measured star growth

in 24h
+1
in 7 days
+4
in 15 days
+17
in 1 month
Collecting history

Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.

README.md

Original

Vāgdhenu — Sanskrit Chant TTS

"The wish-cow of speech." A production-grade, single-speaker Sanskrit chant (pārāyaṇa) text-to-speech system — it chants classical ślokas with metrically-aware durations and tradition-faithful melodic contour, not flat read-aloud.

MOS ~4.6 (expert listener). Conjuncts — including retroflex aspirates (ṣṭ, ḍḍh, …) — render 100% correctly, the class earlier architectures could not crack. Used to produce MBTN (32 YouTube videos, 17h 34m) and the Śrīmad Bhāgavatam (16,017 verses, audio app + 31 karaoke videos).

[ Project page + live demo · Model weights → HF · Demo → HF Space · Tech report → docs/TECH_REPORT.md ]

Demos (rendered with this system)

Developed and maintained by Prof. Prathosh, Indian Institute of Science, Bengaluru.

How it works

  • Backbone: IndicF5 / F5-TTS — a flow-matching DiT (OT-CFM mel-infilling, ~337M params, no native duration or pitch head). Sanskrit is routed through Kannada script (Devanagari triggers Hindi schwa-deletion).
  • Vocoder: NVIDIA BigVGAN-v2, fine-tuned on F5 vocos-mel (mandatory — vocos shivers on long vowels).
  • Prosody: F5's content fidelity is bulletproof but its prosody is text-driven, not designable. The working levers are the reference clip (voice + swara + pace, via the half-reference rule) and a voice-steering fine-tune. (See docs/TECH_REPORT.md §14 for the full account — this is the central architectural finding.)
  • Text frontend (src/prep_text.py) — the most reusable piece: Deva→SLP1→Kannada routing, internal visarga sandhi (utva/rutva/lopa/satva), homorganic anusvāra, vocalic-ṝ handling, daṇḍa-final rules, meter/gaṇa (L/G) detection.

Layout

src/         text frontend, meter detection, inference, post-gate, reference bank
pipeline/    data-prep (cut→pair→train) + build/assemble/QC
demo/        Gradio app (HF ZeroGPU)
docs/        scrubbed technical report + frontend/pipeline references
examples/    sample inputs + rendered outputs
scripts/     env setup + weight download

Install & quickstart

Requires Python 3.10 and a CUDA 12.1 GPU (or Apple silicon: see below).

bash scripts/setup.sh    # torch+cu121, deps, BigVGAN, and downloads weights -> models/
# render a Devanagari verse (+ meter) to a chanted wav:
python src/render.py --shard examples/sample_shard.json --results /tmp/res.json --outdir out
# -> out/sample_anushtubh.wav

Apple silicon (MLX, no CUDA)

An MLX backend (src/vagdhenu_mlx/) runs the same DiT + BigVGAN pipeline natively on Apple GPUs — no torch at runtime. Same text front end, reference bank, post-gate and locked parameters (nfe 64 · cfg 3.0 · speed 0.90).

bash scripts/setup_mlx.sh     # mlx deps, weights -> models/, one-off conversion to models/mlx (safetensors)
python src/render_mlx.py --text "वसुदेवसुतं देवं कंसचाणूरमर्दनम् । देवकीपरमानन्दं कृष्णं वन्दे जगद्गुरुम् ॥" --out out.wav
python src/render_mlx.py --shard examples/sample_shard.json --outdir out

On an M5 Max a verse renders at RTF ≈ 0.3 (≈ 2.8 s for a 9.7 s anuṣṭubh, ~3.8 GB peak memory); the pāda(s) of a verse are sampled as one batch, the DiT runs in bfloat16 and BigVGAN's anti-aliased activations are a fused Metal kernel. The port is verified against the torch reference (tools/parity_mlx.py): on MLX's exact CPU path every stage matches to ~1e-5; on the GPU the difference is the hardware's reduced-precision fp32 matmul (~1e-3). Unit tests: pytest tests/. Use it from Python with from vagdhenu_mlx import Renderer (same render_one() API as render_core.Renderer), or run the Gradio demo on it with VAGDHENU_BACKEND=mlx VAGDHENU_MLX_MODEL=models/mlx python demo/server.py.

The batch renderer takes a shard JSON: [{"id","meter","padas":[devanagari…],"seed","out"}]. For one-off single-verse renders see src/render_production.py. CHAMP_ROOT env overrides the weights dir (default models/).

Case studies

  • MBTN (Mahābhārata Tātparya Nirṇaya) — 32-adhyāya video deliverable (Devanagari + Kannada karaoke, tanpura), shipped.
  • Śrīmad Bhāgavatam — 12 skandhas, ~18k verses, audio app + a 31-video 3-script (Devanāgarī · Kannada · IAST) karaoke series. Sanskrit text gratefully acknowledged to Poornaprajna Samshodhana Mandiram, Bengaluru.

Attribution & licenses

  • Code: Apache-2.0 (LICENSE).
  • Built on AI4Bharat IndicF5 (MIT), NVIDIA BigVGAN-v2, and F5-TTS — see their licenses; weights redistributed per those terms.
  • Model weights + intended-use/ethics note: see the HF model card.

Ethics / intended use

Single-speaker synthesis of sacred Sanskrit recitation, for pārāyaṇa/study/accessibility. The voice is the author's own. Please use responsibly; do not impersonate.

Citation

(BibTeX added with the arXiv report.)

Explore related projects

Loading…