写程序很多时候是重复工作,听音乐没细胞,那就听听书洗洗脑子吧
阅读 app 听书很方便,但是我喜欢带着电脑上的头戴式耳机,所以想在电脑上听书
- 需要结合 阅读 app
- 可以免费用
微软晓晓听书 - 阅读进度与手机同步
👍 现在也支持阅读本地 txt 文件,并自动记录阅读进度,中断以后继续朗读而不重头开始
如果你在使用 python3 下面的很容易
只需配置一次
-
这里下载并安装
heartale*.whl非 linux 系统可能需要设置播放程序,安装ffmpeg即可,看最后详细说明
-
测试是否修改成功
终端输入
echo "配置成功!" > /tmp/test.txt && heartale
如果听到 "test,配置成功",说明没问题
默认 txt,设置中
"server": { "key": "txt", ... }修改本地配置 ~/.config/bpy/config.json,其中的
"txt":{ "path_file": "/tmp/test.txt" }中的 /tmp/test.txt 改为 你的书籍文件所在路径
-
打开
阅读app的 web 服务手机与电脑同一个
局域网,然后打开 阅读 app,设置中点开Web服务,注意那个 ip 地址(:后面是端口) -
修改本地配置文件
~/.config/bpy/config.json其中
"ip": "192.168.1.6", "port": "1122"
里面的
192.168.1.6改成刚才你看到的ip,端口1122一般不用改 -
修改如下内容中的
txt为legado"server": { "key": "txt", ... }
终端运行
heartale配置文件路径
~/.config/bpy/config.json完整配置文件,如果修改错误,可以这里找到原始文件,还原
{ "version": 1, "server": { "key": "txt", "legado": { "ip": "192.168.1.6", "port": "1122" }, "txt": { "path_file": "/tmp/test.txt" } }, "tts": { "play": { "code": ["paplay"] }, "download": { "key": "edge", "edge": { "voice": "zh-CN-XiaoxiaoNeural", "rate": "+30%" }, "azure": { "key": "", "region": "japanwest", "language": "zh-CN", "voice": "zh-CN-XiaoxiaoNeural", "rate": "+30%" } } } }默认针对 linux,使用 paplay,资源消耗极小
"tts": { "play": { "code": [ "paplay" ] }, ... }可以用 ffmpeg
"tts": { "play": { "code": ["ffplay", "-nodisp", "-autoexit", "-loglevel", "quiet"] }, ... }也可以用 mpv
"tts": { "play": { "code": ["mpv"] }, ... }-
tts-edge
免费,不用设置密钥,但是音色少
{ # 支持的语言和音色:edge-tts --list-voices "voice": "zh-CN-XiaoxiaoNeural", # 语速 "rate": "+30%" }推荐的音色:
- XiaoxiaoNeural
-
azure
学生有免费额度,必须申请并设置密钥 🔑,音色更多
{ # 密钥必须设置 "key": "你自己的密钥xxxxx", # 区域与你申请密钥选择的区域有关 "region": "你申请的区域比如:japanwest", # 看这里多语言、语音选择:https://learn.microsoft.com/zh-cn/azure/ai-services/speech-service/language-support?tabs=tts "language": "zh-CN", "voice": "zh-CN-XiaoxiaoNeural", # 语速 "rate": "+30%" }推荐的音色:
- XiaoxiaoNeural
- XiaochenNeural
- XiaochenMultilingualNeural
- XiaoshuangNeural
- XiaoyouNeural
请保证严格遵守 pylint (至少python3.8)
pylint $(git ls-files '*.py')- 大概会做 ui
- 大概会做朗读本地 pdf、txt(已支持) 等格式文本