File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change 14
14
access_token = "_jYCQn1dqmJTlTtWEXivEmoWvQBFyAuS"
15
15
cluster = "volcano_tts"
16
16
17
- voice_type = "zh_male_yangguangqingnian_moon_bigtts "
17
+ voice_type = "BV700_streaming "
18
18
host = "openspeech.bytedance.com"
19
19
api_url = f"https://{ host } /api/v1/tts"
20
20
31
31
},
32
32
"audio" : {
33
33
"voice_type" : voice_type ,
34
- "encoding" : "pcm " ,
34
+ "encoding" : "wav " ,
35
35
"speed_ratio" : 1.0 ,
36
36
"volume_ratio" : 1.0 ,
37
37
"pitch_ratio" : 1.0 ,
38
+ "rate" :16000
38
39
},
39
40
"request" : {
40
41
"reqid" : str (uuid .uuid4 ()),
50
51
if __name__ == '__main__' :
51
52
try :
52
53
resp = requests .post (api_url , json .dumps (request_json ), headers = header )
53
- print (f"resp body: \n { resp .json ()["addition" ]["duration" ]} " )
54
+ #print(f"resp body: \n{resp.json()["addition"]["duration"]}")
55
+ print (f"resp body: \n { resp .json ()} " )
54
56
if "data" in resp .json ():
55
57
data = resp .json ()["data" ]
56
- file_to_save = open ("test_submit.mp3 " , "wb" )
58
+ file_to_save = open ("test_submit.opus " , "wb" )
57
59
file_to_save .write (base64 .b64decode (data ))
58
60
except Exception as e :
59
61
e .with_traceback ()
You can’t perform that action at this time.
0 commit comments