Spaces:
Sleeping
Sleeping
#!/usr/bin/env python3 | |
""" | |
Script to setup original elegant voice styles for TTS. | |
This script provides copyright-safe voice configurations. | |
""" | |
import os | |
import json | |
from pathlib import Path | |
def create_elegant_voice_config(): | |
"""Create configuration for original elegant voice styles.""" | |
config = { | |
"elegant_voice_styles": { | |
"elegant_drama": { | |
"pitch_shift": 5, | |
"speed_factor": 0.88, | |
"formant_shift": 1.15, | |
"reverb": 0.08, | |
"description": "Original elegant and dramatic voice style", | |
"text_enhancements": { | |
"dramatic_pauses": True, | |
"elegant_expressions": True, | |
"enhanced_beauty_terms": True | |
} | |
}, | |
"royal_princess": { | |
"pitch_shift": 6, | |
"speed_factor": 0.85, | |
"formant_shift": 1.25, | |
"reverb": 0.12, | |
"description": "Original royal princess voice style", | |
"text_enhancements": { | |
"royal_expressions": True, | |
"formal_language": True, | |
"graceful_pauses": True | |
} | |
}, | |
"anime_heroine": { | |
"pitch_shift": 5, | |
"speed_factor": 0.92, | |
"formant_shift": 1.18, | |
"reverb": 0.06, | |
"description": "Original anime heroine voice style", | |
"text_enhancements": { | |
"confident_expressions": True, | |
"heroic_tone": True, | |
"inspiring_language": True | |
} | |
} | |
}, | |
"copyright_notice": { | |
"status": "original_content", | |
"description": "All voice styles are original creations", | |
"safe_for_commercial_use": True, | |
"no_character_copying": True | |
} | |
} | |
with open("elegant_voices_config.json", "w") as f: | |
json.dump(config, f, indent=2) | |
print("π Created elegant_voices_config.json with original voice settings") | |
def setup_voice_samples_directory(): | |
"""Setup directory structure for voice samples.""" | |
voice_dir = Path("voice_samples") | |
voice_dir.mkdir(exist_ok=True) | |
# Create subdirectories for different voice styles | |
for style in ["elegant_drama", "royal_princess", "anime_heroine"]: | |
style_dir = voice_dir / style | |
style_dir.mkdir(exist_ok=True) | |
print(f"β Created voice samples directory structure: {voice_dir.absolute()}") | |
def print_usage_guide(): | |
"""Print usage guide for the enhanced TTS service.""" | |
print("π Enhanced Indonesian TTS Service - Original Voice Styles") | |
print("=" * 60) | |
print() | |
print("π Available Voice Styles (Copyright-Safe):") | |
print() | |
print("1. πͺ elegant_drama:") | |
print(" - Elegant and dramatic voice") | |
print(" - Higher pitch (+5 semitones)") | |
print(" - Slower speed (0.88x)") | |
print(" - Light reverb for sophistication") | |
print() | |
print("2. π royal_princess:") | |
print(" - Regal and refined voice") | |
print(" - Very high pitch (+6 semitones)") | |
print(" - Slower, more regal pacing (0.85x)") | |
print(" - Enhanced reverb for grandeur") | |
print() | |
print("3. βοΈ anime_heroine:") | |
print(" - Confident anime-style voice") | |
print(" - High pitch (+5 semitones)") | |
print(" - Moderate speed (0.92x)") | |
print(" - Balanced processing") | |
print() | |
print("π§ Usage Examples:") | |
print() | |
print("curl -X POST 'http://localhost:7860/synthesize' \\") | |
print(" -H 'Content-Type: application/json' \\") | |
print(" -d '{") | |
print(' "text": "Selamat datang di live shopping yang elegan!",') | |
print(' "voice_style": "elegant_drama",') | |
print(' "model_type": "xtts_v2",') | |
print(' "speed": 1.0') | |
print(" }'") | |
print() | |
print("π― Features:") | |
print("β Multiple TTS models (XTTS v2, VITS, Tacotron2)") | |
print("β Original voice styles (no copyright issues)") | |
print("β Enhanced audio processing") | |
print("β Indonesian language optimization") | |
print("β Real-time synthesis") | |
print("β RESTful API") | |
print() | |
print("βοΈ Legal & Copyright:") | |
print("β All voice styles are original creations") | |
print("β Safe for commercial use") | |
print("β No character copying or infringement") | |
print("β Respects intellectual property rights") | |
def create_sample_requests(): | |
"""Create sample request files for testing.""" | |
samples = { | |
"elegant_drama_sample.json": { | |
"text": "Selamat datang semuanya! Hari ini kita akan melihat produk kecantikan yang sangat elegan dan berkualitas tinggi!", | |
"voice_style": "elegant_drama", | |
"model_type": "xtts_v2", | |
"speed": 1.0, | |
"language": "id" | |
}, | |
"royal_princess_sample.json": { | |
"text": "Selamat datang di istana kecantikan kami. Izinkan saya memperkenalkan produk-produk yang sungguh menawan.", | |
"voice_style": "royal_princess", | |
"model_type": "xtts_v2", | |
"speed": 1.0, | |
"language": "id" | |
}, | |
"anime_heroine_sample.json": { | |
"text": "Halo semuanya! Mari kita jelajahi dunia kecantikan bersama-sama! Produk hari ini benar-benar luar biasa!", | |
"voice_style": "anime_heroine", | |
"model_type": "xtts_v2", | |
"speed": 1.0, | |
"language": "id" | |
} | |
} | |
for filename, content in samples.items(): | |
with open(filename, "w") as f: | |
json.dump(content, f, indent=2) | |
print("π Created sample request files for testing") | |
if __name__ == "__main__": | |
print_usage_guide() | |
print() | |
create_elegant_voice_config() | |
setup_voice_samples_directory() | |
create_sample_requests() | |
print() | |
print("π Setup complete! Your enhanced TTS service is ready with original voice styles.") | |
print("π Start the service with: python app.py") |