cortico-world-fish-sing 0.4.20 → 0.4.22
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.
- package/CHANGELOG.md +23 -0
- package/assets/models.manifest.json +12 -6
- package/dist/{webui-f4daa0a9.js → webui-b69dd33a.js} +24 -3
- package/dist/webui.js +24 -3
- package/package.json +45 -45
- package/src/config.ts +19 -0
- package/src/library.ts +2 -0
- package/src/setup.ts +13 -0
- package/src/sing.ts +11 -0
- package/src/world.ts +7 -0
- package/tests/smoke.mjs +8 -0
- package/tests/test_engine_logic.py +23 -0
- package/worker/engine.py +5 -3
- package/worker/server.py +4 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,29 @@
|
|
|
2
2
|
|
|
3
3
|
格式参考 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/);版本号遵循语义化。
|
|
4
4
|
|
|
5
|
+
## [0.4.22] - 2026-11-06
|
|
6
|
+
|
|
7
|
+
### 修复
|
|
8
|
+
- **自检把「出厂默认模型」算成必需,导致换过模型后显示"4/6 未就绪"**(用户会以为装坏了):把 `dfy2.pth` + 它的检索索引标为**可选**(`required:false`),必需组件只剩 hubert / rmvpe / 两个训练底模。
|
|
9
|
+
- 磁贴文案:必需齐全时显示「就绪 · 默认模型未装」(绿色),只有必需缺了才显示「缺 N 项」
|
|
10
|
+
- 按钮:必需齐全但默认模型缺 → 「补下默认模型(349 MB)」;不再一直挂着「下载模型权重」
|
|
11
|
+
- 说明文案改成区分「必需 557 MB」和「可选 349 MB」
|
|
12
|
+
- 面板侧做了文件名兜底判断,**不需要重启就能看到正确结果**
|
|
13
|
+
|
|
14
|
+
## [0.4.21] - 2026-11-06
|
|
15
|
+
|
|
16
|
+
### 新增
|
|
17
|
+
- **「音量跟随 rms-mix-rate」可配置**(设置 → 大肥鱼唱歌 → 换声):轻唱、渐弱能不能还原全看它。
|
|
18
|
+
- `0` = 完全跟随原唱的音量起伏(**新默认**,用户实测温柔原唱用它最好听)
|
|
19
|
+
- `0.25` = 保留一点模型自己的动态(RVC 官方默认)
|
|
20
|
+
- `0.5+` = 轻唱被"唱满",渐弱消失
|
|
21
|
+
- `1` = 完全不跟随(**老版本的默认值,现已废弃**)
|
|
22
|
+
- 点歌工具 `fish_sing_song` 也加了同名可选参数 `rmsMixRate`,可以单首歌覆盖。
|
|
23
|
+
|
|
24
|
+
### 修复
|
|
25
|
+
- **翻唱丢失"轻唱/渐弱"**:`engine.convert()` 的 `rms_mix_rate` 默认值是 `1.0`,而 RVC 里 `1` 表示"**跳过**音量包络对齐"(`if rms_mix_rate != 1` 直接跳过),所以模型一直用自己的音量唱——温柔段落被唱满。《雨爱》实测:原唱结尾比副歌轻 5.0 dB,旧版只轻 3.0 dB,改成 0 后回到 5.0 dB。
|
|
26
|
+
- `ab_test`(选模对比)也改用 0.0,对比时听到的是真实动态。
|
|
27
|
+
|
|
5
28
|
## [0.4.20] - 2026-11-05
|
|
6
29
|
|
|
7
30
|
### 修复
|
|
@@ -9,37 +9,43 @@
|
|
|
9
9
|
"name": "dfy2.pth",
|
|
10
10
|
"size": 55193472,
|
|
11
11
|
"sha256": "11a79a086aeca9a28493adb3288c3a61ef488ed16b8d916b5a2aa26e47fd8d1d",
|
|
12
|
-
"target": "assets/weights/dfy2.pth"
|
|
12
|
+
"target": "assets/weights/dfy2.pth",
|
|
13
|
+
"required": false
|
|
13
14
|
},
|
|
14
15
|
{
|
|
15
16
|
"name": "added_IVF2529_Flat_nprobe_1_dfy2_v2.index",
|
|
16
17
|
"size": 311680739,
|
|
17
18
|
"sha256": "25f7003a2b9eadcc3d3f1c49d3e265524add799d063665d3c7bea31df07879ea",
|
|
18
|
-
"target": "logs/dfy2/added_IVF2529_Flat_nprobe_1_dfy2_v2.index"
|
|
19
|
+
"target": "logs/dfy2/added_IVF2529_Flat_nprobe_1_dfy2_v2.index",
|
|
20
|
+
"required": false
|
|
19
21
|
},
|
|
20
22
|
{
|
|
21
23
|
"name": "pytorch_model.bin",
|
|
22
24
|
"size": 189206711,
|
|
23
25
|
"sha256": "cc8c20f4b90a520757260197a3ff2505705a7adbd20ad9eeaa4e1a9b38442ef5",
|
|
24
|
-
"target": "assets/hubert_base/pytorch_model.bin"
|
|
26
|
+
"target": "assets/hubert_base/pytorch_model.bin",
|
|
27
|
+
"required": true
|
|
25
28
|
},
|
|
26
29
|
{
|
|
27
30
|
"name": "rmvpe.pt",
|
|
28
31
|
"size": 181184272,
|
|
29
32
|
"sha256": "6d62215f4306e3ca278246188607209f09af3dc77ed4232efdd069798c4ec193",
|
|
30
|
-
"target": "assets/rmvpe/rmvpe.pt"
|
|
33
|
+
"target": "assets/rmvpe/rmvpe.pt",
|
|
34
|
+
"required": true
|
|
31
35
|
},
|
|
32
36
|
{
|
|
33
37
|
"name": "f0G40k.pth",
|
|
34
38
|
"size": 73106273,
|
|
35
39
|
"sha256": "3b2c44035e782c4b14ddc0bede9e2f4a724d025cd073f736d4f43708453adfcb",
|
|
36
|
-
"target": "assets/pretrained_v2/f0G40k.pth"
|
|
40
|
+
"target": "assets/pretrained_v2/f0G40k.pth",
|
|
41
|
+
"required": true
|
|
37
42
|
},
|
|
38
43
|
{
|
|
39
44
|
"name": "f0D40k.pth",
|
|
40
45
|
"size": 142875703,
|
|
41
46
|
"sha256": "6b6ab091e70801b28e3f41f335f2fc5f3f35c75b39ae2628d419644ec2b0fa09",
|
|
42
|
-
"target": "assets/pretrained_v2/f0D40k.pth"
|
|
47
|
+
"target": "assets/pretrained_v2/f0D40k.pth",
|
|
48
|
+
"required": true
|
|
43
49
|
}
|
|
44
50
|
]
|
|
45
51
|
}
|
|
@@ -365,7 +365,9 @@ function mountSetup(ctx) {
|
|
|
365
365
|
const list = el('div', 'fs-list');
|
|
366
366
|
const hint = el('div', 'fs-hint');
|
|
367
367
|
hint.textContent =
|
|
368
|
-
'
|
|
368
|
+
'必需组件约 557 MB:ContentVec + RMVPE + 两个训练底模——这几个缺了才真的用不了,下载后自动校验 sha256。\n'
|
|
369
|
+
+ '出厂默认模型(dfy2 + 检索索引,约 349 MB)是可选的示例;换过模型之后删掉它完全没问题,'
|
|
370
|
+
+ '自检只会显示「默认模型未装」,点按钮可补。\n'
|
|
369
371
|
+ '运行时是 Python 环境:GPU 版下载约 2.5 GB、装完约 6 GB(55 秒的歌约 8 秒换完);'
|
|
370
372
|
+ 'CPU 版只要约 200 MB,但慢 6~8 倍。已经装好 torch 的不会被覆盖。';
|
|
371
373
|
|
|
@@ -415,9 +417,26 @@ function mountSetup(ctx) {
|
|
|
415
417
|
const paint = (st) => {
|
|
416
418
|
const m = st.models || [];
|
|
417
419
|
const ready = m.filter((x) => x.ready).length;
|
|
420
|
+
// 必需(hubert/rmvpe/底模)才算"能不能用";出厂默认模型 dfy2 是可选的示例,
|
|
421
|
+
// 换过模型后删掉它很常见,不能因此把整块显示成"4/6 未就绪"(用户会以为装坏了)。
|
|
422
|
+
// world 侧重启后会给 required 字段;没给时按文件名兜底认出厂默认模型(dfy2 的 .pth 和它的索引),
|
|
423
|
+
// 这样不重启也能立刻显示正确结果。
|
|
424
|
+
const isOptional = (x) => (x.required === false)
|
|
425
|
+
|| (x.required === undefined
|
|
426
|
+
&& (/assets[\\/]weights[\\/]dfy2\.pth$/.test(x.target || '') || /logs[\\/]dfy2[\\/]/.test(x.target || '')));
|
|
427
|
+
const need = m.filter((x) => !isOptional(x));
|
|
428
|
+
const needReady = need.filter((x) => x.ready).length;
|
|
429
|
+
const weightsOk = needReady === need.length;
|
|
430
|
+
const optList = m.filter((x) => isOptional(x) && !x.ready);
|
|
431
|
+
const optMissing = Number(st.optionalMissing ?? optList.length);
|
|
432
|
+
// 大小也要有兜底:world 重启前不带 optionalMissingBytes,之前会显示「补下默认模型(0.0 MB)」
|
|
433
|
+
const optMissingBytes = Number(st.optionalMissingBytes ?? optList.reduce((n, x) => n + (Number(x.size) || 0), 0));
|
|
434
|
+
const weightsText = weightsOk
|
|
435
|
+
? (optMissing ? '就绪 · 默认模型未装' : `就绪 · ${needReady}/${need.length}`)
|
|
436
|
+
: `缺 ${need.length - needReady} 项 · ${needReady}/${need.length}`;
|
|
418
437
|
cards.replaceChildren(
|
|
419
438
|
card('RVC 代码', st.rvc && st.rvc.ready ? '已就绪' : '缺失', st.rvc && st.rvc.ready ? 'ok' : 'bad'),
|
|
420
|
-
card('模型权重',
|
|
439
|
+
card('模型权重', weightsText, weightsOk ? 'ok' : needReady ? 'warn' : 'bad'),
|
|
421
440
|
card('Python 运行时', st.python && st.python.ok ? '已就绪' : '未安装', st.python && st.python.ok ? 'ok' : 'bad'),
|
|
422
441
|
card('ffmpeg', st.ffmpeg && st.ffmpeg.ok ? '已就绪' : '没找到', st.ffmpeg && st.ffmpeg.ok ? 'ok' : 'bad'),
|
|
423
442
|
);
|
|
@@ -449,7 +468,9 @@ function mountSetup(ctx) {
|
|
|
449
468
|
}
|
|
450
469
|
|
|
451
470
|
// 按钮文案跟着状态走,避免"已经装好了还写着安装"
|
|
452
|
-
dl.textContent =
|
|
471
|
+
dl.textContent = weightsOk
|
|
472
|
+
? (optMissing ? `补下默认模型(${mb(optMissingBytes)})` : '校验权重')
|
|
473
|
+
: `下载必需组件(${mb(st.totalBytes - st.doneBytes)})`;
|
|
453
474
|
if (st.python && st.python.ok) {
|
|
454
475
|
gpu.textContent = '重装 GPU 运行时';
|
|
455
476
|
cpu.textContent = '重装 CPU 运行时';
|
package/dist/webui.js
CHANGED
|
@@ -365,7 +365,9 @@ function mountSetup(ctx) {
|
|
|
365
365
|
const list = el('div', 'fs-list');
|
|
366
366
|
const hint = el('div', 'fs-hint');
|
|
367
367
|
hint.textContent =
|
|
368
|
-
'
|
|
368
|
+
'必需组件约 557 MB:ContentVec + RMVPE + 两个训练底模——这几个缺了才真的用不了,下载后自动校验 sha256。\n'
|
|
369
|
+
+ '出厂默认模型(dfy2 + 检索索引,约 349 MB)是可选的示例;换过模型之后删掉它完全没问题,'
|
|
370
|
+
+ '自检只会显示「默认模型未装」,点按钮可补。\n'
|
|
369
371
|
+ '运行时是 Python 环境:GPU 版下载约 2.5 GB、装完约 6 GB(55 秒的歌约 8 秒换完);'
|
|
370
372
|
+ 'CPU 版只要约 200 MB,但慢 6~8 倍。已经装好 torch 的不会被覆盖。';
|
|
371
373
|
|
|
@@ -415,9 +417,26 @@ function mountSetup(ctx) {
|
|
|
415
417
|
const paint = (st) => {
|
|
416
418
|
const m = st.models || [];
|
|
417
419
|
const ready = m.filter((x) => x.ready).length;
|
|
420
|
+
// 必需(hubert/rmvpe/底模)才算"能不能用";出厂默认模型 dfy2 是可选的示例,
|
|
421
|
+
// 换过模型后删掉它很常见,不能因此把整块显示成"4/6 未就绪"(用户会以为装坏了)。
|
|
422
|
+
// world 侧重启后会给 required 字段;没给时按文件名兜底认出厂默认模型(dfy2 的 .pth 和它的索引),
|
|
423
|
+
// 这样不重启也能立刻显示正确结果。
|
|
424
|
+
const isOptional = (x) => (x.required === false)
|
|
425
|
+
|| (x.required === undefined
|
|
426
|
+
&& (/assets[\\/]weights[\\/]dfy2\.pth$/.test(x.target || '') || /logs[\\/]dfy2[\\/]/.test(x.target || '')));
|
|
427
|
+
const need = m.filter((x) => !isOptional(x));
|
|
428
|
+
const needReady = need.filter((x) => x.ready).length;
|
|
429
|
+
const weightsOk = needReady === need.length;
|
|
430
|
+
const optList = m.filter((x) => isOptional(x) && !x.ready);
|
|
431
|
+
const optMissing = Number(st.optionalMissing ?? optList.length);
|
|
432
|
+
// 大小也要有兜底:world 重启前不带 optionalMissingBytes,之前会显示「补下默认模型(0.0 MB)」
|
|
433
|
+
const optMissingBytes = Number(st.optionalMissingBytes ?? optList.reduce((n, x) => n + (Number(x.size) || 0), 0));
|
|
434
|
+
const weightsText = weightsOk
|
|
435
|
+
? (optMissing ? '就绪 · 默认模型未装' : `就绪 · ${needReady}/${need.length}`)
|
|
436
|
+
: `缺 ${need.length - needReady} 项 · ${needReady}/${need.length}`;
|
|
418
437
|
cards.replaceChildren(
|
|
419
438
|
card('RVC 代码', st.rvc && st.rvc.ready ? '已就绪' : '缺失', st.rvc && st.rvc.ready ? 'ok' : 'bad'),
|
|
420
|
-
card('模型权重',
|
|
439
|
+
card('模型权重', weightsText, weightsOk ? 'ok' : needReady ? 'warn' : 'bad'),
|
|
421
440
|
card('Python 运行时', st.python && st.python.ok ? '已就绪' : '未安装', st.python && st.python.ok ? 'ok' : 'bad'),
|
|
422
441
|
card('ffmpeg', st.ffmpeg && st.ffmpeg.ok ? '已就绪' : '没找到', st.ffmpeg && st.ffmpeg.ok ? 'ok' : 'bad'),
|
|
423
442
|
);
|
|
@@ -449,7 +468,9 @@ function mountSetup(ctx) {
|
|
|
449
468
|
}
|
|
450
469
|
|
|
451
470
|
// 按钮文案跟着状态走,避免"已经装好了还写着安装"
|
|
452
|
-
dl.textContent =
|
|
471
|
+
dl.textContent = weightsOk
|
|
472
|
+
? (optMissing ? `补下默认模型(${mb(optMissingBytes)})` : '校验权重')
|
|
473
|
+
: `下载必需组件(${mb(st.totalBytes - st.doneBytes)})`;
|
|
453
474
|
if (st.python && st.python.ok) {
|
|
454
475
|
gpu.textContent = '重装 GPU 运行时';
|
|
455
476
|
cpu.textContent = '重装 CPU 运行时';
|
package/package.json
CHANGED
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "cortico-world-fish-sing",
|
|
3
|
-
"version": "0.4.
|
|
4
|
-
"description": "让她真的开口唱:B 站点歌或本地文件 → 分离 → 换声 → 混音,本机出声或发 QQ 语音条",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"main": "./src/index.ts",
|
|
7
|
-
"license": "MIT",
|
|
8
|
-
"author": "FXYXL",
|
|
9
|
-
"keywords": [
|
|
10
|
-
"cortico-world",
|
|
11
|
-
"cortico",
|
|
12
|
-
"coo",
|
|
13
|
-
"sing",
|
|
14
|
-
"rvc",
|
|
15
|
-
"music",
|
|
16
|
-
"qq"
|
|
17
|
-
],
|
|
18
|
-
"engines": {
|
|
19
|
-
"node": ">=22.6"
|
|
20
|
-
},
|
|
21
|
-
"homepage": "https://github.com/FXYXL/cortico-world-fish-sing#readme",
|
|
22
|
-
"repository": {
|
|
23
|
-
"type": "git",
|
|
24
|
-
"url": "git+https://github.com/FXYXL/cortico-world-fish-sing.git"
|
|
25
|
-
},
|
|
26
|
-
"bugs": {
|
|
27
|
-
"url": "https://github.com/FXYXL/cortico-world-fish-sing/issues"
|
|
28
|
-
},
|
|
29
|
-
"cortico": {
|
|
30
|
-
"kind": "world",
|
|
31
|
-
"api": 6,
|
|
32
|
-
"label": "大肥鱼唱歌",
|
|
33
|
-
"tags": [
|
|
34
|
-
"music",
|
|
35
|
-
"qq",
|
|
36
|
-
"local"
|
|
37
|
-
],
|
|
38
|
-
"describe": "describe.json",
|
|
39
|
-
"webUiClient": "dist/webui-
|
|
40
|
-
},
|
|
41
|
-
"scripts": {
|
|
42
|
-
"doctor": "node tools/doctor.mjs"
|
|
43
|
-
},
|
|
44
|
-
"dependencies": {}
|
|
45
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "cortico-world-fish-sing",
|
|
3
|
+
"version": "0.4.22",
|
|
4
|
+
"description": "让她真的开口唱:B 站点歌或本地文件 → 分离 → 换声 → 混音,本机出声或发 QQ 语音条",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./src/index.ts",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"author": "FXYXL",
|
|
9
|
+
"keywords": [
|
|
10
|
+
"cortico-world",
|
|
11
|
+
"cortico",
|
|
12
|
+
"coo",
|
|
13
|
+
"sing",
|
|
14
|
+
"rvc",
|
|
15
|
+
"music",
|
|
16
|
+
"qq"
|
|
17
|
+
],
|
|
18
|
+
"engines": {
|
|
19
|
+
"node": ">=22.6"
|
|
20
|
+
},
|
|
21
|
+
"homepage": "https://github.com/FXYXL/cortico-world-fish-sing#readme",
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "git+https://github.com/FXYXL/cortico-world-fish-sing.git"
|
|
25
|
+
},
|
|
26
|
+
"bugs": {
|
|
27
|
+
"url": "https://github.com/FXYXL/cortico-world-fish-sing/issues"
|
|
28
|
+
},
|
|
29
|
+
"cortico": {
|
|
30
|
+
"kind": "world",
|
|
31
|
+
"api": 6,
|
|
32
|
+
"label": "大肥鱼唱歌",
|
|
33
|
+
"tags": [
|
|
34
|
+
"music",
|
|
35
|
+
"qq",
|
|
36
|
+
"local"
|
|
37
|
+
],
|
|
38
|
+
"describe": "describe.json",
|
|
39
|
+
"webUiClient": "dist/webui-b69dd33a.js"
|
|
40
|
+
},
|
|
41
|
+
"scripts": {
|
|
42
|
+
"doctor": "node tools/doctor.mjs"
|
|
43
|
+
},
|
|
44
|
+
"dependencies": {}
|
|
45
|
+
}
|
package/src/config.ts
CHANGED
|
@@ -29,6 +29,11 @@ export interface FishSingConfigSection {
|
|
|
29
29
|
protect: number;
|
|
30
30
|
/** 半音数;'auto' = 每次按源曲与模型音域自动推荐 */
|
|
31
31
|
pitch: number | 'auto';
|
|
32
|
+
/**
|
|
33
|
+
* 音量包络跟随原唱的程度(RVC 的 rms_mix_rate):
|
|
34
|
+
* 0 = 完全跟随原唱(轻唱就是轻唱);1 = 完全用模型自己的音量(轻唱会被唱满)。
|
|
35
|
+
*/
|
|
36
|
+
rmsMixRate: number;
|
|
32
37
|
/** full = 带伴奏;vocals = 只要人声 */
|
|
33
38
|
mode: 'full' | 'vocals';
|
|
34
39
|
};
|
|
@@ -101,6 +106,9 @@ export const FISHSING_DEFAULTS: FishSingConfigSection = {
|
|
|
101
106
|
indexRate: 0.75,
|
|
102
107
|
protect: 0.33,
|
|
103
108
|
pitch: 'auto',
|
|
109
|
+
// 0 = 严格跟随原唱的音量起伏。用户实测:温柔的原唱用 0 最好听;
|
|
110
|
+
// 老版本这里是 1.0(等于放弃跟随),轻唱段落会被唱满。
|
|
111
|
+
rmsMixRate: 0,
|
|
104
112
|
mode: 'full',
|
|
105
113
|
},
|
|
106
114
|
play: {
|
|
@@ -189,6 +197,17 @@ export function fishsingConfigGroups(): ConfigGroup[] {
|
|
|
189
197
|
description: "填 'auto' = 每首歌按源曲与模型音域自动推荐(默认,推荐)。填数字 = 固定移调;男歌女唱常要 +2 ~ +4。",
|
|
190
198
|
'x-hot': true,
|
|
191
199
|
},
|
|
200
|
+
[at('voice.rmsMixRate')]: {
|
|
201
|
+
type: 'number',
|
|
202
|
+
title: '音量跟随 rms-mix-rate',
|
|
203
|
+
description:
|
|
204
|
+
'轻唱/渐弱能不能还原,全看这个。0 = 完全跟随原唱的音量起伏(推荐,温柔的歌用它最好听);'
|
|
205
|
+
+ '0.25 = 保留一点模型自己的动态(RVC 官方默认);'
|
|
206
|
+
+ '0.5 以上轻唱会被"唱满",渐弱基本消失;1 = 完全不跟随(老版本的行为,已废弃)。',
|
|
207
|
+
minimum: 0,
|
|
208
|
+
maximum: 1,
|
|
209
|
+
'x-hot': true,
|
|
210
|
+
},
|
|
192
211
|
[at('voice.mode')]: {
|
|
193
212
|
type: 'string',
|
|
194
213
|
title: '默认输出',
|
package/src/library.ts
CHANGED
package/src/setup.ts
CHANGED
|
@@ -151,6 +151,12 @@ export function inspect(paths: WorkerPaths): SetupStatus {
|
|
|
151
151
|
return { ...f, ready: actual === f.size, actual };
|
|
152
152
|
});
|
|
153
153
|
const doneBytes = models.reduce((n, m) => n + (m.ready ? m.size : 0), 0);
|
|
154
|
+
// 分「必需」和「可选」:hubert/rmvpe/底模缺了就没法换声;出厂默认模型(dfy2)只是示例,
|
|
155
|
+
// 用户换过模型后删掉它很正常——不能因此报"4/6 未就绪",那是误导(0.4.22 之前就是这样)。
|
|
156
|
+
const required = models.filter((m) => m.required !== false);
|
|
157
|
+
const optional = models.filter((m) => m.required === false);
|
|
158
|
+
const requiredReady = required.filter((m) => m.ready).length;
|
|
159
|
+
const optionalMissing = optional.filter((m) => !m.ready).length;
|
|
154
160
|
return {
|
|
155
161
|
runtimeRoot: paths.runtimeRoot,
|
|
156
162
|
rvc: { ready: dirCount(paths.rvcRoot) > 0, root: paths.rvcRoot, files: dirCount(paths.rvcRoot) },
|
|
@@ -162,6 +168,13 @@ export function inspect(paths: WorkerPaths): SetupStatus {
|
|
|
162
168
|
models,
|
|
163
169
|
doneBytes,
|
|
164
170
|
totalBytes: models.reduce((n, m) => n + m.size, 0),
|
|
171
|
+
/** 必需组件是否齐(决定"能不能唱/训") */
|
|
172
|
+
weightsOk: requiredReady === required.length,
|
|
173
|
+
requiredReady,
|
|
174
|
+
requiredTotal: required.length,
|
|
175
|
+
/** 可选(出厂默认模型)缺了几个,只做提示不做告警 */
|
|
176
|
+
optionalMissing,
|
|
177
|
+
optionalMissingBytes: optional.reduce((n, m) => n + (m.ready ? 0 : m.size), 0),
|
|
165
178
|
systemPython: findSystemPython(),
|
|
166
179
|
ffmpeg: {
|
|
167
180
|
dir: paths.ffmpegDir,
|
package/src/sing.ts
CHANGED
|
@@ -48,6 +48,12 @@ export interface SingDeps {
|
|
|
48
48
|
voice: SingParams;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
+
/** 把 0~1 之间的参数夹住:非法/越界一律退回配置值,别把 NaN 传到 worker。 */
|
|
52
|
+
function clamp01(v: unknown): number {
|
|
53
|
+
const n = Number(v);
|
|
54
|
+
return Number.isFinite(n) ? Math.min(1, Math.max(0, n)) : 0;
|
|
55
|
+
}
|
|
56
|
+
|
|
51
57
|
export interface SingRequest {
|
|
52
58
|
song: string;
|
|
53
59
|
to?: string;
|
|
@@ -56,6 +62,8 @@ export interface SingRequest {
|
|
|
56
62
|
pitch?: number | 'auto';
|
|
57
63
|
indexRate?: number;
|
|
58
64
|
protect?: number;
|
|
65
|
+
/** 音量跟随原唱的程度 0~1(0 = 完全跟随,轻唱不会被唱满) */
|
|
66
|
+
rmsMixRate?: number;
|
|
59
67
|
start?: number;
|
|
60
68
|
duration?: number;
|
|
61
69
|
/** 跳过缓存(想重唱一遍时用) */
|
|
@@ -260,6 +268,8 @@ export async function singSong(req: SingRequest, deps: SingDeps): Promise<SingRe
|
|
|
260
268
|
index: deps.voice.index,
|
|
261
269
|
indexRate: Number(req.indexRate ?? deps.voice.indexRate),
|
|
262
270
|
protect: Number(req.protect ?? deps.voice.protect),
|
|
271
|
+
// 0 = 完全跟随原唱音量;1 = 完全用模型自己的(轻唱被唱满)。越界/NaN 一律退回配置值。
|
|
272
|
+
rmsMixRate: clamp01(req.rmsMixRate ?? deps.voice.rmsMixRate),
|
|
263
273
|
// 不传 pitch = 按配置默认(配置默认 'auto' = 按音域自动推荐)
|
|
264
274
|
pitch: req.pitch === undefined || req.pitch === 'auto'
|
|
265
275
|
? (deps.voice.pitch ?? 'auto')
|
|
@@ -308,6 +318,7 @@ export async function singSong(req: SingRequest, deps: SingDeps): Promise<SingRe
|
|
|
308
318
|
pitch: params.pitch,
|
|
309
319
|
index_rate: params.indexRate,
|
|
310
320
|
protect: params.protect,
|
|
321
|
+
rms_mix_rate: params.rmsMixRate,
|
|
311
322
|
});
|
|
312
323
|
let lastLog = 0;
|
|
313
324
|
const job = await deps.worker.wait(jobId, (p, msg) => {
|
package/src/world.ts
CHANGED
|
@@ -461,6 +461,7 @@ export class FishSingWorld implements World {
|
|
|
461
461
|
indexRate: Number(cfg.voice?.indexRate ?? 0.75),
|
|
462
462
|
protect: Number(cfg.voice?.protect ?? 0.33),
|
|
463
463
|
pitch: (cfg.voice?.pitch as number | 'auto' | undefined) ?? 'auto',
|
|
464
|
+
rmsMixRate: cfg.voice?.rmsMixRate === undefined ? 0 : Number(cfg.voice.rmsMixRate),
|
|
464
465
|
mode: cfg.voice?.mode === 'vocals' ? 'vocals' : 'full',
|
|
465
466
|
},
|
|
466
467
|
};
|
|
@@ -542,6 +543,11 @@ export class FishSingWorld implements World {
|
|
|
542
543
|
duration: { type: 'number', description: '唱多长(秒);配合 start 可只发一段' },
|
|
543
544
|
refresh: { type: 'boolean', description: '忽略缓存重唱一遍' },
|
|
544
545
|
search: { type: 'boolean', description: '只搜索不下载,返回候选列表(标题/时长/UP主/播放/BV)让你自己挑' },
|
|
546
|
+
rmsMixRate: {
|
|
547
|
+
type: 'number',
|
|
548
|
+
description: '音量跟随原唱的程度 0~1:0 = 完全跟随(轻唱/渐弱能还原,默认);'
|
|
549
|
+
+ '0.25 = 保留一点模型自己的动态;1 = 不跟随(轻唱会被唱满)。不确定就别传。',
|
|
550
|
+
},
|
|
545
551
|
pick: { type: 'string', description: '选定第几条:序号(从 1 开始)或 BV 号;配合 search 使用' },
|
|
546
552
|
order: {
|
|
547
553
|
type: 'string',
|
|
@@ -568,6 +574,7 @@ export class FishSingWorld implements World {
|
|
|
568
574
|
: String(args.pitch).toLowerCase() === 'auto' ? 'auto' : Number(args.pitch),
|
|
569
575
|
indexRate: args.indexRate === undefined ? undefined : Number(args.indexRate),
|
|
570
576
|
protect: args.protect === undefined ? undefined : Number(args.protect),
|
|
577
|
+
rmsMixRate: args.rmsMixRate === undefined ? undefined : Number(args.rmsMixRate),
|
|
571
578
|
start: args.start === undefined ? undefined : Number(args.start),
|
|
572
579
|
duration: args.duration === undefined ? undefined : Number(args.duration),
|
|
573
580
|
refresh: args.refresh === true,
|
package/tests/smoke.mjs
CHANGED
|
@@ -52,6 +52,14 @@ const t1 = parseTarget('2587509374');
|
|
|
52
52
|
check('裸号码 → 私聊', Boolean(t1) && t1.action === 'send_private_msg' && t1.params.user_id === 2587509374);
|
|
53
53
|
check('乱码 → null', parseTarget('2587509374abc') === null);
|
|
54
54
|
|
|
55
|
+
// ---- 6. 音量跟随:默认 0(跟随原唱),且配置里有这一项 ----
|
|
56
|
+
const { FISHSING_DEFAULTS, fishsingConfigGroups } = await import('../src/config.ts');
|
|
57
|
+
check('默认 rmsMixRate = 0', FISHSING_DEFAULTS.voice.rmsMixRate === 0);
|
|
58
|
+
const voiceGroup = fishsingConfigGroups().find((g) => g.id.endsWith('.voice'));
|
|
59
|
+
const key = Object.keys(voiceGroup.schema.properties).find((k) => k.endsWith('voice.rmsMixRate'));
|
|
60
|
+
check('配置项 voice.rmsMixRate 存在', Boolean(key));
|
|
61
|
+
check('配置项有说明文案', String(voiceGroup.schema.properties[key].description || '').length > 20);
|
|
62
|
+
|
|
55
63
|
if (failed) {
|
|
56
64
|
console.error(`\n${failed} 项失败`);
|
|
57
65
|
process.exit(1);
|
|
@@ -138,5 +138,28 @@ class AugmentWeightExpansion(unittest.TestCase):
|
|
|
138
138
|
self.assertAlmostEqual(ratio, 2 ** (semi / 12), places=3)
|
|
139
139
|
self.assertAlmostEqual(float(t.group(1)), 1 / ratio, places=3)
|
|
140
140
|
|
|
141
|
+
def test_rms_mix_default_follows_source(self):
|
|
142
|
+
# rms_mix_rate=0 才等于"音量跟随原唱";1 在 RVC 里是"不做对齐"(轻唱会被唱满)。
|
|
143
|
+
# 老版本默认 1.0 导致所有翻唱的渐弱消失,这里钉住默认值,别再改回去。
|
|
144
|
+
import inspect
|
|
145
|
+
for fn in (engine.SingEngine.convert, engine.SingEngine.song):
|
|
146
|
+
sig = inspect.signature(fn)
|
|
147
|
+
self.assertIn('rms_mix_rate', sig.parameters, f'{fn.__name__} 少了 rms_mix_rate')
|
|
148
|
+
self.assertEqual(sig.parameters['rms_mix_rate'].default, 0.0, f'{fn.__name__} 默认值应为 0.0')
|
|
149
|
+
|
|
150
|
+
def test_manifest_marks_optional_default_model(self):
|
|
151
|
+
# 出厂默认模型(dfy2 + 它的索引)是可选示例:用户换模型后删掉很常见,
|
|
152
|
+
# 不能因为缺它就把自检显示成"未就绪"。必需组件只有 hubert/rmvpe/两个底模。
|
|
153
|
+
import json, pathlib
|
|
154
|
+
m = json.loads(pathlib.Path('assets/models.manifest.json').read_text(encoding='utf-8'))
|
|
155
|
+
req = [f['target'] for f in m['files'] if f.get('required') is not False]
|
|
156
|
+
opt = [f['target'] for f in m['files'] if f.get('required') is False]
|
|
157
|
+
self.assertEqual(len(req), 4, f'必需组件应为 4 个,实际 {req}')
|
|
158
|
+
self.assertTrue(any('hubert' in t for t in req))
|
|
159
|
+
self.assertTrue(any('rmvpe' in t for t in req))
|
|
160
|
+
self.assertTrue(any('f0G40k' in t for t in req))
|
|
161
|
+
self.assertTrue(any('f0D40k' in t for t in req))
|
|
162
|
+
self.assertEqual(len(opt), 2, f'可选应为 dfy2 模型+索引两项,实际 {opt}')
|
|
163
|
+
|
|
141
164
|
if __name__ == "__main__":
|
|
142
165
|
unittest.main()
|
package/worker/engine.py
CHANGED
|
@@ -512,7 +512,7 @@ class SingEngine:
|
|
|
512
512
|
return out_sr, self._fit_length(audio, int(round(seg.shape[0] * out_sr / sr)))
|
|
513
513
|
|
|
514
514
|
def convert(self, src: Path, dst: Path, *, pitch: int = 0, index_rate: float = 0.75,
|
|
515
|
-
protect: float = 0.33, rms_mix_rate: float =
|
|
515
|
+
protect: float = 0.33, rms_mix_rate: float = 0.0,
|
|
516
516
|
progress: Optional[Callable[[float, str], None]] = None,
|
|
517
517
|
cancel: Optional[threading.Event] = None) -> dict:
|
|
518
518
|
"""把整段音频切片换声,返回 {sr, chunks, seconds}。"""
|
|
@@ -703,6 +703,7 @@ class SingEngine:
|
|
|
703
703
|
|
|
704
704
|
def song(self, src: Path, work: Path, *, separate: bool = True, mode: str = "full",
|
|
705
705
|
pitch: "int | str" = 0, index_rate: float = 0.75, protect: float = 0.33,
|
|
706
|
+
rms_mix_rate: float = 0.0,
|
|
706
707
|
progress: Optional[Callable[[float, str], None]] = None,
|
|
707
708
|
cancel: Optional[threading.Event] = None) -> dict:
|
|
708
709
|
"""
|
|
@@ -738,7 +739,7 @@ class SingEngine:
|
|
|
738
739
|
report(0.2, "加载模型" if not self.ready else "开始换声")
|
|
739
740
|
conv = work / "vocals_converted.wav"
|
|
740
741
|
info = self.convert(vocal_src, conv, pitch=pitch, index_rate=index_rate,
|
|
741
|
-
protect=protect,
|
|
742
|
+
protect=protect, rms_mix_rate=rms_mix_rate,
|
|
742
743
|
progress=lambda p, m: report(0.2 + 0.6 * p, m), cancel=cancel)
|
|
743
744
|
|
|
744
745
|
if mode == "vocals":
|
|
@@ -791,7 +792,7 @@ class SingEngine:
|
|
|
791
792
|
# -- 选模对比试听 -----------------------------------------------
|
|
792
793
|
|
|
793
794
|
def ab_test(self, test: Path, out_dir: Path, variants: list, *, pitch: int = 0,
|
|
794
|
-
index_rate: float = 0.75, protect: float = 0.33,
|
|
795
|
+
index_rate: float = 0.75, protect: float = 0.33, rms_mix_rate: float = 0.0,
|
|
795
796
|
progress: Optional[Callable[[float, str], None]] = None,
|
|
796
797
|
cancel: Optional[threading.Event] = None) -> dict:
|
|
797
798
|
"""
|
|
@@ -818,6 +819,7 @@ class SingEngine:
|
|
|
818
819
|
report((i + 0.25) / n, f"换声:{label}")
|
|
819
820
|
self.convert(
|
|
820
821
|
test, dst, pitch=pitch, index_rate=index_rate, protect=protect,
|
|
822
|
+
rms_mix_rate=rms_mix_rate,
|
|
821
823
|
progress=lambda p, m, _i=i, _n=n: report((_i + 0.25 + 0.7 * p) / _n, m),
|
|
822
824
|
cancel=cancel,
|
|
823
825
|
)
|
package/worker/server.py
CHANGED
|
@@ -124,6 +124,8 @@ def run_job(jid: str, kind: str, params: dict, cancel: threading.Event) -> dict:
|
|
|
124
124
|
pitch=params.get("pitch", 0),
|
|
125
125
|
index_rate=float(params.get("index_rate", 0.75)),
|
|
126
126
|
protect=float(params.get("protect", 0.33)),
|
|
127
|
+
# 0 = 音量完全跟随原唱(轻唱不会被唱满);老版本传 1.0 = 不跟随
|
|
128
|
+
rms_mix_rate=float(params.get("rms_mix_rate", 0.0)),
|
|
127
129
|
progress=progress,
|
|
128
130
|
cancel=cancel,
|
|
129
131
|
)
|
|
@@ -138,6 +140,7 @@ def run_job(jid: str, kind: str, params: dict, cancel: threading.Event) -> dict:
|
|
|
138
140
|
pitch=int(params.get("pitch", 0)),
|
|
139
141
|
index_rate=float(params.get("index_rate", 0.75)),
|
|
140
142
|
protect=float(params.get("protect", 0.33)),
|
|
143
|
+
rms_mix_rate=float(params.get("rms_mix_rate", 0.0)),
|
|
141
144
|
progress=progress, cancel=cancel,
|
|
142
145
|
)
|
|
143
146
|
|
|
@@ -149,6 +152,7 @@ def run_job(jid: str, kind: str, params: dict, cancel: threading.Event) -> dict:
|
|
|
149
152
|
pitch=int(params.get("pitch", 0)),
|
|
150
153
|
index_rate=float(params.get("index_rate", 0.75)),
|
|
151
154
|
protect=float(params.get("protect", 0.33)),
|
|
155
|
+
rms_mix_rate=float(params.get("rms_mix_rate", 0.0)),
|
|
152
156
|
progress=progress, cancel=cancel,
|
|
153
157
|
)
|
|
154
158
|
|