Spaces:
Paused
Paused
A newer version of the Gradio SDK is available: 6.13.0
Hindi Emotional TTS - Quick Start Guide
✅ What's Been Fixed
Your Hindi emotional TTS system was not working because:
- Root Cause: Hindi (Devanagari script) was incorrectly processed by Chinese text normalizer
- Solution: Added automatic Devanagari detection and transliteration to phoneme-friendly format
- Result: Hindi text now works with ALL emotion control modes!
🚀 Installation
Step 1: Install Missing Dependency
pip install indic-transliteration
Or install all requirements:
pip install -r requirements.txt
Step 2: Verify Installation (Optional)
python install_hindi_support.py
This will check your setup and verify Hindi support is working.
📝 Usage
Method 1: Web UI (Easiest)
python webui.py
Then just paste Hindi text in the input box! The system will automatically:
- ✓ Detect Devanagari script
- ✓ Convert to phonemes
- ✓ Apply emotions
- ✓ Generate speech
Method 2: Python Script
from indextts.infer_v2 import IndexTTS2
# Initialize model
tts = IndexTTS2(
cfg_path="checkpoints/config.yaml",
model_dir="checkpoints",
use_fp16=False
)
# Basic Hindi TTS
tts.infer(
spk_audio_prompt="examples/voice_01.wav",
text="नमस्ते, मैं आपकी सहायता के लिए यहाँ हूँ",
output_path="output_hindi.wav"
)
# Hindi with Happy Emotion
tts.infer(
spk_audio_prompt="examples/voice_01.wav",
text="मैं आज बहुत खुश हूँ",
output_path="output_hindi_happy.wav",
emo_vector=[1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] # Happy
)
# Hindi with Sad Emotion
tts.infer(
spk_audio_prompt="examples/voice_01.wav",
text="यह बहुत दुखद है",
output_path="output_hindi_sad.wav",
emo_vector=[0.0, 0.0, 0.8, 0.0, 0.0, 0.0, 0.0, 0.0] # Sad
)
🎭 Emotion Vectors
Hindi now supports all 8 emotions:
# Format: [happy, angry, sad, afraid, disgusted, melancholic, surprised, calm]
emo_vector=[1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] # 😊 Happy
emo_vector=[0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] # 😠 Angry
emo_vector=[0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0] # 😢 Sad
emo_vector=[0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0] # 😨 Afraid
emo_vector=[0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0] # 🤢 Disgusted
emo_vector=[0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0] # 😔 Melancholic
emo_vector=[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0] # 😲 Surprised
emo_vector=[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0] # 😌 Calm
📚 Example Test Cases
Simple Greetings
"नमस्ते" # Hello
"शुभ प्रभात" # Good morning
"धन्यवाद" # Thank you
Emotional Phrases
"मैं बहुत खुश हूँ" # I am very happy (use happy vector)
"मुझे गुस्सा आ रहा है" # I am angry (use angry vector)
"यह बहुत दुखद है" # This is very sad (use sad vector)
"आश्चर्यजनक!" # Amazing! (use surprised vector)
Long Text
"भारत एक महान देश है। यहाँ की संस्कृति और परंपरा बहुत समृद्ध है।"
# India is a great country. Its culture and tradition are very rich.
🧪 Testing
Quick Test (Basic Functionality)
python test_hindi_tts.py
Full Test (Requires Model)
python test_hindi_inference.py
🔧 Troubleshooting
Issue: "Warning: indic-transliteration not installed"
pip install indic-transliteration
Issue: Hindi produces gibberish
Check if Devanagari detection is working:
from indextts.utils.front import TextNormalizer
normalizer = TextNormalizer()
print(normalizer.is_devanagari("नमस्ते")) # Should be True
Issue: Poor quality output
Try reducing emotion strength:
tts.infer(
text="आपका हिंदी टेक्स्ट",
emo_vector=[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.8], # Calm, 80% strength
emo_alpha=0.7
)
📖 More Information
- Full Documentation: See
HINDI_SUPPORT.md - Technical Details: See
CHANGES_SUMMARY.md - Installation Help: Run
python install_hindi_support.py
🎯 Summary of Changes
What Changed:
- ✅ Added Devanagari script detection
- ✅ Added Hindi → Phoneme transliteration
- ✅ Fixed text processing pipeline
- ✅ Enabled emotion control for Hindi
- ✅ Added comprehensive testing
What Now Works:
- ✓ Hindi text input (Devanagari script)
- ✓ Emotion vectors (all 8 emotions)
- ✓ Emotion reference audio
- ✓ Emotion text mode (experimental)
- ✓ Mixed Hindi-English text
- ✓ Long Hindi text synthesis
- ✓ Sanskrit, Marathi, Nepali (via Devanagari)
🎊 You're Ready!
Hindi emotional TTS is now fully functional. Just:
- Install dependency:
pip install indic-transliteration - Run web UI:
python webui.py - Type Hindi text and select emotion
- Generate speech! 🎉
Need Help? Check HINDI_SUPPORT.md for detailed documentation and troubleshooting.