|
小弟用python去调百度的语音合成(TTS),百度返回的是音频的流数据,我想把这些流数据保存成mp3或者wav的格式,代码是这样:但是保存好的mp3 wav是无效的,求大神指教
try:
req = urllib2.Request(wavUrl)
res_data = urllib2.urlopen(req)
en = res_data.read()
except urllib2.HTTPError as http_error:
print http_error
with open("code2.mp3", "wb") as code:
code.write(unquote(en))
print "done"
|
|