fearflixai / narrator.py
LittleLirow's picture
Add voice file
a269add
raw
history blame
300 Bytes
from elevenlabslib import *
import os
def text2voice(prompt, path, key, voiceIndex):
user = ElevenLabsUser(key)
voice = user.get_available_voices()[voiceIndex]
audioBytes = voice.generate_audio_bytes(prompt)
with open(path, "wb") as binary_file:
binary_file.write(audioBytes)