diff --git a/daras_ai_v2/text_to_speech_settings_widgets.py b/daras_ai_v2/text_to_speech_settings_widgets.py index 869069517..5a73db7f1 100644 --- a/daras_ai_v2/text_to_speech_settings_widgets.py +++ b/daras_ai_v2/text_to_speech_settings_widgets.py @@ -27,13 +27,47 @@ class TextToSpeechProviders(Enum): ELEVEN_LABS = "ElevenLabs" -# Mapping from Eleven Labs Voice ID -> Title in UI +# Mapping from Eleven Labs Voice Name -> Voice ID ELEVEN_LABS_VOICES = { - "syN7Wt0nfLXAqq9LI9R6": "Indian Man With A Deep Voice", - "99XLBDkANYZ0Ww7MKN8d": "[aaa] Ramakrishnan - INDIAN TEACHER. CEREBRAL AND THOUGHTFUL PRONUNCIATION 🔥", - "TSh1KthMgVjY3BfYFkwS": "[ElevenVoices] Riya - Indian Female Young Adult", - "dvRCseVM0rT31i8clSVy": "Wise Grandma slow, seductive, pleasant, mature", - "prqKmUi0Zo7WBmA81Vy4": "[ElevenVoices] Rahul - Indian Male Young Adult", + "Rachel": "21m00Tcm4TlvDq8ikWAM", + "Clyde": "2EiwWnXFnvU5JabPnv8n", + "Domi": "AZnzlk1XvdvUeBnXmlld", + "Dave": "CYw3kZ02Hs0563khs1Fj", + "Fin": "D38z5RcWu1voky8WS1ja", + "Bella": "EXAVITQu4vr4xnSDxMaL", + "Antoni": "ErXwobaYiN019PkySvjV", + "Thomas": "GBv7mTt0atIp3Br8iCZE", + "Charlie": "IKne3meq5aSn9XLyUdCD", + "Emily": "LcfcDJNUP1GQjkzn1xUU", + "Elli": "MF3mGyEYCl7XYWbV9V6O", + "Callum": "N2lVS1w4EtoT3dr4eOWO", + "Patrick": "ODq5zmih8GrVes37Dizd", + "Harry": "SOYHLrjzK2X1ezoPC6cr", + "Liam": "TX3LPaxmHKxFdv7VOQHJ", + "Dorothy": "ThT5KcBeYPX3keUQqHPh", + "Josh": "TxGEqnHWrfWFTfGW9XjX", + "Arnold": "VR6AewLTigWG4xSOukaG", + "Charlotte": "XB0fDUnXU5powFXDhCwa", + "Matilda": "XrExE9yKIg1WjnnlVkGX", + "Matthew": "Yko7PKHZNXotIFUBG7I9", + "James": "ZQe5CZNOzWyzPSCn5a3c", + "Joseph": "Zlb1dXrM653N07WRdFW3", + "Jeremy": "bVMeCyTHy58xNoL34h3p", + "Michael": "flq6f7yk4E4fJM5XTYuZ", + "Ethan": "g5CIjZEefAph4nQFvHAz", + "Gigi": "jBpfuIE2acCO8z3wKNLl", + "Freya": "jsCqWAovK2LkecY7zXl4", + "Grace": "oWAxZDx7w5VEj9dCyTzz", + "Daniel": "onwK4e9ZLuTAKqWW03F9", + "Serena": "pMsXgVXv3BLzUgSXRplE", + "Adam": "pNInz6obpgDQGcFmaJgB", + "Nicole": "piTKgcLEGmPE4e6mEKli", + "Jessie": "t0jbNlBVZ17f02VDIeMI", + "Ryan": "wViXBPUzp2ZZixB1xQuM", + "Sam": "yoZ06aMxZJJ28mfd3POQ", + "Glinda": "z9fAnlkpzviPz146aGWa", + "Giovanni": "zcAOhNBS3c14rBihAFp1", + "Mimi": "zrHiDhphv9ZnVXBqCLjz", } # Mapping from Model ID -> Title in UI @@ -165,7 +199,7 @@ def text_to_speech_settings(): ###### Voice name (ElevenLabs) """, key="elevenlabs_voice_name", - format_func=ELEVEN_LABS_VOICES.__getitem__, + format_func=str, options=ELEVEN_LABS_VOICES.keys(), ) diff --git a/recipes/TextToSpeech.py b/recipes/TextToSpeech.py index fc97ad36e..ae534a3e1 100644 --- a/recipes/TextToSpeech.py +++ b/recipes/TextToSpeech.py @@ -42,7 +42,7 @@ class TextToSpeechPage(BasePage): "google_speaking_rate": 1.0, "uberduck_voice_name": "Aiden Botha", "uberduck_speaking_rate": 1.0, - "elevenlabs_voice_name": "syN7Wt0nfLXAqq9LI9R6", + "elevenlabs_voice_name": "Rachel", "elevenlabs_model": "eleven_multilingual_v2", "elevenlabs_stability": 0.5, "elevenlabs_similarity_boost": 0.75, @@ -251,19 +251,20 @@ def run(self, state: dict): ) case TextToSpeechProviders.ELEVEN_LABS: - # default to first voice ID in the mapping - default_voice_id = next(iter(ELEVEN_LABS_VOICES)) - - # default to first model ID in the mapping + # default to first in the mapping default_voice_model = next(iter(ELEVEN_LABS_MODELS)) + default_voice_name = next(iter(ELEVEN_LABS_VOICES)) - voice_id = state.get("elevenlabs_voice_name", default_voice_id) voice_model = state.get("elevenlabs_model", default_voice_model) + voice_name = state.get("elevenlabs_voice_name", default_voice_name) - if voice_id not in ELEVEN_LABS_VOICES: - raise ValueError(f"Invalid voice_name: {voice_id}") + # validate voice_model / voice_name if voice_model not in ELEVEN_LABS_MODELS: raise ValueError(f"Invalid model: {voice_model}") + if voice_name not in ELEVEN_LABS_VOICES: + raise ValueError(f"Invalid voice_name: {voice_name}") + else: + voice_id = ELEVEN_LABS_VOICES[voice_name] stability = state.get("elevenlabs_stability", 0.5) similarity_boost = state.get("elevenlabs_similarity_boost", 0.75)