-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmultiVoice.py
43 lines (33 loc) · 1.21 KB
/
multiVoice.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
35
36
37
38
39
40
41
42
43
import apiaudio
apiaudio.api_key = "your_key"
# Let's create a script!
text = """
<<soundSegment::intro>>
<<sectionName::intro>>
Hey! Do you know we support multiple voices from different providers in the same script? My name is Sonia. I am from Microsoft!
<<soundSegment::main>>
<<sectionName::main>>
And my name is Austin! I am a Resemble provided voice. Try me out!
<<soundSegment::outro>>
<<sectionName::outro>>
Nice to meet you! I am Beth and I come from amazon! Try our voices out with your own script
"""
script = apiaudio.Script().create(scriptText=text, scriptName="multiple_speakers")
# Create text to speech !
speech = apiaudio.Speech().create(
scriptId=script["scriptId"],
voice="Linda",
sections={
"intro": {"voice": "Sonia", "speed": 100},
"main": {"voice": "Austin", "speed": 90},
"outro": {"voice": "Beth", "speed": 100},
},
)
# Mastering creation
mastering = apiaudio.Mastering().create(
scriptId=script["scriptId"], soundTemplate="lofi", share=True
)
# Check the response
print('Response from mastering', mastering)
# Listen and share your audio file
print('Listen to your audio here', mastering['shareUrl'])