利用百度API行语音合成 python
1. 登录百度AL开发平台 2. 在控制台选择语音合成 3. 创建应用 4. 填写应用信息 5. 在应用列表获取(Appid、API Key、Secret Key) 6. 安装pythonsdk 安装使用Python SDK有如下方式: 如果已安装pip,执行pip install baidu-aip即可。 如果已安装setuptools,执行python setup.py instal即可。 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): ...