Views
No views yet
*.tflite (root)onnx/*.onnxcheckpoints/*.pth| Model | DPRNN blocks | Params (M) | MACs (G) |
|---|---|---|---|
dpdfnet2_8khz | 2 | 2.51 | 1.29 |
dpdfnet8_8khz | 8 | 3.56 | 3.99 |
| Model | DPRNN blocks | Params (M) | MACs (G) |
|---|---|---|---|
baseline | 0 | 2.31 | 0.36 |
dpdfnet2 | 2 | 2.49 | 1.35 |
dpdfnet4 | 4 | 2.84 | 2.36 |
dpdfnet8 | 8 | 3.54 | 4.37 |
| Model | DPRNN blocks | Params (M) | MACs (G) |
|---|---|---|---|
dpdfnet2_48khz_hr | 2 | 2.58 | 2.42 |
dpdfnet8_48khz_hr | 8 | 3.63 | 7.17 |
pip install dpdfnet1# Enhance one file
2dpdfnet enhance noisy.wav enhanced.wav --model dpdfnet4
3
4# Enhance a directory (uses all CPU cores by default)
5dpdfnet enhance-dir ./noisy_wavs ./enhanced_wavs --model dpdfnet2
6
7# Enhance a directory with a fixed worker count
8dpdfnet enhance-dir ./noisy_wavs ./enhanced_wavs --model dpdfnet2 --workers 4
9
10# Download models
11dpdfnet download
12dpdfnet download dpdfnet8
13dpdfnet download dpdfnet4 --force1import soundfile as sf
2import dpdfnet
3
4# In-memory enhancement:
5audio, sr = sf.read("noisy.wav")
6enhanced = dpdfnet.enhance(audio, sample_rate=sr, model="dpdfnet4")
7sf.write("enhanced.wav", enhanced, sr)
8
9# Enhance one file:
10out_path = dpdfnet.enhance_file("noisy.wav", model="dpdfnet2")
11print(out_path)
12
13# Model listing:
14for row in dpdfnet.available_models():
15 print(row["name"], row["ready"], row["cached"])
16
17# Download models:
18dpdfnet.download() # All models
19dpdfnet.download("dpdfnet4") # Specific modelsounddevice (not included in dpdfnet dependencies):pip install sounddeviceStreamEnhancer processes audio chunk-by-chunk, preserving RNN state across
calls. Any chunk size works; enhanced samples are returned as soon as enough
data has accumulated for the first model frame (20 ms).1import numpy as np
2import sounddevice as sd
3import dpdfnet
4
5INPUT_SR = 48000
6# Use one model hop (10 ms) as the block size so process() returns
7# exactly one hop's worth of enhanced audio on every callback.
8BLOCK_SIZE = int(INPUT_SR * 0.010) # 480 samples at 48 kHz
9
10enhancer = dpdfnet.StreamEnhancer(model="dpdfnet2_48khz_hr")
11
12def callback(indata, outdata, frames, time, status):
13 mono_in = indata[:, 0] if indata.ndim > 1 else indata.ravel()
14 enhanced = enhancer.process(mono_in, sample_rate=INPUT_SR)
15 n = min(len(enhanced), frames)
16 outdata[:n, 0] = enhanced[:n]
17 if n < frames:
18 outdata[n:] = 0.0 # silence while the first window accumulates
19
20with sd.Stream(
21 samplerate=INPUT_SR,
22 blocksize=BLOCK_SIZE,
23 channels=1,
24 dtype="float32",
25 callback=callback,
26):
27 print("Enhancing microphone input - press Ctrl+C to stop")
28 try:
29 while True:
30 sd.sleep(100)
31 except KeyboardInterrupt:
32 pass
33
34# Optional: drain the final partial window at the end of a recording
35tail = enhancer.flush()[!NOTE] Latency
The first enhanced output arrives after one full model window (~20 ms) has been buffered. All subsequent blocks are returned with ~10 ms additional delay.Sample rate
StreamEnhancerresamples internally. Pass your device's native rate assample_rate; the return value is at the same rate.Block size
UsingBLOCK_SIZE = int(SR * 0.010)(one model hop) gives one enhanced block per callback. Other sizes also work but may produce empty returns while the buffer fills.Multiple streams
Create a separateStreamEnhancerper stream. Callenhancer.reset()between independent audio segments to clear RNN state.
1@article{rika2025dpdfnet,
2 title = {DPDFNet: Boosting DeepFilterNet2 via Dual-Path RNN},
3 author = {Rika, Daniel and Sapir, Nino and Gus, Ido},
4 year = {2025}
5}