zipenhancer 0.1.0__tar.gz
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.
- zipenhancer-0.1.0/LICENSE +21 -0
- zipenhancer-0.1.0/PKG-INFO +391 -0
- zipenhancer-0.1.0/README.md +369 -0
- zipenhancer-0.1.0/pyproject.toml +32 -0
- zipenhancer-0.1.0/setup.cfg +4 -0
- zipenhancer-0.1.0/tests/test_codec.py +184 -0
- zipenhancer-0.1.0/tests/test_denoise.py +212 -0
- zipenhancer-0.1.0/tests/test_gate.py +359 -0
- zipenhancer-0.1.0/tests/test_package_smoke.py +157 -0
- zipenhancer-0.1.0/zipenhancer/__init__.py +32 -0
- zipenhancer-0.1.0/zipenhancer/codec.py +524 -0
- zipenhancer-0.1.0/zipenhancer/denoise.py +144 -0
- zipenhancer-0.1.0/zipenhancer/models/__init__.py +4 -0
- zipenhancer-0.1.0/zipenhancer/models/layers/__init__.py +4 -0
- zipenhancer-0.1.0/zipenhancer/models/layers/generator.py +215 -0
- zipenhancer-0.1.0/zipenhancer/models/layers/scaling.py +412 -0
- zipenhancer-0.1.0/zipenhancer/models/layers/zipenhancer_layer.py +500 -0
- zipenhancer-0.1.0/zipenhancer/models/layers/zipformer.py +1035 -0
- zipenhancer-0.1.0/zipenhancer/models/zipenhancer.py +225 -0
- zipenhancer-0.1.0/zipenhancer/standalone.py +164 -0
- zipenhancer-0.1.0/zipenhancer.egg-info/PKG-INFO +391 -0
- zipenhancer-0.1.0/zipenhancer.egg-info/SOURCES.txt +23 -0
- zipenhancer-0.1.0/zipenhancer.egg-info/dependency_links.txt +1 -0
- zipenhancer-0.1.0/zipenhancer.egg-info/requires.txt +13 -0
- zipenhancer-0.1.0/zipenhancer.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 gao yi jun
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,391 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: zipenhancer
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: 语音降噪核心库 — ZipEnhancer/FRCRN/MossFormer2 纯 PyTorch 推理
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
Project-URL: homepage, https://github.com/gyj1201/zipEnhancer
|
|
7
|
+
Requires-Python: >=3.9
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Requires-Dist: torch>=2.0
|
|
11
|
+
Requires-Dist: numpy
|
|
12
|
+
Requires-Dist: librosa
|
|
13
|
+
Requires-Dist: soundfile
|
|
14
|
+
Provides-Extra: modelscope
|
|
15
|
+
Requires-Dist: modelscope; extra == "modelscope"
|
|
16
|
+
Provides-Extra: server
|
|
17
|
+
Requires-Dist: fastapi; extra == "server"
|
|
18
|
+
Requires-Dist: uvicorn; extra == "server"
|
|
19
|
+
Requires-Dist: python-multipart; extra == "server"
|
|
20
|
+
Requires-Dist: python-dotenv; extra == "server"
|
|
21
|
+
Dynamic: license-file
|
|
22
|
+
|
|
23
|
+
<div align="center">
|
|
24
|
+
|
|
25
|
+
<pre>
|
|
26
|
+
______ _____ _
|
|
27
|
+
|__ (_)_ __ | ____|_ __ | |__ __ _ _ __ ___ ___ _ __
|
|
28
|
+
/ /| | '_ \| _| | '_ \| '_ \ / _` | '_ \ / __/ _ \ '__|
|
|
29
|
+
/ /_| | |_) | |___| | | | | | | (_| | | | | (_| __/ |
|
|
30
|
+
/____|_| .__/|_____|_| |_|_| |_|\__,_|_| |_|\___\___|_|
|
|
31
|
+
|_|
|
|
32
|
+
</pre>
|
|
33
|
+
|
|
34
|
+
</div>
|
|
35
|
+
|
|
36
|
+
<p align="center">
|
|
37
|
+
<a href="https://www.python.org/"><img src="https://img.shields.io/badge/python-3.10-blue" alt="Python 3.10"></a>
|
|
38
|
+
<a href="https://fastapi.tiangolo.com/"><img src="https://img.shields.io/badge/FastAPI-0.115+-teal" alt="FastAPI"></a>
|
|
39
|
+
<a href="https://pytorch.org/"><img src="https://img.shields.io/badge/PyTorch-2.0+-ee4c2c" alt="PyTorch"></a>
|
|
40
|
+
<a href="https://github.com/gyj1201/zipEnhancer/blob/master/LICENSE"><img src="https://img.shields.io/badge/license-MIT-green" alt="MIT License"></a>
|
|
41
|
+
<a href="https://www.docker.com/"><img src="https://img.shields.io/badge/Docker-支持-2496ed" alt="Docker"></a>
|
|
42
|
+
<a href="https://modelscope.cn/models/iic/speech_zipenhancer_ans_multiloss_16k_base"><img src="https://img.shields.io/badge/ModelScope-达摩院-6240ff" alt="ModelScope"></a>
|
|
43
|
+
</p>
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
### 做了什么
|
|
48
|
+
|
|
49
|
+
- **模型剥离** — 从 ModelScope 黑盒 pipeline 中提取出 ZipEnhancer,用原生 PyTorch 加载权重推理,不再依赖 pipeline 封装
|
|
50
|
+
- **FP16 半精度推理** — 仅模型计算部分使用 FP16,STFT/iSTFT 保持 FP32 避免 cuFFT 精度问题,显存占用降低 ~40%
|
|
51
|
+
- **长音频分段** — 4s 滑动窗口 + 75% 重叠的 overlap-add 策略,支持任意时长音频,彻底解决 CUDA OOM
|
|
52
|
+
- **多模型切换** — 同时支持 ZipEnhancer(轻量)、FRCRN(实时)、MossFormer2(高质)三种模型
|
|
53
|
+
- **声道/位深保持** — 立体声输入 → 立体声输出,32-bit float / 16-bit PCM 自动适配
|
|
54
|
+
|
|
55
|
+
### 它能做什么?
|
|
56
|
+
|
|
57
|
+
- 清除录音中的**环境噪声**(空调声、风扇声、键盘声、街道噪音等)
|
|
58
|
+
- 支持**单文件**和**批量处理**两种模式
|
|
59
|
+
- 多种降噪模型**一键切换**
|
|
60
|
+
- GPU 加速,实时率可达 **20x 以上**(RTX 4090)
|
|
61
|
+
|
|
62
|
+
无需 ModelScope pipeline 黑盒,一行命令启动服务,适合集成到语音处理流程、会议录音后处理、音频预处理管道等场景。
|
|
63
|
+
|
|
64
|
+
<!-- 效果演示暂时关闭,后续找到合适的方案再说
|
|
65
|
+
## 效果演示
|
|
66
|
+
|
|
67
|
+
两个测试样本的降噪前后对比(默认模型,全力降噪):
|
|
68
|
+
|
|
69
|
+
| 样本 | 原始带噪 | 降噪后 |
|
|
70
|
+
|------|---------|--------|
|
|
71
|
+
| 样本 1 | [▶ 播放](https://raw.githubusercontent.com/gyj1201/zipEnhancer/master/demo/mp3_audio/speech_with_noise.mp4) | [▶ 播放](https://raw.githubusercontent.com/gyj1201/zipEnhancer/master/demo/mp3_audio/speech_with_noise_denoised.mp4) |
|
|
72
|
+
| 样本 2 | [▶ 播放](https://raw.githubusercontent.com/gyj1201/zipEnhancer/master/demo/mp3_audio/speech_with_noise1.mp4) | [▶ 播放](https://raw.githubusercontent.com/gyj1201/zipEnhancer/master/demo/mp3_audio/speech_with_noise1_denoised.mp4) |
|
|
73
|
+
|
|
74
|
+
> 测试音频来自 [ModelScope 官方 demo](https://www.modelscope.cn/models/iic/speech_zipenhancer_ans_multiloss_16k_base/summary)。
|
|
75
|
+
-->
|
|
76
|
+
|
|
77
|
+
## 快速开始
|
|
78
|
+
|
|
79
|
+
### 方式一:手动部署
|
|
80
|
+
|
|
81
|
+
**1. 创建虚拟环境**
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
conda create -n zipenhancer python=3.10 -y
|
|
85
|
+
conda activate zipenhancer
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
**2. 安装依赖**
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
pip install -r requirements.txt
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
GPU 加速(NVIDIA 显卡,**先于上一步**安装 CUDA 版 PyTorch):
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
pip install torch torchaudio --index-url https://download.pytorch.org/whl/cu124
|
|
98
|
+
pip install -r requirements.txt
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
**3. 配置**
|
|
102
|
+
|
|
103
|
+
复制 `.env.example` 为 `.env`,按需求修改:
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
cp .env.example .env
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
**4. 启动**
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
uvicorn app:app --host 0.0.0.0 --port 8765
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### 方式二:Docker 部署
|
|
116
|
+
|
|
117
|
+
**1. 前置条件**
|
|
118
|
+
|
|
119
|
+
安装 [Docker](https://docs.docker.com/engine/install/) 和 [NVIDIA Container Toolkit](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html)。
|
|
120
|
+
|
|
121
|
+
**2. 构建并启动**
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
# 从 docker/ 目录启动
|
|
125
|
+
cd docker
|
|
126
|
+
docker compose up -d
|
|
127
|
+
|
|
128
|
+
# 或从项目根目录直接运行
|
|
129
|
+
docker run --gpus all -p 8765:8765 zipenhancer:latest
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
所有依赖和模型已在构建时下载,启动即用,无需额外等待。
|
|
133
|
+
|
|
134
|
+
## API 接口
|
|
135
|
+
|
|
136
|
+
### 健康检查
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
curl http://127.0.0.1:8765/health
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+

|
|
143
|
+
|
|
144
|
+
### 查看可用模型
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
curl http://127.0.0.1:8765/models
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+

|
|
151
|
+
|
|
152
|
+
### 语音降噪(单个文件)
|
|
153
|
+
|
|
154
|
+
上传音频文件,指定输出文件夹,降噪后的文件自动保存到该目录。
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
curl -X POST http://127.0.0.1:8765/denoise ^
|
|
158
|
+
-F "file=@input.wav" ^
|
|
159
|
+
-F "output_dir=./output" ^
|
|
160
|
+
-F "output_format=mp3" ^
|
|
161
|
+
-F "bitrate=192k" ^
|
|
162
|
+
-F "strength=0.7"
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
**参数说明:**
|
|
166
|
+
|
|
167
|
+
| 参数 | 必填 | 说明 |
|
|
168
|
+
|------|------|------|
|
|
169
|
+
| `file` | 是 | 音频文件(wav/mp3/m4a/flac/ogg) |
|
|
170
|
+
| `output_dir` | 是 | 输出文件夹路径 |
|
|
171
|
+
| `model` | 否 | 模型名称(默认 .env 中配置) |
|
|
172
|
+
| `normalize` | 否 | 是否自动音量归一化(默认 true) |
|
|
173
|
+
| `target_sr` | 否 | 输出采样率,0=保持原始采样率(默认 0) |
|
|
174
|
+
| `output_format` | 否 | 输出格式: wav / flac / mp3 / ogg(默认 wav) |
|
|
175
|
+
| `bitrate` | 否 | 比特率,仅 mp3/ogg,如 "192k" |
|
|
176
|
+
| `compression_level` | 否 | 压缩级别,仅 flac (0-8) |
|
|
177
|
+
| `strength` | 否 | 降噪强度 0.0~1.0(默认 1.0=全力降噪) |
|
|
178
|
+
|
|
179
|
+
**返回结果:**
|
|
180
|
+
|
|
181
|
+
```json
|
|
182
|
+
{
|
|
183
|
+
"code": 0,
|
|
184
|
+
"message": "success",
|
|
185
|
+
"data": {
|
|
186
|
+
"output_path": "./output/input_denoised.mp3",
|
|
187
|
+
"sample_rate": 48000,
|
|
188
|
+
"output_format": "mp3",
|
|
189
|
+
"output_subtype": "mp3_mf",
|
|
190
|
+
"bitrate": "192k",
|
|
191
|
+
"compression": null,
|
|
192
|
+
"processing_time": "0.62s",
|
|
193
|
+
"real_time_factor": "22.0x",
|
|
194
|
+
"model": "iic/speech_zipenhancer_ans_multiloss_16k_base",
|
|
195
|
+
"strength": 1.0
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+

|
|
201
|
+
|
|
202
|
+
### 语音降噪(批量处理)
|
|
203
|
+
|
|
204
|
+
扫描输入文件夹中的所有音频文件,逐个降噪并保存到输出文件夹。
|
|
205
|
+
|
|
206
|
+
```bash
|
|
207
|
+
curl -X POST http://127.0.0.1:8765/denoise/batch ^
|
|
208
|
+
-F "input_dir=./input_folder" ^
|
|
209
|
+
-F "output_dir=./output_folder"
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
**参数说明:**
|
|
213
|
+
|
|
214
|
+
| 参数 | 必填 | 说明 |
|
|
215
|
+
|------|------|------|
|
|
216
|
+
| `input_dir` | 是 | 输入文件夹路径 |
|
|
217
|
+
| `output_dir` | 是 | 输出文件夹路径 |
|
|
218
|
+
| `model` | 否 | 模型名称(默认 .env 中配置) |
|
|
219
|
+
| `normalize` | 否 | 是否自动音量归一化(默认 true) |
|
|
220
|
+
| `target_sr` | 否 | 输出采样率,0=保持原始采样率(默认 0) |
|
|
221
|
+
| `output_format` | 否 | 输出格式: wav / flac / mp3 / ogg(默认 wav) |
|
|
222
|
+
| `bitrate` | 否 | 比特率,仅 mp3/ogg,如 "192k" |
|
|
223
|
+
| `compression_level` | 否 | 压缩级别,仅 flac (0-8) |
|
|
224
|
+
| `strength` | 否 | 降噪强度 0.0~1.0(默认 1.0=全力降噪) |
|
|
225
|
+
|
|
226
|
+
**返回结果:**
|
|
227
|
+
|
|
228
|
+
```json
|
|
229
|
+
{
|
|
230
|
+
"code": 0,
|
|
231
|
+
"message": "success",
|
|
232
|
+
"data": {
|
|
233
|
+
"input_dir": "./input_folder",
|
|
234
|
+
"output_dir": "./output_folder",
|
|
235
|
+
"total": 10,
|
|
236
|
+
"success": 10,
|
|
237
|
+
"failed": 0,
|
|
238
|
+
"total_time": "5.23s",
|
|
239
|
+
"model": "iic/speech_zipenhancer_ans_multiloss_16k_base",
|
|
240
|
+
"strength": 1.0,
|
|
241
|
+
"output_format": "flac",
|
|
242
|
+
"results": [
|
|
243
|
+
{
|
|
244
|
+
"filename": "audio1.wav",
|
|
245
|
+
"output_path": "./output_folder/audio1_denoised.flac",
|
|
246
|
+
"sample_rate": 48000,
|
|
247
|
+
"output_format": "flac",
|
|
248
|
+
"output_subtype": "PCM_16",
|
|
249
|
+
"compression": 5,
|
|
250
|
+
"processing_time": "0.52s",
|
|
251
|
+
"real_time_factor": "28.0x",
|
|
252
|
+
"status": "success"
|
|
253
|
+
}
|
|
254
|
+
]
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
### 输出格式说明
|
|
260
|
+
|
|
261
|
+
输出文件会尽可能保留原始音频的参数:
|
|
262
|
+
- **采样率**:默认与原始文件一致(传 `target_sr` 可覆盖)
|
|
263
|
+
- **声道数**:立体声输入 → 立体声输出,单声道输入 → 单声道输出
|
|
264
|
+
- **位深**:32-bit float 输入 → 32-bit float 输出,16-bit → 16-bit
|
|
265
|
+
- **输出格式**:可通过 `output_format` 参数选择
|
|
266
|
+
|
|
267
|
+
#### 格式支持矩阵
|
|
268
|
+
|
|
269
|
+
| 格式 | 编码选项 | 压缩率参考 | 依赖 |
|
|
270
|
+
|------|---------|-----------|------|
|
|
271
|
+
| WAV | PCM_16 / PCM_24 / PCM_32 / FLOAT | 无损(基准) | soundfile |
|
|
272
|
+
| FLAC | PCM_16 / PCM_24,compression 0-8 | ~40-60% | soundfile |
|
|
273
|
+
| MP3 | 32-320 kbps | ~15-25% | ffmpeg |
|
|
274
|
+
| OGG Opus | 6-510 kbps | ~15-25% | ffmpeg |
|
|
275
|
+
|
|
276
|
+
> 压缩率参考基于 48kHz 16-bit 单声道音频,实际因内容而异。
|
|
277
|
+
> MP3/OGG 依赖 ffmpeg,系统未安装时将返回错误。
|
|
278
|
+
> FLAC 输出时不支持的编码(FLOAT/DOUBLE/PCM_32)自动降级为 PCM_16。
|
|
279
|
+
|
|
280
|
+
### 切换模型
|
|
281
|
+
|
|
282
|
+
```bash
|
|
283
|
+
curl -X POST http://127.0.0.1:8765/denoise ^
|
|
284
|
+
-F "file=@input.wav" ^
|
|
285
|
+
-F "output_dir=./output" ^
|
|
286
|
+
-F "model=iic/speech_frcrn_ans_cirm_16k"
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
## 可用模型
|
|
290
|
+
|
|
291
|
+
| 模型 ID | 说明 |
|
|
292
|
+
|---------|------|
|
|
293
|
+
| `iic/speech_zipenhancer_ans_multiloss_16k_base` | ZipEnhancer(轻量) |
|
|
294
|
+
| `iic/speech_frcrn_ans_cirm_16k` | FRCRN(实时降噪) |
|
|
295
|
+
| `iic/speech_mossformer2_ans_48k` | MossFormer2(高质量) |
|
|
296
|
+
|
|
297
|
+
## Roadmap
|
|
298
|
+
|
|
299
|
+
### 已完成
|
|
300
|
+
- [x] 单文件语音降噪
|
|
301
|
+
- [x] 批量文件语音降噪
|
|
302
|
+
- [x] 多模型切换(ZipEnhancer / FRCRN / MossFormer2)
|
|
303
|
+
- [x] 音量归一化
|
|
304
|
+
- [x] 自定义输出采样率
|
|
305
|
+
- [x] 声道/位深保持
|
|
306
|
+
- [x] FP16 半精度推理
|
|
307
|
+
|
|
308
|
+
### 计划中
|
|
309
|
+
|
|
310
|
+
#### P0 — 短期(完成)
|
|
311
|
+
- [x] Docker 一键部署(多阶段构建、GPU 直通、健康检查、优雅关闭)
|
|
312
|
+
- [x] 输出格式选择(WAV / MP3 / FLAC / OGG,编码参数可配)
|
|
313
|
+
- [x] 降噪强度控制(频域掩码指数,0~100% 可调) 论文参考:DeepFilterNet Base
|
|
314
|
+
|
|
315
|
+
### P1 — 中期(4-6 个月)
|
|
316
|
+
- [ ] Noise Gate(Attack / Release / Hold / Hysteresis / Look-ahead)
|
|
317
|
+
- [ ] 残差监听(延迟对齐 + 位深统一,输出原始与降噪的差值信号)
|
|
318
|
+
- [ ] 频段选择降噪(Linkwitz-Riley 分频,各频段独立降噪强度)
|
|
319
|
+
- [ ] VAD 自动静音切除(Silero VAD + 状态机 + 自适应阈值 + Cross-fade 拼接)
|
|
320
|
+
|
|
321
|
+
### P2 — 中后期(5-7 个月)
|
|
322
|
+
- [ ] 噪声轮廓学习(基于 VAD 的自适应谱减法后处理、音乐噪声抑制)
|
|
323
|
+
- [ ] 质量评估指标(PESQ / STOI / Si-SNR / DNSMOS,离线评测管线)
|
|
324
|
+
- [ ] 音频格式转换(ffmpeg 封装,格式兼容矩阵,元数据透传)
|
|
325
|
+
|
|
326
|
+
### P3 — 长期
|
|
327
|
+
- [ ] 异步任务 + 进度查询(2-3 个月,任务持久化、队列调度、Worker 池、Webhook)
|
|
328
|
+
- [ ] 去混响(4-8 个月,WPE + DNN,场景分类 + 参数矩阵)
|
|
329
|
+
- [ ] 实时流式降噪(4-8 个月,WebSocket + 因果模型 + Jitter Buffer + AEC)
|
|
330
|
+
|
|
331
|
+
### 需要前端、CLI协助
|
|
332
|
+
- [ ] CLI 命令行工具(多命令、管道、进度条、配置文件)
|
|
333
|
+
- [ ] 输入音频信息预览(波形峰值、LUFS 响度、削波检测、完整性校验)
|
|
334
|
+
- [ ] Web UI 界面(3-4 个月,拖拽上传 + 波形/频谱可视化 + 在线试听 + Before/After 对比)
|
|
335
|
+
|
|
336
|
+
### 已评估放弃
|
|
337
|
+
- ~~超分(低采样率 → 高采样率)~~ — 研究级难题,和降噪正交
|
|
338
|
+
- ~~模型量化 int8~~ — 模型架构(自定义算子)不支持
|
|
339
|
+
- ~~语音识别(ASR)~~ — 另一个产品领域
|
|
340
|
+
- ~~说话人分离~~ — 重叠说话人问题当前无工业级开源方案
|
|
341
|
+
|
|
342
|
+
|
|
343
|
+
## 项目结构
|
|
344
|
+
|
|
345
|
+
```
|
|
346
|
+
├── app.py # FastAPI 服务主程序
|
|
347
|
+
├── log.py # 日志管理模块
|
|
348
|
+
├── API.md # API 接口文档(含 curl 测试示例)
|
|
349
|
+
├── zipenhancer/ # 降噪核心包
|
|
350
|
+
│ ├── __init__.py
|
|
351
|
+
│ ├── codec.py # 音频编码模块(WAV/FLAC/MP3/OGG)
|
|
352
|
+
│ ├── denoise.py # 降噪核心函数
|
|
353
|
+
│ ├── standalone.py # 剥离版推理(纯 PyTorch)
|
|
354
|
+
│ ├── models/ # 模型架构
|
|
355
|
+
│ │ ├── zipenhancer.py
|
|
356
|
+
│ │ └── layers/
|
|
357
|
+
│ │ ├── generator.py
|
|
358
|
+
│ │ ├── scaling.py
|
|
359
|
+
│ │ ├── zipenhancer_layer.py
|
|
360
|
+
│ │ └── zipformer.py
|
|
361
|
+
│ └── configs/
|
|
362
|
+
│ └── configuration.json
|
|
363
|
+
├── docs/
|
|
364
|
+
│ ├── index.html # GitHub Pages 降噪对比页面
|
|
365
|
+
│ └── mp3_audio/ # GitHub Pages 播放用 MP4 音频
|
|
366
|
+
├── tests/ # 测试
|
|
367
|
+
│ ├── conftest.py
|
|
368
|
+
│ ├── test_codec.py
|
|
369
|
+
│ ├── test_denoise.py
|
|
370
|
+
│ ├── generate_test_data.py
|
|
371
|
+
│ └── audio/ # 测试音频文件
|
|
372
|
+
├── images/ # README 截图
|
|
373
|
+
├── requirements.txt # 依赖列表
|
|
374
|
+
├── LICENSE # MIT 开源许可证
|
|
375
|
+
├── .env # 环境配置(不上传)
|
|
376
|
+
├── .env.example # 环境配置模板
|
|
377
|
+
├── .gitignore # Git 忽略规则
|
|
378
|
+
├── README.md # 使用文档
|
|
379
|
+
└── logs/ # 日志输出目录
|
|
380
|
+
├── app/ # 全部日志
|
|
381
|
+
└── error/ # 错误日志
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
## Credits
|
|
385
|
+
|
|
386
|
+
- 降噪模型:[阿里达摩院 ZipEnhancer](https://modelscope.cn/models/iic/speech_zipenhancer_ans_multiloss_16k_base)(Apache 2.0)
|
|
387
|
+
- 模型提取参考:[boreas-l/zipEnhancer](https://github.com/boreas-l/zipEnhancer)
|
|
388
|
+
|
|
389
|
+
## License
|
|
390
|
+
|
|
391
|
+
[MIT](LICENSE) © 2024 gao yi jun
|