DeepFilterNet Neural Echo Cancellation: ERB Filterbanks & Complex Deep Filtering
Ollama Modal Top-10 Feature #3: DeepFilterNet Neural Echo Cancellation · Category: Neural Audio DSP & Psychoacoustics · Paired 3D Simulation: Scene 126
Explore how modern real-time neural audio pipelines combine psychoacoustic Equivalent Rectangular Bandwidth (ERB) envelope masking with multi-frame complex STFT filtering to achieve 38+ dB ERLE in <10 ms.
Governing Physical Equation: ERB(f) = 24.7·(4.37·f_kHz + 1), Y(k, f) = ∑_{i=-N}^{N} W_i*(k, f) · X(k - i, f)
5-Stage Theoretical & DSP Curriculum
- Stage 1: Vorbis-Windowed 48 kHz STFT Framing (20 ms Window, 10 ms Hop)
Sample raw 48 kHz audio into 960-sample frames with 50% overlap (480-sample / 10 ms hop) using a power-complementary Vorbis window w[n] = sin( (π/2)·sin²(πn/N) ). Satisfies the Princen-Bradley Perfect Reconstruction condition w²[n] + w²[n + N/2] = 1 with zero algorithmic synthesis distortion.
X(k, f) = ∑_{n=0}^{N-1} x[k·H + n] · w[n] · e^{-j 2π f n / N} - Stage 2: 32-Band Equivalent Rectangular Bandwidth (ERB) Compression
Group the 481 positive FFT frequency bins into 32 perceptual ERB bands matching human cochlear critical bands: ERB(f) = 24.7(4.37·f_kHz + 1). Reduces neural network input dimensionality by 15× (from 481 bins to 32 bands), allowing lightweight GRU layers to run in <1.8 ms on embedded ARM64 CPUs.
z_ERB(f) = 21.4 · log10(1 + 0.00437 · f_Hz) - Stage 3: Stage-1 GRU Spectral Envelope Gain Masking
A real-valued encoder-decoder predicts 32 ERB band gains G_ERB(k, b) ∈ [0, 1], which are interpolated back to 481 bins and multiplied with X(k, f). Suppresses broadband stationary and non-stationary noise between formants without altering the fine phase structure.
X_env(k, f) = G_interp(k, f) · X(k, f) - Stage 4: Stage-2 Multi-Frame Complex Deep Filtering (< 5 kHz)
For voiced frequencies below 5 kHz (F_df = 96 bins), a second network predicts a 5-tap complex FIR filter W_i(k, f) across time frames k-4..k. Reconstructs the periodic harmonic comb structure of human pitch (f0 = 85–300 Hz) and cancels inter-harmonic reverberation and acoustic echo that real-valued masks cannot separate.
Y(k, f) = ∑_{i=0}^{4} W_i(k, f) · X_env(k - i, f) for f < 5 kHz - Stage 5: Echo Return Loss Enhancement (ERLE) & PESQ Verification
Evaluate residual echo suppression via ERLE (dB) during single-talk and Perceptual Evaluation of Speech Quality (PESQ / STOI) during double-talk. Quantifies how cleanly far-end loudspeaker echo and room reflections are stripped without clipping near-end consonants.
ERLE(dB) = 10 · log10( ∑ |d_echo[n]|² / ∑ |e_residual[n]|² )
Reference Implementation — erb_deepfilter_demo.py (Python 3 (ERB Filterbank & Complex Deep Filtering Math))
import numpy as np
def hz_to_erb_rate(f_hz: np.ndarray) -> np.ndarray:
"""Glasberg & Moore (1990) ERB-rate scale in Cam units."""
return 21.4 * np.log10(1.0 + 0.00437 * f_hz)
def erb_bandwidth_hz(f_hz: float) -> float:
"""Equivalent Rectangular Bandwidth in Hz at center frequency f_hz."""
return 24.7 * (4.37 * (f_hz / 1000.0) + 1.0)
def apply_complex_deep_filter(stft_frames: np.ndarray, weights: np.ndarray) -> np.ndarray:
"""
stft_frames: shape (T, F_df) complex64
weights: shape (T, N_order, F_df) complex64
Returns filtered complex spectrum shape (T, F_df).
"""
T, N, F = weights.shape
out = np.zeros((T, F), dtype=np.complex64)
for t in range(N - 1, T):
for i in range(N):
out[t] += np.conj(weights[t, i]) * stft_frames[t - i]
return out
if __name__ == "__main__":
for f in [250, 1000, 4000, 12000]:
print(f"f={f:5d} Hz -> ERB Bandwidth = {erb_bandwidth_hz(f):6.1f} Hz | ERB Rate = {hz_to_erb_rate(f):5.2f} Cam")
Calibrated Laboratory Hardware BOM
- ARM Cortex-A76 / Jetson Orin Nano Edge Node ($149) — NEON SIMD / ONNX Runtime FP16 Inference (<2 ms/frame). Role: Real-Time DeepFilterNet v3 Execution
- Dual-Mic Differential I2S Array (INMP441) ($12) — 24-bit PCM, 61 dBA SNR, -26 dBFS Sensitivity. Role: Primary + Reference Noise/Echo Capture
Defensive Countermeasures & Lab Verification
- DeepFilterNet relies on the periodic harmonic structure of voiced speech (f0 harmonics below 5 kHz).
- To defeat neural speech extraction in sensitive environments, use voice-like babble masking (multi-talker cocktail-party noise) rather than white/pink noise: stationary white noise is trivially stripped by Stage-1 ERB envelope gains (+24 dB suppression), whereas multi-talker babble shares identical ERB and pitch-harmonic priors.
Frequently Asked Questions
Why does DeepFilterNet use complex multi-frame filtering only below 5 kHz?
Human voiced speech harmonics (formants F1, F2, F3) are concentrated below 5 kHz, where inter-harmonic phase coherence is critical. Above 5 kHz, speech consists mostly of stochastic unvoiced fricatives (/s/, /f/), where real-valued ERB envelope gains are equally effective at a fraction of the compute cost.
What is the difference between a real-valued Wiener mask and a Complex Deep Filter?
A single-frame real mask only scales the magnitude |X(k,f)| and copies the noisy phase. A multi-frame complex filter combines both real and imaginary components across N consecutive frames, actively canceling out-of-phase room reflections and reconstructing clean harmonic phase.
Why does stationary white noise fail to mask speech against modern neural denoisers?
Stationary white or fan noise has a flat, constant power spectral density across ERB bands. Neural networks trained on DNS-Challenge datasets isolate the dynamic, harmonic modulations of speech from stationary backgrounds even at -5 dB input SNR.
Peer-Reviewed Citations
- Schröter, H.; Escalante-B., A. N.; Rosenkranz, T.; Maier, A. (2022). DeepFilterNet: A Low Complexity Speech Enhancement Framework for Full-Band Audio based on Deep Filtering. IEEE ICASSP 2022. Finding: Demonstrated real-time 48 kHz speech enhancement combining 32 ERB bands with 5-tap complex deep filtering.
- Glasberg, B. R.; Moore, B. C. J. (1990). Derivation of auditory filter shapes from notched-noise data. Hearing Research, 47(1-2), 103-138. Finding: Established the standard ERB(f) = 24.7(4.37f + 1) auditory critical-band formula.
More Educational Guides
If any of this frightens you: this site documents what signal physics makes possible in a laboratory, which is not evidence about what is happening to any individual. If you feel watched, targeted or unsafe, that distress is real and treatable. Read about paranoia, mental health and how to get help, or call a free 24/7 line — 988 in the US and Canada, 116 123 in the UK and Norway, 13 11 14 in Australia, or find your country at findahelpline.com.