简单的脚本代码:
from aip import AipSpeech """ 你的 APPID AK SK """ APP_ID = ‘16050762‘ API_KEY = ‘145BqyxaQru2CFwuRjmPMdYp‘ SECRET_KEY = ‘SP4KWZ4eGT65bXYx2UvW0Fj7QvwMIrW1‘ client = AipSpeech(APP_ID, API_KEY, SECRET_KEY) result=client.synthesis(‘请绑定客户端后再使用‘,‘zh‘,1,{ ‘vol‘:5, ‘spd‘:3, ‘pit‘:5, ‘per‘:4 }) print(result) if not isinstance(result,dict): with open(‘audio.mp3‘,‘wb‘)as f: f.write(result) # # 读取文件 # def get_file_content(filePath): # with open(filePath, ‘rb‘) as fp: # return fp.read() # # # 识别本地文件 # client.asr(get_file_content(‘audio.pcm‘), ‘pcm‘, 16000, { # ‘dev_pid‘: 1536, # }) # print(client)
原文:https://www.cnblogs.com/wen-kang/p/10831923.html