-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVoice.py
34 lines (28 loc) · 868 Bytes
/
Voice.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
from elevenlabslib import ElevenLabsUser
from elevenlabslib.helpers import *
e11Voice = None
e11Voices = None
def VoiceSetup(key: str) -> bool:
global e11Voice, e11Voices
e11Voice = ElevenLabsUser(key)
# Get the voices from ElevenLabs (replace with your own voices)
e11Voices = {
"DuckyJr":e11Voice.get_voices_by_name("DuckyJR2")[0],
"Cortana":e11Voice.get_voices_by_name("Cortana")[0],
"Matt":e11Voice.get_voices_by_name("Matt")[0],
}
e11Voice = e11Voices["Matt"] # set default voice
return True
def VoiceChange(voice: str) -> bool:
global e11Voice
if e11Voices is None:
return False
else:
e11Voice = e11Voices[voice]
return True
def VoiceList() -> list:
global e11Voices
if e11Voices is None:
return []
else:
return list(e11Voices.keys())