欢迎光临散文网 会员登陆 & 注册

python文字转语音

2020-04-24 19:37 作者:小垃圾kiki  | 我要投稿
from aip import AipSpeech

""" 你的 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)

python文字转语音的评论 (共 条)

分享到微博请遵守国家法律