-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck_deecho_config.py
More file actions
130 lines (106 loc) · 3.69 KB
/
check_deecho_config.py
File metadata and controls
130 lines (106 loc) · 3.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
回声处理配置验证脚本
检查当前配置是否正确启用了激进的去回声处理
"""
import json
import os
from pathlib import Path
def check_deecho_models():
"""检查 DeEcho 模型是否存在"""
print("=" * 60)
print("检查 DeEcho 模型")
print("=" * 60)
models_dir = Path("assets/uvr5_weights")
required_models = [
"VR-DeEchoDeReverb.pth",
"VR-DeEchoAggressive.pth",
"VR-DeEchoNormal.pth",
"onnx_dereverb_By_FoxJoy"
]
all_found = True
for model in required_models:
model_path = models_dir / model
exists = model_path.exists()
status = "[OK]" if exists else "[NO]"
size = ""
if exists:
if model_path.is_file():
size_mb = model_path.stat().st_size / (1024 * 1024)
size = f" ({size_mb:.1f} MB)"
else:
size = " (目录)"
print(f"{status} {model}{size}")
if not exists:
all_found = False
print()
if all_found:
print("[OK] All DeEcho models ready")
else:
print("[NO] Missing models, run: python tools/download_models.py")
return all_found
def check_config():
"""检查配置文件"""
print("\n" + "=" * 60)
print("检查配置文件")
print("=" * 60)
config_path = Path("configs/config.json")
with open(config_path, 'r', encoding='utf-8') as f:
config = json.load(f)
cover_config = config.get("cover", {})
# 检查关键配置
checks = [
("VC 预处理模式", "vc_preprocess_mode", "auto", cover_config.get("vc_preprocess_mode")),
("源约束模式", "source_constraint_mode", "auto", cover_config.get("source_constraint_mode")),
("Karaoke 分离", "karaoke_separation", True, cover_config.get("karaoke_separation")),
("索引率", "index_rate", 0.50, cover_config.get("index_rate")),
("保护系数", "protect", 0.33, cover_config.get("protect")),
]
all_correct = True
for name, key, expected, actual in checks:
match = actual == expected
status = "[OK]" if match else "[NO]"
print(f"{status} {name} ({key}): {actual} {'==' if match else '!='} {expected}")
if not match:
all_correct = False
print()
if all_correct:
print("[OK] Config optimized for aggressive deecho")
else:
print("[WARN] Some configs not optimized")
return all_correct
def print_recommendations():
"""打印使用建议"""
print("\n" + "=" * 60)
print("使用建议")
print("=" * 60)
print("""
1. 当前配置使用自动模式:
- 优先使用 UVR DeEcho 模型,缺模型时回退到算法去混响
- DeEcho 质量好时跳过 blend 直接使用,避免混回原始回音
- 源约束仅在去过回音的预处理下自动启用
2. 如果回声仍然明显,可以尝试:
- 在 UI 中调整"索引率"(降低到 0.2-0.3)
- 在 UI 中调整"保护系数"(降低到 0.2-0.25)
- 使用更高质量的输入音频
3. 处理流程:
原始音频 → Karaoke 分离 → UVR DeEcho(或算法去混响) → RVC 转换 → 输出
4. 测试建议:
- 选择一首有明显回声的歌曲
- 查看日志中 DeEcho quality 指标
- 对比处理前后的回声强度
""")
def main():
print("\n回声处理配置验证\n")
models_ok = check_deecho_models()
config_ok = check_config()
print_recommendations()
print("\n" + "=" * 60)
if models_ok and config_ok:
print("[OK] System ready for testing")
else:
print("[WARN] Please fix issues above")
print("=" * 60 + "\n")
if __name__ == "__main__":
main()