Metadata-Version: 2.4
Name: cowchant
Version: 0.1.0
Summary: 🐄 Sanskrit chant TTS on the command line — powered by Vāgdhenu
Author-email: Hemanth HM <hemanth.hm@gmail.com>
License-Expression: Apache-2.0
Project-URL: Homepage, https://github.com/hemanth/cowchant
Project-URL: Repository, https://github.com/hemanth/cowchant
Project-URL: Upstream (Vāgdhenu), https://github.com/prathoshap/vagdhenu
Keywords: sanskrit,chant,tts,text-to-speech,vedic,shloka
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Multimedia :: Sound/Audio :: Speech
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: torch>=2.0
Requires-Dist: torchaudio>=2.0
Requires-Dist: torchcodec
Requires-Dist: numpy>=1.24
Requires-Dist: scipy>=1.10
Requires-Dist: soundfile>=0.12
Requires-Dist: huggingface-hub>=0.20
Requires-Dist: indic-transliteration>=2.3
Requires-Dist: bigvgan
Requires-Dist: transformers>=4.40
Requires-Dist: accelerate>=0.30
Requires-Dist: vocos>=0.1
Requires-Dist: x-transformers>=1.31
Requires-Dist: torchdiffeq
Requires-Dist: librosa
Requires-Dist: matplotlib
Requires-Dist: pydub
Requires-Dist: safetensors
Requires-Dist: ema-pytorch>=0.5.2
Requires-Dist: tqdm>=4.65
Requires-Dist: jieba
Requires-Dist: pypinyin
Requires-Dist: cached-path
Requires-Dist: transformers-stream-generator
Requires-Dist: wandb
Requires-Dist: datasets
Requires-Dist: hydra-core>=1.3

# 🐄 cowchant

Sanskrit chant TTS on the command line — powered by [Vāgdhenu](https://github.com/prathoshap/vagdhenu).

Turn Sanskrit verses into traditional metered chant. Paste a śloka, get audio.

> **MOS ~4.6** (expert listener). Handles all Sanskrit conjuncts including retroflex aspirates (ṣṭ, ḍḍh, …) with 100% accuracy.

## Install

```bash
pip install cowchant

# With GPU support (recommended — 10x faster):
pip install cowchant[gpu]

# Full dependencies (includes transformers, accelerate):
pip install cowchant[full]
```

> **Note:** First run downloads ~2GB of model weights from HuggingFace + clones IndicF5 and BigVGAN. Subsequent runs use the cached models.

## Usage

```bash
# Basic — auto-detects meter, outputs to output.wav
cowchant "वसुदेवसुतं देवं कंसचाणूरमर्दनम् ।"

# Specify output file and meter
cowchant "शुक्लाम्बरधरं विष्णुं..." -o vishnu.wav --meter anuṣṭubh

# From file
cowchant --input verse.txt -o chant.wav

# From stdin
echo "गुरुर्ब्रह्मा गुरुर्विष्णुः..." | cowchant -o guru.wav

# List supported meters
cowchant --list-meters

# Force CPU (slower but works without GPU)
cowchant "verse..." --device cpu

# Change seed for a different take
cowchant "verse..." --seed 42
```

## Supported scripts

Works with **any Indian script** — Devanagari, Kannada, Telugu, Malayalam, Bengali, Gujarati, Gurmukhi, Oriya, Grantha. Auto-detected.

## Python API

```python
from cowchant.engine import CowChant

engine = CowChant(device="cuda")

# Save to file
engine.chant("वसुदेवसुतं देवं...", output="chant.wav")

# Get raw audio
sr, audio = engine.chant("शुक्लाम्बरधरं विष्णुं...")

# List meters
print(engine.meters())
```

## Options

| Flag | Default | Description |
|---|---|---|
| `-o, --output` | `output.wav` | Output WAV path |
| `-m, --meter` | auto | Override meter (chandas) |
| `-s, --seed` | `60` | Random seed for variation |
| `-i, --input` | — | Read verse from file |
| `--device` | auto | `cuda` / `mps` / `cpu` |
| `--speed` | `0.90` | Chant speed |
| `--nfe` | `64` | DiT denoising steps |
| `--cfg` | `3.0` | CFG strength |
| `--list-meters` | — | List supported meters |

## How it works

- **Backbone:** IndicF5 / F5-TTS (flow-matching DiT, ~337M params)
- **Vocoder:** NVIDIA BigVGAN-v2, fine-tuned
- **Text frontend:** Devanagari → SLP1 → Kannada routing, visarga sandhi, homorganic anusvāra, meter/gaṇa detection
- **Reference bank:** Per-meter reference audio clips for prosody control

## Performance

| Device | Time per śloka |
|---|---|
| NVIDIA GPU (A100/4090) | ~5 seconds |
| Apple MPS (M1/M2) | ~20 seconds |
| CPU | ~60+ seconds |

## Credits

- **Engine:** [Vāgdhenu](https://github.com/prathoshap/vagdhenu) by Prof. Prathosh, IISc Bengaluru
- **CLI:** [Hemanth HM](https://h3manth.com)
- **License:** Apache-2.0

## Etymology

**Vāgdhenu** = vāk (speech) + dhenu (cow) — "the wish-cow of speech."
**cowchant** = cowsay vibes + the *dhenu* from the project name. 🐄
