LittleLirow commited on
Commit
a269add
1 Parent(s): 7fab996

Add voice file

Browse files
Files changed (1) hide show
  1. narrator.py +9 -0
narrator.py CHANGED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ from elevenlabslib import *
2
+ import os
3
+
4
+ def text2voice(prompt, path, key, voiceIndex):
5
+ user = ElevenLabsUser(key)
6
+ voice = user.get_available_voices()[voiceIndex]
7
+ audioBytes = voice.generate_audio_bytes(prompt)
8
+ with open(path, "wb") as binary_file:
9
+ binary_file.write(audioBytes)