利用百度AI 合成语音 1

# 文字合成语音
# -*- coding: UTF-8 -*-

from aip import AipSpeech
from playsound import playsound
 
""" 你的 APPID AK SK """
APP_ID = '20232679'
API_KEY = 'bZcWdBZFNlYNja63Iuc6jdXK'
SECRET_KEY = 'W0DEXQBHt0E3iFVpHHvkttOEN129c1eF'
 
client = AipSpeech(APP_ID, API_KEY, SECRET_KEY)
 
result = client.synthesis("你好超哥,我是百度", 'zh', 1, {'vol': 15, 'spd': 5, 'pit': 5, 'per': 0})
 
if not isinstance(result, dict):
    with open('hello.mp3', 'wb') as f:
        f.write(result)
 
playsound('hello.mp3')


你可能感兴趣的:(利用百度AI 合成语音 1)