2023-04-14 16:53:58 +00:00
|
|
|
import sys
|
|
|
|
import importlib.util
|
|
|
|
|
|
|
|
if importlib.util.find_spec("elevenlabs") is None:
|
|
|
|
print("elevenlabs library is not installed, you can install it to your enviroment using 'pip install elevenlabs'")
|
|
|
|
sys.exit()
|
|
|
|
|
2023-05-24 18:11:01 +00:00
|
|
|
from elevenlabs import generate, play, save
|
2023-04-14 16:53:58 +00:00
|
|
|
|
|
|
|
# Get a Voice object, by name or UUID
|
2023-05-24 18:11:01 +00:00
|
|
|
voice = "Arnold" #Possible Voices: Adam Antoni Arnold Bella Domi Elli Josh
|
2023-04-14 16:53:58 +00:00
|
|
|
|
|
|
|
# Generate the TTS
|
2023-05-24 18:11:01 +00:00
|
|
|
audio = generate(
|
|
|
|
text=str(sys.argv[2:]),
|
|
|
|
voice=voice
|
|
|
|
)
|
2023-04-14 16:53:58 +00:00
|
|
|
|
|
|
|
# Save the TTS to a file
|
2023-05-24 18:11:01 +00:00
|
|
|
save(audio, "audio.mp3")
|