nnnoiseless
Recurrent-neural-network audio noise suppression in Rust, a safe port of Xiph's RNNoise.
Repository Health
Technical Analysis
nnnoiseless is a Rust crate for suppressing background noise in audio. It is a port of the C library RNNoise and uses the same recurrent neural network model to distinguish speech from noise and attenuate the noise in real time.
Designed primarily as a library you embed in your own audio pipeline, it also ships a simple command-line tool (operating on WAV or raw PCM files) as an example, and can be built as a C library with an RNNoise-compatible header. It is written mostly in safe Rust, with unsafe confined to a narrow FFT optimization.
What You Get
- A pure-Rust recurrent-neural-network denoiser ported from Xiph’s RNNoise
- A
DenoiseStateAPI for streaming, frame-by-frame audio noise suppression - An optional command-line tool operating on WAV and raw PCM files
- An optional C API with an RNNoise-compatible header (via cargo-c)
- A training feature for producing custom model weights from your own data
Common Use Cases
- Cleaning up voice recordings or live microphone input in a Rust application
- Adding noise suppression to a VoIP, streaming, or conferencing pipeline
- Replacing the C RNNoise library with a safe-Rust drop-in via its C-compatible API
Under The Hood
Architecture - The core denoiser lives in src/denoise.rs, driven by feature extraction (src/features.rs), pitch analysis (src/pitch.rs), and the recurrent network inference in src/rnn.rs (weights embedded from src/weights.rnn). Signal utilities sit in src/signal.rs/src/util.rs, the CLI in src/nnnoiseless.rs, a training binary in src/training.rs, and the optional C bindings in src/capi.rs.
Tech Stack - Rust (edition 2018) using RustFFT for spectral transforms and the dasp family for audio signal handling and resampling. Optional feature flags gate the CLI (bin: clap, hound, anyhow), the C API (capi: libc), and training (train: hdf5, ndarray, rand, glob).
Code Quality - The crate is almost entirely safe Rust, with unsafe limited to two documented casts for a real-only FFT performance win. It carries tests in lib.rs and denoise.rs, benchmarks, and CI via GitHub Actions.
API Design - The public API mirrors RNNoise’s familiar DenoiseState/frame-processing model, making it approachable to anyone who has used the original C library. Feature flags keep the default build lean, docs.rs documentation is available, and the bundled CLI doubles as a usage example.