A powerful Text-to-Speech solution using Microsoft Edge's online TTS engine. It consists of a Python Backend (FastAPI) and a Chrome Extension (Vue 3).
- 🚀 High Quality: Uses Microsoft Edge's natural sounding Neural voices.
- ⚡ Streaming: Low latency audio streaming.
- 🧩 Smart Chunking: Automatically splits long articles into paragraphs.
- 🔁 Preloading: Automatically fetches the next paragraph for smooth playback.
- ⏯️ Controls: Play, Pause, Resume, Stop, Click-to-play, Retry failed chunks.
- ⚙️ Customizable: Adjust speed (-50% to +50%) and switch voices.
- 🔒 Secure: JWT authentication with localhost bypass and persistent secret keys.
- Localhost Bypass: If you are running both the backend and the extension on the same machine (
127.0.0.1), you do not need a JWT token. - Remote Usage: If the backend is on a different server, you must provide the JWT token generated by the server.
- Secret Key & Token Validity:
- The server generates a unique
SECRET_KEYon first run and saves it toconfig/config.env. - This key is used to sign JWT tokens.
- Important: Even though the server prints a new "Admin Token" string in the logs on every restart, previously issued tokens remain valid as long as the
SECRET_KEYinconfig/config.envstays the same. - You only need to update the token in your extension if you delete/change the
config.envfile.
- The server generates a unique
-
Start Backend:
docker compose up -d
Note: A
configdirectory will be created in your current folder containingconfig.envwith the generatedSECRET_KEY. -
Get Token: View logs to find the Admin Token:
docker logs edge-tts-backend
Note: Logs are limited to 20MB with 3 rotations.
- Install Dependencies:
cd backend pip install -r requirements.txt - Start Server:
uvicorn app.main:app --host 0.0.0.0 --port 8000
- Get Token: Copy the Admin Token printed in the terminal.
- Download/Build Extension:
- Users: Download
edge-tts-extension.zipfrom Releases and unzip it. - Developers: Run
npm install && npm run buildin theextensionfolder.
- Users: Download
- Load into Chrome:
- Go to
chrome://extensions/. - Enable Developer mode (top right).
- Click Load unpacked and select the
distfolder (or unzipped folder).
- Go to
- Open Panel: Click the extension icon to open the Side Panel.
- Configure (If needed):
- Click the Settings (⚙️) button.
- Set Backend URL (default is
http://localhost:8000). - Paste the JWT Token (only required if not using
localhost). - Click "Refresh Voice List".
- Start Reading:
- Open any web page and click "Read Page".
- Tip: Select specific text on the page to read only that part.
一个基于微软 Edge 在线语音引擎的强大文本转语音解决方案。包含一个 Python 后端 (FastAPI) 和一个 Chrome 插件 (Vue 3)。
- 🚀 高质量语音: 使用微软 Edge 的自然神经网络语音 (如
zh-CN-XiaoxiaoNeural)。 - ⚡ 流式传输: 极低延迟的音频流式播放。
- 🧩 智能分块: 自动将长文章切分为段落,支持逐段播放。
- 🔁 自动预加载: 播放当前段落时自动下载下一段,实现无缝衔接。
- ⏯️ 播放控制: 支持 播放、暂停、恢复、停止,点击跳转,失败重试。
- ⚙️ 个性化设置: 支持语速调节 (-50% 到 +50%) 和语音切换。
- 🔒 安全保护: 内置 JWT 鉴权机制,支持本地回环免密访问及密钥持久化。
- 本地免密: 如果您的后端和插件运行在同一台机器上(即通过
127.0.0.1访问),您 无需设置 JWT Token 即可直接使用。 - 远程访问: 如果后端部署在远程服务器,必须在插件设置中填入服务器生成的 JWT Token。
- 密钥与 Token 有效期:
- 后端首次运行时会随机生成
SECRET_KEY并保存至config/config.env文件中。 - 重要: 虽然每次重启服务时日志都会打印一个新的 Token 字符串,但只要
config/config.env中的SECRET_KEY保持不变,之前生成的 Token 依然有效。 - 除非您手动删除了
config目录或修改了密钥,否则无需在插件中频繁更新 Token。
- 后端首次运行时会随机生成
-
启动后端:
docker compose up -d
注:项目根目录下会自动生成
config目录,其中config.env文件包含生成的SECRET_KEY。 -
获取 Token: 查看容器日志以获取 Admin Token:
docker logs edge-tts-backend
注:日志文件限制为最大 20MB,保留 3 个历史文件。
- 安装依赖:
cd backend pip install -r requirements.txt - 启动服务:
uvicorn app.main:app --host 0.0.0.0 --port 8000
- 获取 Token: 复制终端中打印出来的 Admin Token。
- 准备插件包:
- 普通用户: 从 Releases 页面下载
edge-tts-extension.zip并解压。 - 开发者: 在
extension目录下运行npm install && npm run build。
- 普通用户: 从 Releases 页面下载
- 加载到 Chrome:
- 打开 Chrome 浏览器,访问
chrome://extensions/。 - 开启右上角的 开发者模式 (Developer mode)。
- 点击 加载已解压的扩展程序 (Load unpacked),选择
dist文件夹(或解压后的文件夹)。
- 打开 Chrome 浏览器,访问
- 打开面板: 点击浏览器工具栏中的插件图标打开侧边栏。
- 配置 (可选):
- 点击右上角的 设置 (⚙️) 按钮。
- 设置 Backend URL (默认为
http://localhost:8000)。 - 粘贴 JWT Token (仅当非本地访问时需要)。
- 点击 "Refresh Voice List" 同步语音列表。
- 开始朗读:
- 打开任意网页,点击 "Read Page" 开始朗读。
- 提示: 如果只想朗读某一段,可以在网页上先选中那段文字。