python文字转语音
""" 你的 APPID AK SK """
APP_ID = '19589370'
API_KEY = 'joicUYGfYgTFe8gKt4WLWvoC'
SECRET_KEY = 'oHpZ9k3GIGe7MoNDWsNkrNTEl5MpSDRy'
client = AipSpeech(APP_ID, API_KEY, SECRET_KEY)
result = client.synthesis('好装逼,我好优秀', 'zh', 1, {
'vol': 5, 'per': 4
})
# 识别正确返回语音二进制 错误则返回dict 参照下面错误码
if not isinstance(result, dict):
with open('auido.mp3', 'wb') as f:
f.write(result)