Speech Enhancement — DeepFilterNet3

Remove background noise from speech recordings using DeepFilterNet3. The model runs on the Neural Engine via CoreML for efficient inference, while all signal processing (STFT, ERB filterbank, deep filtering) runs on the CPU via Accelerate/vDSP.

Official DF3 parity

The DSP path follows libdf end to end: 1/960 analysis scaling, normalization alpha 0.99, zero-padded deep-filter taps, and correct NumPy C/Fortran matrix order. On a fixed 20-clip VoiceBank-DEMAND subset, Swift scored PESQ 3.097, STOI 0.964, and SI-SDR 19.12 dB versus 3.029, 0.962, and 18.31 dB for official Python DF3.

Before/after sample

A noisy speech clip processed with DeepFilterNet3 so you can hear the CoreML denoiser before running it locally.

Noisy inputMP3, 48 kHz
DeepFilterNet3 outputMP3, 48 kHz

Architecture

DeepFilterNet3 uses a dual-decoder architecture that separates spectral envelope enhancement from fine-grained spectral detail recovery.

StageDetails
STFTShort-time Fourier transform via vDSP
Encoder4 SepConv2d layers + SqueezedGRU
ERB DecoderSigmoid mask applied to ERB-scale frequency bands
DF Decoder5-tap complex-valued filtering coefficients
iSTFTInverse STFT to reconstruct the time-domain signal

The ERB Decoder estimates a gain mask on the Equivalent Rectangular Bandwidth (ERB) scale, handling broad spectral shaping. The DF Decoder predicts 5-tap complex filtering coefficients for fine detail, applying learned filters directly in the frequency domain.

Processing Pipeline

  1. STFT — Decompose the noisy audio into time-frequency representation using vDSP
  2. ERB Features — Map STFT bins to ERB-scale frequency bands
  3. Neural Network — Encoder processes features on Neural Engine; ERB and DF decoders predict enhancement parameters
  4. ERB Masking — Apply sigmoid gain mask to suppress noise in the spectral envelope
  5. Deep Filtering — Apply 5-tap complex coefficients for fine spectral detail recovery
  6. iSTFT — Reconstruct clean audio from the enhanced spectrum

Model

VariantSizePrecision
Default~2.2 MB8-bit palettized weights, FP16 compute

CLI Usage

# Denoise audio (output to _denoised.wav)
.build/release/speech denoise noisy.wav

# Specify output file
.build/release/speech denoise noisy.wav -o clean.wav

# Use another compatible HuggingFace repository
.build/release/speech denoise noisy.wav --model owner/DeepFilterNet3-CoreML

Options

OptionDescription
--output, -oOutput file path (defaults to <input>_denoised.wav)
--modelCompatible HuggingFace model repository ID (default: aufklarer/DeepFilterNet3-CoreML)
Important

DeepFilterNet3 runs on the Neural Engine via CoreML, not on the GPU via MLX. This means it works efficiently even while other GPU-based models (ASR, TTS) are running. No metallib compilation is required.

Model Downloads

ModelSizeHuggingFace
DeepFilterNet3 (CoreML, 8-bit palettized)~2.2 MBaufklarer/DeepFilterNet3-CoreML

Combining with Other Models

Speech enhancement is particularly useful as a preprocessing step before other models:

# Denoise then transcribe
.build/release/speech denoise noisy.wav -o clean.wav
.build/release/speech transcribe clean.wav

Swift API

import SpeechEnhancement

let model = try await SpeechEnhancer.fromPretrained()
let cleanAudio = try model.enhance(audio: noisySamples, sampleRate: 48000)

Also available on Android, and on Linux & Windows through Speech Core (ONNX Runtime).