当前位置:主页 > 软件编程 > Python代码 >

Python实现变声器功能(萝莉音御姐音)

时间:2021-05-01 09:32:42 | 栏目:Python代码 | 点击:

登录百度AL开发平台

在控制台选择语音合成

创建应用

填写应用信息

在应用列表获取(Appid、API Key、Secret Key)

6. 安装pythonsdk

安装使用Python SDK有如下方式:

安装使用Python SDK有如下方式:

7. 书写代码

from aip import AipSpeech
​
 """ 你的 APPID AK SK """
 APP_ID = '你的 App ID'
 API_KEY = '你的 Api Key'
 SECRET_KEY = '你的 Secret Key'
​
 client = AipSpeech(APP_ID, API_KEY, SECRET_KEY)
​
 result = client.synthesis('你好百度', 'zh', 1, {
 'vol': 5,
})
​
# 识别正确返回语音二进制 错误则返回dict 参照下面错误码
if not isinstance(result, dict):
 with open('auido.mp3', 'wb') as f:
  f.write(result)

总结

您可能感兴趣的文章:

相关文章