@memef1f1y/dsh-plugin-tts 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/.github/workflows/test.yml +33 -0
  2. package/ANALYSIS.md +205 -0
  3. package/LICENSE +21 -0
  4. package/PR-REVIEW.md +75 -0
  5. package/README.md +297 -0
  6. package/README.zh.md +263 -0
  7. package/Snipaste_2026-08-16_13-28-10.png +0 -0
  8. package/Snipaste_2026-08-16_13-28-23.png +0 -0
  9. package/Snipaste_2026-08-16_13-28-37.png +0 -0
  10. package/Snipaste_2026-08-16_13-29-01.png +0 -0
  11. package/Snipaste_2026-08-16_13-29-11.png +0 -0
  12. package/TODO.md +23 -0
  13. package/cordis.patch.yml +4 -0
  14. package/docs/CLOUD-GUIDE.md +216 -0
  15. package/docs/COSYVOICE-GUIDE.md +216 -0
  16. package/docs/EDGE-GUIDE.md +166 -0
  17. package/docs/HOST-CONTRACT.md +36 -0
  18. package/docs/INDEX-TTS2-GUIDE.md +208 -0
  19. package/docs/RVC-GUIDE.md +390 -0
  20. package/docs/USER-GUIDE.md +334 -0
  21. package/docs/acceptance-checklist.md +148 -0
  22. package/docs/adaptive-chunked-playback.md +194 -0
  23. package/docs/macos-test-prompt.md +230 -0
  24. package/docs/windows-gpu-verify-prompt.md +151 -0
  25. package/lib/client.js +7036 -0
  26. package/lib/index.mjs +3288 -0
  27. package/logo.png +0 -0
  28. package/package.json +52 -0
  29. package/pnpm-workspace.yaml +7 -0
  30. package/rvc-server.py +564 -0
  31. package/tests/README.md +45 -0
  32. package/tests/client-load.mjs +393 -0
  33. package/tests/e2e-compact-index.mjs +86 -0
  34. package/tests/e2e-index-ab.mjs +138 -0
  35. package/tests/e2e-real-rvc.mjs +122 -0
  36. package/tests/i18n-keys.mjs +82 -0
  37. package/tests/mock-registry.mjs +50 -0
  38. package/tests/package-runtime-patch.mjs +88 -0
  39. package/tests/rvc-server-live.mjs +230 -0
  40. package/tests/smoke.mjs +1107 -0
  41. package/tools/gen-ui-preview.mjs +174 -0
  42. package/tools/mac-verify.sh +158 -0
  43. package/tools/make-pack.mjs +155 -0
  44. package/tools/package-runtime.py +214 -0
@@ -0,0 +1,390 @@
1
+ # RVC 自定义音色指南(Custom Voice / RVC Guide)
2
+
3
+ > dsh-plugin-tts 的 RVC 能力专册。RVC 部分上手门槛较高,故从主 README 抽出单独成册。
4
+ > 主 README:[中文](../README.zh.md) / [English](../README.md) · 使用手册:[《执行手册》](USER-GUIDE.md)
5
+
6
+ **目录**
7
+ - [RVC 是什么](#rvc-是什么)
8
+ - [开始前准备](#开始前准备)
9
+ - [启动本地 RVC 服务](#启动本地-rvc-服务)
10
+ - [设置面板 RVC 配置](#设置面板-rvc-配置)
11
+ - [长文本渐进播放(自适应分块)](#长文本渐进播放自适应分块)
12
+ - [紧凑索引(压缩 .index)](#紧凑索引压缩-index)
13
+ - [音色包(注册表 + 下载)](#音色包注册表--下载)
14
+ - [便携运行时(免装 RVC WebUI)](#便携运行时免装-rvc-webui)
15
+ - [设置项详解](#设置项详解)
16
+ - [实测延迟](#实测延迟)
17
+ - [RVC 疑难排查](#rvc-疑难排查)
18
+ - [版权提示](#版权提示)
19
+ - [English](#english)
20
+
21
+ ---
22
+
23
+ <a name="rvc-是什么"></a>
24
+ ## RVC 是什么
25
+
26
+ RVC(Retrieval-based-Voice-Conversion)是**声音转换**,不是 TTS:输入音频长度 = 输出音频长度。
27
+ 所以"用自定义音色朗读"的链路是:
28
+
29
+ ```
30
+ Edge TTS 朗读(原声)→ 本机 RVC 推理服务(rvc-server.py)→ 转换后的 wav → 播放
31
+ ```
32
+
33
+ 全程在你自己的 GPU/CPU 上完成,你的音色模型不会上传到任何地方。
34
+
35
+ ---
36
+
37
+ <a name="开始前准备"></a>
38
+ ## 开始前准备
39
+
40
+ | 需要 | 是什么 | 必须吗 |
41
+ |---|---|---|
42
+ | RVC 模型文件(`.pth`) | 你的音色本体(几 MB ~ 几十 MB) | ✅ 必须 |
43
+ | 索引文件(`.index`) | 让音色更像原声的辅助文件 | ❌ 可选(留空 = 免索引) |
44
+ | RVC WebUI 安装 或 便携运行时 | 转换服务跑在它里面 | ✅ 二选一(见下) |
45
+
46
+ > 没有 RVC WebUI?用**便携运行时**([见下文](#便携运行时免装-rvc-webui)):免安装文件夹,双击即用。
47
+
48
+ ---
49
+
50
+ <a name="启动本地-rvc-服务"></a>
51
+ ## 启动本地 RVC 服务
52
+
53
+ 先选你的操作系统。**不需要指定模型/索引**——模型在设置面板里点「浏览」选择,首次朗读自动加载;
54
+ `--model/--index` 只是可选的预载参数。启动成功的样子统一是:
55
+ 终端/命令行窗口出现 `dsh-plugin-tts RVC server: http://127.0.0.1:4892 ...`,然后**这个窗口别关**。
56
+
57
+ ### Windows(已装 RVC WebUI)
58
+
59
+ 打开 PowerShell / 命令提示符:
60
+
61
+ - **推荐**:把 `rvc-server.py` 复制到 RVC 根目录(与 `runtime/` 同级),然后:
62
+
63
+ ```powershell
64
+ <你的RVC目录>\runtime\python.exe <你的RVC目录>\rvc-server.py --port 4892
65
+ ```
66
+
67
+ - 或者 rvc-server.py 放在别处时,用 `--rvc-dir` 指定 RVC 根目录:
68
+
69
+ ```powershell
70
+ <你的RVC目录>\runtime\python.exe <rvc-server.py的路径> --rvc-dir "<你的RVC目录>" --port 4892
71
+ ```
72
+
73
+ ### macOS
74
+
75
+ - **最省事:便携运行时**([见下文](#便携运行时免装-rvc-webui))。解压后运行:
76
+
77
+ ```bash
78
+ <你的便携包目录>/start-rvc-server.sh
79
+ ```
80
+
81
+ - **已有自己搭好的 RVC 环境**(例如按本仓库 `docs/macos-test-prompt.md` 搭建的目录):
82
+
83
+ ```bash
84
+ <你的工作目录>/venv/bin/python <你的工作目录>/rvc-server.py --port 4892
85
+ ```
86
+
87
+ - **已有 RVC WebUI 目录**(含 `runtime/` 与 `infer/`):
88
+
89
+ ```bash
90
+ <你的RVC目录>/runtime/bin/python <你的RVC目录>/rvc-server.py --port 4892
91
+ ```
92
+
93
+ > ⚠️ 在 macOS 上第一次使用前,请先确认推理依赖已装好。最稳妥的方式是按下文
94
+ > 「便携运行时」或 `docs/macos-test-prompt.md` 的清单准备 Python 3.9 环境;
95
+ > 常见的缺失(`ModuleNotFoundError: No module named 'parselmouth'`)只要
96
+ > `pip install praat-parselmouth av torchcrepe` 等即可补上。
97
+
98
+ ### Linux
99
+
100
+ ```bash
101
+ <你的RVC目录>/runtime/bin/python <你的RVC目录>/rvc-server.py --port 4892
102
+ ```
103
+
104
+ ### 通用说明
105
+
106
+ - `<你的RVC目录>` = RVC WebUI 根目录(含 `runtime`/`assets`/`logs`);`<rvc-server.py的路径>` = rvc-server.py
107
+ 文件所在位置(插件源码目录,或从 GitHub 仓库 `1624318455/dsh-plugin-tts` 下载,**不在** node_modules 里);
108
+ - 想要"启动即预载某个音色"再额外加(路径分隔符按系统使用 `/` 或 `\`):
109
+ `--model "<RVC目录>/assets/weights/xxx.pth" --index "<RVC目录>/logs/xxx.index"`;
110
+ - 换模型:直接在设置面板「浏览」里选(无需重启服务);提示端口被占用(Windows `[Errno 10048]` /
111
+ macOS/Linux `Address already in use`)= 端口被占用,先关旧的再启动。
112
+
113
+ `rvc-server.py` API:`GET /health`(含 `gpu_name` / `vram_gb`)、`POST /load {model,index}`、
114
+ `POST /convert {audio_base64,params}`(JSON+base64,无额外依赖)、`GET /files?kind=pth|index`(本机模型/索引发现)、
115
+ `POST /compact-index {index, target_vectors}`(紧凑索引生成)。
116
+ 自动使用环境内 `ffmpeg.exe` 解码 mp3 原声;设备自动选 `cuda:0`(NVIDIA)或 `cpu`(可 `--device` 指定);
117
+ 转换时**缓存 faiss 索引对象**(按路径),分块模式每块不再重读大索引文件,`/load` 时清空缓存。
118
+
119
+ ---
120
+
121
+ <a name="设置面板-rvc-配置"></a>
122
+ ## 设置面板 RVC 配置
123
+
124
+ 打开 **设置 → 插件 → 语音**:
125
+
126
+ - **TTS提供者** 选「**自定义音色(RVC)**」;
127
+ - **服务地址**:保持默认 `http://127.0.0.1:4892`(刚才那个服务的地址);
128
+ - **原声音色**:转换前的朗读音色(Edge TTS 按消息文本自动合成),决定语气与停顿;
129
+ - **模型路径 (.pth)**:你的音色模型,用「浏览」选或直接粘贴路径;
130
+ - **索引路径 (.index)**:可留空(免索引);「浏览」选 .index;「压缩索引」把大索引缩小;
131
+ - **高级参数**(折叠,一般不用改):见[设置项详解](#设置项详解)。
132
+
133
+ ---
134
+
135
+ <a name="长文本渐进播放自适应分块"></a>
136
+ ## 长文本渐进播放(自适应分块)
137
+
138
+ RVC 是变声,长文本必须先合成整段原声再转换;"全部转换完再播放"会让长回复等待几十秒。
139
+ 本插件改为**自适应分块渐进播放**:
140
+
141
+ 1. 首次长文本 RVC 时做一次 **5 秒探测**(转换固定短音频,测
142
+ `速度比 = 转换耗时 / 音频时长`),按分档表选定**块大小**与**预热块数**;
143
+ 2. 文本按句切块(每块 ≈ 6-20 秒音频,落在语义边界);
144
+ 3. 先转换预热块(GPU 2 块 / CPU 最多 4 块)立即开播,其余块播放期间通过
145
+ `GET /dsh-tts-api/rvc-next` 逐块拉取——**转换与播放重叠**;
146
+ 4. **无感衔接**:服务端转换时**裁剪每块头尾填充静音**(实测每块头 138ms / 尾 538ms →
147
+ 各保留 20ms/120ms 自然气息),前端用 **Web Audio 采样级精确拼接**
148
+ (AudioBuffer 按 `start(prevEnd)` 首尾相接,块间零事件抖动、零重载延迟);
149
+ 5. 分档表:`ratio ≤ 0.4 → 20s/预热2`,`0.4-0.6 → 15s/2`,`0.6-0.9 → 10s/3`,
150
+ `> 0.9(CPU)→ 6s/4`,探测失败兜底 `10s/3`;
151
+ 6. 短文本(≤12 秒)**不切块**,走单 URL 链路,零额外开销;
152
+ 7. **进度可见**:朗读按钮 tooltip 与试听面板显示「第 x/y 段 · 边播边合成」;
153
+ 8. **校准落盘**:探测结果存入 `~/.dsh/tts-rvc/calibration.json`(7 天有效 + GPU 名设备指纹),
154
+ dsh 重启后直接复用,换显卡自动重新探测。
155
+
156
+ > 完整设计见 [`adaptive-chunked-playback.md`](adaptive-chunked-playback.md)。
157
+
158
+ ---
159
+
160
+ <a name="紧凑索引压缩-index"></a>
161
+ ## 紧凑索引(压缩 .index)
162
+
163
+ RVC 训练出的检索索引常达**数百 MB**(实测示例 408MB / 129,396 向量 / 768 维),
164
+ 是分发音色包和冷启动加载的最大负担。设置面板「索引路径」右侧的**「压缩索引」按钮**可一键生成:
165
+
166
+ 1. 点「压缩索引」→ 选目标向量数(2k ≈ 6MB / 5k ≈ 15MB / 10k ≈ 31MB / 20k ≈ 61MB)→ 「生成」;
167
+ 2. 原理:从原索引**子采样**向量,重建为**与源索引同度量**的精确 flat 索引——RVC 训练默认 L2
168
+ (pipeline 的 `square(1/score)` 加权即按 L2 设计),紧凑索引自动跟随源度量
169
+ (源为内积则用 `IndexFlatIP`,否则 `IndexFlatL2`),RVC 管线(`read_index → reconstruct_n → search k=8`)
170
+ 零改动兼容;flat 精确检索比原 IVF `nprobe=1` 近似检索**更准**,音色还原度基本不变;
171
+ 3. 生成**不覆盖原文件**,输出为 `原文件名_compact_N.index`;成功后自动填入索引路径,立即可用;
172
+ 4. 构建时短暂占用 ~1GB 内存(读取大索引 + 重建),约几秒到几十秒。
173
+
174
+ **实测声音对比**(同一段真实语音,index_rate 0.75,样本级均差/RMS):免索引 vs 完整索引 ≈ 37%
175
+ (索引确实在起作用);完整 vs 紧凑 2k ≈ 37%(2k 样本的 8 近邻 ≠ 全量 8 近邻,属正常抽样偏差)。
176
+ 人耳听感差异很小——训练良好的模型承载大部分音色,索引是"精修"。分发音色包建议 10k(31MB);
177
+ 想要更强索引特征可把 index_rate 调向 1.0。
178
+
179
+ > 已有索引本身不大(如 30-40MB)时**不必压缩**——更小的紧凑版反而可能降低还原度。
180
+
181
+ ---
182
+
183
+ <a name="音色包注册表--下载"></a>
184
+ ## 音色包(注册表 + 下载)
185
+
186
+ 从音色包仓库**一键下载安装音色**:设置面板 RVC 配置下方「音色包」模块——
187
+
188
+ 1. 填入仓库地址(目录需包含 `manifest.json`),点「获取列表」;
189
+ 2. 每个音色包卡片显示名称 / 描述 / 体积(模型 + 索引)/ 许可 / 作者;多索引包可选装哪个;
190
+ 3. 点「下载并启用」:插件代下载(规避 CORS)、**sha256 逐一校验**、安装到
191
+ `~/.dsh/tts-rvc/packs/<包id>/`(文件名为 `<包id>.pth` / `<包id>.index`),自动填入模型/索引路径,
192
+ 并按清单设置原声音色、f0 方法、索引权重——立即可用;
193
+ 4. 已安装显示版本号与「卸载」按钮;重复下载自动跳过;sha256 不符中止并清理残留;
194
+ 5. 删除文件后状态自动校正(失效记录自动清除);仓库地址/代理/进行中的下载会记忆,重开面板自动恢复。
195
+
196
+ 清单格式(`manifest.json`,schema 2;url 支持相对路径,按仓库地址自动解析):
197
+
198
+ ```json
199
+ { "schema": 2, "packs": [ {
200
+ "id": "pack-id", "name": "音色名", "description": "...",
201
+ "version": "1.0.0", "author": "...", "license": "MIT",
202
+ "baseVoice": "zh-CN-YunyangNeural", "f0Method": "rmvpe", "indexRate": 0.75,
203
+ "model": { "url": "packs/pack-id/model.pth", "size": 55270272, "sha256": "..." },
204
+ "indexes": [ { "id": "c10k", "name": "紧凑 10k(推荐)",
205
+ "url": "packs/pack-id/index_compact.index", "size": 30720045, "sha256": "..." } ]
206
+ } ] }
207
+ ```
208
+
209
+ - `indexes` 为索引变体数组(可多个,UI 里选择);省略时兼容旧的单个 `index` 字段;
210
+ - 免索引的音色包:不写 `indexes` / `index`。
211
+
212
+ > 公开仓库示例:[github.com/1624318455/rvc-for-tts](https://github.com/1624318455/rvc-for-tts)
213
+ > (仓库地址填 `https://raw.githubusercontent.com/1624318455/rvc-for-tts/main`)。
214
+ > 本地测试:`node tests/mock-registry.mjs <目录> [端口]` 起一个静态仓库。
215
+
216
+ ---
217
+
218
+ <a name="便携运行时免装-rvc-webui"></a>
219
+ ## 便携运行时(免装 RVC WebUI)
220
+
221
+ 给"只有音色模型、不想装整套 RVC WebUI"的人:一个免安装文件夹,内含转换服务需要的一切
222
+ (Python + torch + 推理核心 + hubert/rmvpe + ffmpeg + `rvc-server.py`),
223
+ Windows 双击 `启动服务.bat`,macOS/Linux 运行 `start-rvc-server.sh` 即用。
224
+ **Windows 已在本机实测**(RTX 5070:模型加载 + 转换正常);**macOS(Apple Silicon)也已实测通过**。
225
+
226
+ 打包(在已装 RVC WebUI 的机器上,**零下载**):
227
+
228
+ ```powershell
229
+ E:\...\RVC20240604Nvidia\runtime\python.exe tools\package-runtime.py `
230
+ --rvc-dir "E:\...\RVC20240604Nvidia" --out "D:\rvc-portable" --skip-torch
231
+ ```
232
+
233
+ - **RTX 50 系(Blackwell)可选提速**:官方 pytorch CDN 对部分网络极慢(实测 31KB/s),
234
+ 用国内镜像在可见终端里升级 torch 到 cu128:
235
+
236
+ ```powershell
237
+ D:\rvc-portable\runtime\python.exe -m pip install --upgrade `
238
+ --extra-index-url https://mirrors.aliyun.com/pytorch-wheels/cu128 `
239
+ torch==2.7.0+cu128 torchaudio==2.7.0+cu128
240
+ ```
241
+
242
+ - 成品约 7-9GB,压缩 3-4GB(超出 GitHub 附件 2GB 上限,用网盘/对象存储分发,
243
+ 或只分享打包脚本让各自本机生成)。详见[使用手册 §10](USER-GUIDE.md)。
244
+ - **跨平台**:`--platform auto|windows|linux|darwin`——Windows 生成 `启动服务.bat`,
245
+ Linux/macOS 生成 `start-rvc-server.sh`(macOS 自动跳过 torch 升级)。
246
+ **macOS(Apple Silicon)已实测通过**:`package-runtime.py --platform darwin` 打包后,
247
+ `mac-verify.sh` 全链路 PASS,CPU 转换**快于实时**(热约 0.45× / 冷约 0.8×,见下)。
248
+
249
+ ### macOS 实测要点(Apple Silicon,macOS 26.x)
250
+
251
+ Darwin 打包时 `package-runtime.py` 会自动对 `infer/lib/audio.py` 打一个
252
+ **macOS 专用补丁**:把 `av.open(..., "rb"/"wb")` 改成 `av.open(..., "r"/"w")`。
253
+ 现代 PyAV(≥10,macOS arm64 唯一可装的 wheel 版本)拒绝 `"rb"/"wb"` 文件模式,
254
+ 不打这个补丁 `/convert` 会报 `ValueError: mode must be 'r', 'w', or None, got: rb`。
255
+ Windows 的 RVC WebUI 自带旧 PyAV 不受影响,所以只在 darwin 分支打补丁。
256
+
257
+ 手动跑(不打包,直接用 `~/rvc-work`)时,除锁定版本清单外**还需**:
258
+
259
+ - `pip install av praat-parselmouth torchcrepe`(旧版 infer 的隐式依赖)
260
+ - `faiss-cpu==1.7.3`(最新 1.13 要求 `numpy>=1.25`,与锁定 `numpy==1.23.5` 冲突)
261
+ - 装 `fairseq==0.12.2` 前把 pip 降到 **<24.1**(其依赖 omegaconf 的 `PyYAML>=5.1.*`
262
+ 元数据在新 pip 里被拒);并保持 `setuptools<81`(否则缺 `pkg_resources`,librosa 0.9.1 导入失败)
263
+ - **方案 B 拉 infer 时务必用旧版 tag**(如 `2.2.231006`):新版 RVC 已把 `infer/`
264
+ 整体重构为 `infer/vc/ + infer/module/`,与 `rvc-server.py` 期望的
265
+ `infer/modules/vc/ + infer/lib/infer_pack/models.py` 完全不兼容
266
+
267
+ > 🐛 若用旧版 `mac-verify.sh` 遇到"第 5 步 RIFF 校验误报 FAIL":这是脚本自身 bug
268
+ > (macOS 的 `od` 字节间双空格导致 `grep "52 49 46 46"` 匹配不到),已改为
269
+ > 去空格比较十六进制,输出实为合法 RIFF。(旧版会造成 `exit 1` 假失败。)
270
+
271
+ ---
272
+
273
+ <a name="设置项详解"></a>
274
+ ## 设置项详解
275
+
276
+ | 设置项 | 作用 | 建议 |
277
+ |---|---|---|
278
+ | 语速 / 音调 / 音量 | Edge TTS 朗读属性;RVC 模式下作用于转换前原声,语调会透传到最终音色 | `0` = 默认;语速 ±10-20% 听感自然 |
279
+ | 服务地址 | 本地 RVC 推理服务地址 | 默认 `http://127.0.0.1:4892` |
280
+ | 模型路径 (.pth) | RVC 模型文件,即音色来源 | 必填;可用「浏览」从本机选择(.pth) |
281
+ | 索引路径 (.index) | 音色检索索引,提升音色还原度 | 留空 = 免索引(还原度略降,仍可用);「浏览」限 .index |
282
+ | 原声音色 | 转换前的原始语音,决定语调/停顿 | 男声/女声按喜好选 |
283
+ | 说话人 ID (spk_id) | 多说话人模型选择说话人 | 单说话人模型保持 0 |
284
+ | f0 方法 | 音高检测算法:rmvpe 效果最好;pm 最快;harvest 低音好但慢;crepe 吃 GPU | 默认 rmvpe;CPU 建议 pm |
285
+ | 变调 (f0_up_key) | 对音高整体升降,单位半音 | 0 默认;±2-3 可微调声线 |
286
+ | 索引权重 (index_rate) | 越高音色越接近模型训练者,越低越接近原声 | 0.5-0.75 常用 |
287
+ | 输出采样率 (resample_sr) | 输出音频采样率,越高细节越好、文件越大 | 40000 默认 |
288
+ | 响度混合 (rms_mix_rate) | 输出音量包络混合比例,越高越接近训练者响度习惯 | 0.25 默认 |
289
+ | 辅音保护 (protect) | 保护清辅音与呼吸声,过高保留更多原声细节 | 0.33 默认 |
290
+ | 滤波半径 (filter_radius) | 音高平滑滤波(仅 harvest 有效),越大曲线越平滑 | ≥3 启用平滑 |
291
+ | F0 曲线文件 | 手动指定音高曲线文件,覆盖自动提取 | 留空 = 自动提取 |
292
+
293
+ ---
294
+
295
+ <a name="实测延迟"></a>
296
+ ## 实测延迟(NVIDIA GPU,服务常驻)
297
+
298
+ | 场景 | 延迟 |
299
+ |---|---|
300
+ | 热转换(短句) | 带 index ~1s / 免 index ~0.4s |
301
+ | 完整链路(Edge 合成 + 转换) | ~2-6s |
302
+ | 首次请求(含 hubert/模型加载) | 数秒到十余秒 |
303
+
304
+ ---
305
+
306
+ <a name="rvc-疑难排查"></a>
307
+ ## RVC 疑难排查
308
+
309
+ > 💡 设置面板有「**诊断**」按钮:一键检查 Edge TTS 在线合成、本地 RVC 服务、模型加载状态,
310
+ > 并按「连接 / 协议 / 音色」分类给出可读提示。
311
+
312
+ | 症状 | 最常见原因 | 怎么办 |
313
+ |---|---|---|
314
+ | 点「浏览」提示"浏览文件需要先启动本地 RVC 服务" | 服务没启动 / 服务地址不对 | 按[启动本地 RVC 服务](#启动本地-rvc-服务)启动并保留窗口;若已启动,确认「服务地址」= `http://127.0.0.1:4892` |
315
+ | 提示"无法连接本地 RVC 推理服务" | 服务窗口没开 / 被关了 | 重新启动服务(见[启动本地 RVC 服务](#启动本地-rvc-服务)),别关窗口 |
316
+ | 提示"未配置 RVC 模型路径" | 模型路径为空 | 填 .pth 路径(或点浏览) |
317
+ | 首次朗读等十几秒 | 正常:加载模型 + 自动测速 | 等它;之后会快 |
318
+ | 音色不够像 | 没填索引,或索引权重太低 | 填 .index;「索引权重」调向 100% |
319
+ | 索引选择列表里看不到下载的包 | — | 已支持:`~/.dsh/tts-rvc/packs` 会出现在浏览列表(需重启 rvc-server 生效) |
320
+
321
+ ---
322
+
323
+ <a name="版权提示"></a>
324
+ ## 版权提示
325
+
326
+ 只发布/使用**你有权分发**的音色(自己训练的、或已获授权的)。
327
+ 演示音色 azusa-test 受版权限制,仅限本机开发验证,不在任何公开仓库。
328
+
329
+ ---
330
+
331
+ <a name="english"></a>
332
+ ## English
333
+
334
+ RVC is voice **conversion** (input length == output length), not TTS. The custom-voice
335
+ pipeline is `Edge TTS base audio → local RVC inference server (rvc-server.py) →
336
+ converted wav → playback`, all on the user's own GPU/CPU.
337
+
338
+ ### Quick start
339
+ 1. **Prepare**: an RVC model (`.pth`, required) + optional index (`.index`), and either
340
+ an RVC WebUI install or the [portable runtime](#便携运行时免装-rvc-webui).
341
+ 2. **Start the service** (keep the window open):
342
+ - Windows:
343
+ ```powershell
344
+ E:\...\RVC20240604Nvidia\runtime\python.exe rvc-server.py `
345
+ --rvc-dir "E:\...\RVC20240604Nvidia" --model "E:\...\xxx.pth" `
346
+ --index "E:\...\xxx.index" --port 4892
347
+ ```
348
+ - macOS/Linux (portable runtime or a manually prepared RVC directory):
349
+ ```bash
350
+ <你的便携包目录>/start-rvc-server.sh
351
+ # or: <你的工作目录>/venv/bin/python <你的工作目录>/rvc-server.py --port 4892
352
+ ```
353
+ 3. **Configure**: 设置 → 插件 → 语音 → TTS提供者 = 自定义音色(RVC);keep 服务地址 default;
354
+ fill 模型路径 (browse or paste); index optional (empty = index-free).
355
+
356
+ ### Key capabilities
357
+ - **Adaptive chunked progressive playback**: long reads are sentence-split into
358
+ ~6-20s chunks; a one-shot probe picks chunk size + prewarm count from the machine's
359
+ convert/play speed; chunks stream with **gapless joins** (server trims per-chunk edge
360
+ silence, client chains AudioBuffers at `start(prevEnd)`); progress shows "chunk x/y".
361
+ - **Compact index tool**: sub-samples a huge `.index` (hundreds of MB) into an exact
362
+ same-metric flat index (2k≈6MB / 10k≈31MB / 20k≈61MB) with essentially unchanged
363
+ identity — only needed for very large indexes.
364
+ - **Voice-pack registry**: one-click install of model + index from a `manifest.json`
365
+ registry (`schema 2`, relative URLs, sha256-pinned, multi-index variants, uninstall,
366
+ state reconciliation). Public example: `github.com/1624318455/rvc-for-tts`.
367
+ - **Portable runtime**: `tools/package-runtime.py` builds a no-install folder (copy the
368
+ proven env; optional torch cu128 upgrade for RTX 50-series; use a mirror if the
369
+ official CDN is slow). See [user guide §10](USER-GUIDE.md).
370
+ - **Server API**: `GET /health` · `POST /load {model,index}` · `POST /convert
371
+ {audio_base64,params}` · `GET /files?kind=pth|index` · `POST /compact-index`.
372
+
373
+ ### Settings explained (abridged)
374
+ | Setting | Effect | Guidance |
375
+ |---|---|---|
376
+ | Service URL | Local RVC service address | default `http://127.0.0.1:4892` |
377
+ | Model path (.pth) | Your voice model | required |
378
+ | Index path (.index) | Retrieval index; improves identity | empty = index-free (slightly lower fidelity) |
379
+ | Base voice | Voice synthesized before conversion | decides prosody/pauses |
380
+ | f0 method | Pitch detection | rmvpe default; pm on CPU |
381
+ | Index rate | Higher = closer to the trained voice | 0.5-0.75 common |
382
+
383
+ ### Troubleshooting
384
+ - "无法连接本地 RVC 推理服务" → the service window is closed; restart it and keep it open.
385
+ - "未配置 RVC 模型路径" → fill the `.pth` path.
386
+ - First read is slow (10s+) → normal (model load + one-shot calibration).
387
+ - Voice doesn't sound like the target → add an index or raise index rate.
388
+
389
+ > ⚠️ Copyright: only publish/use voices you have the right to distribute.
390
+ > The demo voice (azusa-test) is local-development only and is not in any public registry.