百度语音API的申请以及调用

step1:

打开链接https://cloud.baidu.com/product/speech/tts,点击“立即使用”;

step2:

点击创建应用;

step3:

填写基本信息

step4:

安装python SDK

pip3 install baidu-aip

step5:

创建python文件,复制以下代码

#encoding:utf8
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(text = '你好百度', options={'vol':5})

if not isinstance(result,dict):
    with open('audio.mp3','wb') as f:
        f.write(result)
else:print(result)

 

代码参考博客:https://blog.csdn.net/Nicholas_Wong/article/details/80819763

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值