Metadata-Version: 2.4
Name: kala-tts
Version: 0.1.1
Summary: CPU-native Nepali TTS — real_nepali G2P + VITS ONNX inference
Author-email: Ampixa <hello@ampixa.com>
License: MIT
Project-URL: Homepage, https://tts.ampixa.com/kala/
Project-URL: Repository, https://github.com/voidash/kala-tts
Project-URL: Hugging Face, https://huggingface.co/ampixa/real-nepali-v0.2-kala
Project-URL: Bug Tracker, https://github.com/voidash/kala-tts/issues
Keywords: nepali,tts,text-to-speech,speech-synthesis,g2p,onnx
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
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
License-File: LICENSE
Requires-Dist: numpy>=1.24
Requires-Dist: onnxruntime>=1.17
Requires-Dist: huggingface_hub>=0.23
Provides-Extra: test
Requires-Dist: pytest>=7; extra == "test"
Dynamic: license-file

# kala-tts

CPU-native Nepali text-to-speech. The first open-source Nepali TTS built without eSpeak.

```bash
pip install kala-tts
```

```python
import kala_tts

kala_tts.synthesize_to_file("नमस्कार, कसरी हुनुहुन्छ?", "out.wav")
```

## What makes it different

eSpeak-ng maps Nepali affricates to alveolar labels (`ts`, `tsh`) that do not match
how Kathmandu speakers actually produce **च** and **छ**.  `kala-tts` uses the
`real_nepali` G2P — built from Khatiwada (2009) and a 48 000-entry curated lexicon —
which outputs palatal `ch`/`chh` as the acoustic target.

| Feature | eSpeak `ne` | kala-tts |
|---|---|---|
| च / छ | ts / tsh (alveolar) | ch / chh (palatal) |
| Gemination | often lost | explicit ː tokens |
| Schwa deletion | heuristic | rule-based, audited |
| Latin code-switch | undefined | letter-by-letter + lexicon |
| Lexicon | none | 48 000 entries |

## API

```python
import kala_tts

# Returns WAV bytes (16-bit PCM mono, 22050 Hz)
wav: bytes = kala_tts.synthesize("नेपाल सुन्दर देश हो।", speaker="kala")

# Write directly to file
kala_tts.synthesize_to_file("नमस्कार", "output.wav", speaker="barsha")

# Speed control
wav = kala_tts.synthesize("राम्रो दिन!", speed=0.85)  # slower

# List speakers
print(kala_tts.list_speakers())
# ('kala', 'barsha', 'slr143_F', 'slr43_0546', 'slr43_2099')
```

## CLI

```bash
kala-tts "नमस्कार, कसरी हुनुहुन्छ?" --speaker kala -o out.wav
kala-tts --list-speakers
echo "नेपाल सुन्दर देश हो।" | kala-tts -o out.wav
```

## Speakers

| Name | Data | Notes |
|---|---|---|
| `kala` | human studio | recommended |
| `barsha` | human recording | most data |
| `slr143_F` | OpenSLR-143 | neutral prosody |
| `slr43_0546` | OpenSLR-43 | read speech |
| `slr43_2099` | OpenSLR-43 | read speech |

## Model

The first call auto-downloads the ONNX model (~60 MB) from
[ampixa/real-nepali-v0.2-kala](https://huggingface.co/ampixa/real-nepali-v0.2-kala)
via `huggingface_hub` and caches it locally.  No internet needed after first run.
No GPU required.

- Architecture: VITS (ONNX FP32)
- Sample rate: 22050 Hz
- CPU RTF: ~0.020 (50× real-time on a laptop)

## License

MIT (code) — CC-BY-SA 4.0 (model weights and training data).
See [LICENSES.md](LICENSES.md) for full attribution.
