Skip to main content

Overview

@seastart/srtc-plugin-deepfilternet is an AI noise suppression plugin based on DeepFilterNet (AudioWorklet + WebAssembly) that implements the SDK’s TrackProcessor interface. Compared with the RNNoise plugin, DeepFilterNet delivers higher noise suppression quality and supports suppression strength adjustable at runtime and a bypass switch; the cost is more computation and larger assets.

Installation


Host the static assets

The plugin depends on two static assets (wasm + model, about 18 MB in total) that you need to self-host:
  • v2/pkg/df_bg.wasm
  • v2/models/DeepFilterNet3_onnx.tar.gz
The v2/pkg and v2/models subdirectories are fixed relative paths. When copying, you must keep this directory structure, and point assetBasePath to its root directory.
The assets aren’t checked into the source repository; after installation, a script in the package fetches them, and then you copy them to your static directory (keeping the v2/ structure):
In Vite projects you can also copy them automatically at build time with vite-plugin-static-copy.

Usage

Adjust the suppression strength at runtime (without rebuilding the audio stream), or bypass:
To turn off noise suppression and restore the original microphone track:

Options


Runtime methods


Trade-offs vs. the RNNoise plugin

Use this plugin when noise suppression quality matters and device performance allows; for low-end devices or when lightweight and low latency matter more, use the RNNoise plugin.

Notes

  • Supports audio tracks only.
  • On attach, the SDK automatically turns off the browser’s own noise suppression (the microphone is recaptured once, so audio drops out briefly) and restores it on detach, so the two noise suppressors don’t stack and muffle voices; echo cancellation and auto gain control are unaffected. See Declaring browser 3A requirements. Requires @seastart/srtc-web-sdk 0.7.3 or later.
  • Must run over HTTPS (or localhost); AudioContext may need a user gesture before it can resume.
  • The sample rate is fixed at 48 kHz.
  • Computation is higher than RNNoise; measure CPU usage and end-to-end latency on your target devices.
  • After switching the microphone device (changeDeviceId) or calling startCapture again, noise suppression resumes automatically; you don’t need to call setProcessor again.
  • Can be chained with other processors; see Audio/video processors.
  • License: DeepFilterNet itself is Apache-2.0/MIT; verify the licensing of the model weights yourself before distribution.
The model file itself is gzip. Some servers/proxies add Content-Encoding: gzip to .gz files again; after the browser decompresses once automatically, the underlying code receives an uncompressed .tar, and initialization crashes (RuntimeError: unreachable). The plugin handles this automatically: when it detects the file was decompressed, it re-gzips it in the browser to restore it, so you don’t need to change server configuration. This relies on CompressionStream (Chrome 80+ / Edge 80+ / Safari 16.4+ / Firefox 113+).