微软文字转语音(Python)

# 安装模块
$ pip3 install edge-tts

# 查看使用
$ edge-tts
usage: edge-tts [-h] [-t TEXT] [-f FILE] [-v VOICE] [-l] [--rate RATE] [--volume VOLUME] [-O OVERLAPPING]
                [--write-media WRITE_MEDIA] [--write-subtitles WRITE_SUBTITLES] [--proxy PROXY]
edge-tts: error: one of the arguments -t/--text -f/--file -l/--list-voices is required

# 手动断句,效果更好
$ edge-tts --text "网友曝 公司规定不接董事长电话 1次罚1万:奖惩制度都是惩 没有奖!" --write-media 1.mp3 --voice zh-CN-XiaoxiaoNeural --rate=+5%

# 转文件
$ edge-tts -f tex.txt --write-media 1.mp3 --voice zh-CN-XiaoxiaoNeural --rate=+5%
posted @ 2023-03-11 20:52  egu0o  阅读(481)  评论(0编辑  收藏  举报