-
Notifications
You must be signed in to change notification settings - Fork 3
/
aryana.py
executable file
·46 lines (37 loc) · 967 Bytes
/
aryana.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
44
45
46
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Feb 8 16:29:02 2021
@author: mahsa
"""
import json
import requests as req
def aryana(text):
body = {
"Text": text,
"Speaker": "Female1",
"PitchLevel": "4",
"PunctuationLevel": "2",
"SpeechSpeedLevel": "5",
"ToneLevel": "10",
"GainLevel": "3",
"BeginningSilence": "0",
"EndingSilence": "0",
"Format": "wav16",
"Base64Encode": "0",
"Quality": "normal",
"APIKey": "0IYTIY5JNLOU8ON"
}
header = {"Content-type": "application/json"}
r = req.post("http://api.farsireader.com/ArianaCloudService/ReadText",
headers=header, data=json.dumps(body), timeout=10)
return r
if __name__ == '__main__':
"""
START
"""
text = ""
resp = aryana(text)
file = "path/to/wav/file.wav"
with open(file, mode='bx') as f:
f.write(resp.content)