<code>from aip import AipSpeech """ 你的 APPID AK SK """ APP_ID = '' API_KEY = '' SECRET_KEY = '' client = AipSpeech(APP_ID, API_KEY, SECRET_KEY) result = client.synthesis('好裝逼,我好優秀', 'zh', 1, { 'vol': 5, 'per': 4 }) # 識別正確返回語音二進制 錯誤則返回dict 參照下面錯誤碼 if not isinstance(result, dict): with open('auido.mp3', 'wb') as f: f.write(result) /<code>
播放
暫停
進入全屏
退出全屏
00:00
00:00
重播請
刷新
試試講一下如何使用python將文字轉為語音
首先需要安裝庫: pip install baidu-aip
https://ai.baidu.com/tech/speech/tts
如何寫:
https://blog.csdn.net/weixin_40943549/article/details/82835548?depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromBaidu-8&utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromBaidu-8