sonora

Library Listed

Automatic Gain Control 2 (AGC2) with RNN VAD for WebRTC Audio Processing

Checked · Sources

Downloads
551,810
Dependents
3
Stars
99
Forks
17
Contributors
4
Commits
282
Latest release
0.3.0 ·

About

From the project README ·

Pure Rust implementation of WebRTC audio processing, providing echo cancellation, noise suppression, and automatic gain control.

Ported from the WebRTC Native Code (M145) audio processing module, plus 15 later upstream fixes up to M156 (listed in cpp/NEWS).

Crates

CrateDescriptionCrates.ioDocumentation
sonoraFull audio processing pipeline
sonora-ffiC API (FFI) for integration with C/C++ projects
sonora-aec3Echo Canceller 3 (AEC3)
sonora-agc2Automatic Gain Control with RNN VAD
sonora-nsNoise Suppression
sonora-common-audioAudio DSP primitives (resamplers, filters)
sonora-simdSIMD operations (SSE2, AVX2, NEON)
sonora-fftFFT implementations (Ooura, PFFFT)

Features

  • Echo Cancellation (AEC3) -- adaptive filter-based echo canceller with delay estimation
  • Noise Suppression -- Wiener filter-based noise reduction with voice activity detection
  • Automatic Gain Control (AGC2) -- RNN VAD-based gain controller with limiter
  • High-Pass Filter -- DC offset removal
  • C API -- cbindgen-generated C header for FFI integration (via sonora-ffi)

Upstream's neural residual echo estimator (marked experimental at M145) is not ported; see sonora-aec3.

Quick Start

Run the minimal echo cancellation demo:

Read the full README
cargo run -p sonora --example simple

More examples in crates/sonora/examples/:

ExampleDescriptionCommand
simpleSynthetic AEC round-tripcargo run -p sonora --example simple
karaokeMic loopback with echo cancellationcargo run -p sonora --features examples --example karaoke
recordingRecord & process to WAVcargo run -p sonora --features examples --example recording -- --duration 5 --ns --agc

The karaoke and recording examples require the examples feature which pulls in cpal, hound, and other audio I/O dependencies. These examples are based on the tonarino/webrtc-audio-processing examples, ported from PortAudio to cpal.

Supported Platforms

PlatformArchitectureSIMD BackendCI Status
Linux (Ubuntu)x86_64SSE2, AVX2Build, test, clippy, fmt, docs
macOSARM64 (Apple Silicon)NEONBuild, test
Windowsx86_64SSE2, AVX2Build, test
Androidaarch64, armv7, x86_64, i686NEON / SSE2Build, test (via cross)
iOSaarch64NEONBuild, test (via simulator)

Runtime feature detection is used for AVX2 on x86_64. SSE2 is assumed available on all x86_64 targets. NEON is used on AArch64. A scalar fallback is provided for all other architectures.

C++ Integration

The C++ reference test suite (WebRTC M145 plus the same upstream fixes, 2400+ tests) is validated on Ubuntu x86_64 with the Rust backend linked through the sonora-ffi C API.

Benchmarks

Full pipeline processing a 10 ms frame with AEC3 + noise suppression + AGC2 enabled. Measured on Apple M4 Max (NEON backend), Rust 1.85, -C target-cpu=native:

BenchmarkRustC++Ratio
16 kHz mono4.2 us4.0 us1.07x
48 kHz mono13.3 us10.8 us1.24x

See BENCHMARKS.md for per-component comparisons, profiling breakdown, and instructions for reproducing.

Development

This project uses cargo-make for task automation.

cargo install cargo-make
Quick start
cargo make ci              # Format, lint, test, docs
cargo make bench           # Rust pipeline benchmarks
cargo make check           # Type-check all crates (including excluded)
cargo make clippy          # Lint all crates (including excluded)
C++ comparison (optional)
cargo make setup           # Install system deps + build C++ library
cargo make cpp-bench       # Run Rust vs C++ comparison benchmarks
cargo make cpp-test        # Run comparison tests
cargo make cpp-validate    # Run 2400+ C++ test suite with Rust backend

See Makefile.toml for the full list of tasks.

Minimum Supported Rust Version

The minimum supported Rust version is 1.91.

Related Projects

  • tonarino/webrtc-audio-processing -- Rust bindings to the C++ WebRTC AudioProcessing module. Sonora's examples are based on theirs. If you need the battle-tested C++ implementation with a Rust wrapper, use tonarino; if you want a pure-Rust solution with no C++ dependency, use sonora.
  • pulseaudio-wap -- The original extracted C++ code

History

  1. Google's libwebrtc -- The original AudioProcessing module is developed as part of the WebRTC Native Code project at Google.

  2. PulseAudio's webrtc-audio-processing -- Arun Raghavan and contributors extracted the AudioProcessing module into a standalone library with a Meson build system, making it usable outside of the full WebRTC stack. This packaging is used by PulseAudio, PipeWire, and other Linux audio projects.

  3. M145 upgrade and test expansion -- The C++ codebase was updated to WebRTC M145 (branch-heads/7632), the full upstream test suite (2400+ tests) was ported, and the build was upgraded to C++20. (AI assisted)

  4. Sonora:Rust port -- The C++ implementation was ported to pure Rust, producing this set of crates. The port includes the full SIMD (SSE2, AVX2, NEON) optimizations and the FFTs, as well as a C API for FFI integration. The full C++ test suite passes against this Rust version. (AI assisted)

License

All crates in this repository are licensed under BSD-3-Clause.

Runs on
GPU support unknown
What shows it
  • no dependency or feature matches a backend row
Native code
None found
  • No native code found
Python bindings
No Python binding crate found
License
BSD-3-Clause

Compare with similar projects

Order: strongest tier first, then most downloads, then name, with unmeasured values last. A library counts downloads over 30 days. An app counts binary downloads per release. An app with none counts its crate downloads over 30 days. ML Rust runs this catalogue, so its closest project always gets a row.

sonora beside the projects that share a topic with it
ProjectDownloadsDependentsStarsLatest releaseRuns on (GPU)Native codeLicense
sonora This page Listed

Automatic Gain Control 2 (AGC2) with RNN VAD for WebRTC Audio Processing

551,810 downloads over 30 days 3 99 0.3.0 GPU support unknown No native code found BSD-3-Clause
webrtc-vad Listed Dormant

Rust interface for the WebRTC Voice-Activity-Detction Module

60,022 downloads over 30 days 7 31 0.4.0 GPU support unknown Build uses a native toolchain: cc MIT
any-tts Listed

A Rust TTS library with Candle backends and runtime adapters for modern open TTS models

3,404 downloads over 30 days 2 23 0.2.0 CUDA, Metal No native code found Apache-2.0 OR MIT
silero Listed

Production-oriented Rust wrapper for the Silero VAD ONNX model.

1,888 downloads over 30 days 3 6 0.7.0 CUDA, ROCm Binds native code: ort-sys (feature coreml) Apache-2.0 OR MIT
scribble Listed

High-level Rust API for audio transcription using Whisper

457 downloads over 30 days 0 105 0.5.4 CUDA, Metal, Vulkan Binds native code: whisper-rs-sys MIT
whisrs App Listed

Voice for the Linux desktop: dictation, read-aloud (TTS), and voice-driven LLM commands, with Groq, OpenAI, Deepgram, and local Whisper backends

61 binary downloads per release Not applicable 149 0.2.0 CUDA, Vulkan Binds native code: alsa-sys, mac-notification-sys, wayland-sys (feature overlay), whisper-rs-sys (feature local-whisper) MIT
voxr New

Audio and speech on boostr: compressed-audio decode, resampling, DSP and grapheme to phoneme, with speech synthesis (Kokoro, VITS), voice cloning (VoxCPM2), transcription with word timings (Whisper), voice activity (Silero) and audio-text scoring (CLAP), on CPU or CUDA.

642 downloads over 30 days 2 2 0.9.1 CUDA No native code found Apache-2.0
Why ListedNo archive, New or Featured rule places it, so it is Listed.

What it lacks for Featured

  • It has 2 active dependents and 2 new dependents in 365 days. Featured needs 11 active dependents or 9 new dependents in 365 days. The repository route does not pass: the repo's main crate sonora is not in this entry.

What else the check found

  • The last activity is on 7 Nov 2026, 2 days ago. The rules expect an update within 365 days. Dormancy rule

Exact rules: Listed, Featured library. The check on applied thresholds version 9.

Every rule outcome, as the check records it
  • expected-interval: version 0.3.0 base 80, doubled for 551810 downloads per month, raised to the 365-day floor: E = 365 days
  • dormancy: last activity 2026-11-07, 2 days ago, E = 365: active
  • featured: not featured: active_users 2 < 11 and new_adopters 2 < 9 and repository route: the repo's main crate sonora is not in this entry
  • listed: listed: no archive, new or featured rule applies

Measurements and sources

Each signal row shows the raw value, its source and the fetch date. The Sources list gathers every distinct source on this page. Movement needs more history.

Sources6 sources
Adoption2 active dependents, 2 new dependents in 365 days1 not measured
Adoption measurements
SignalValueSourceFetchedCounts
Active dependents2crates.io database dumpYes
New dependents (365 days)2crates.io database dumpYes
Peak active dependents2crates.io database dumpYes
Active dependents as a share of the peak1crates.io database dumpYes
Binary downloads per releaseNot measuredYes
MaintenanceLatest human commit: 2 days ago3 not measured
Maintenance measurements
SignalValueSourceFetchedCounts
Latest human commit2026-11-07GitHub repositoryYes
Latest release2026-11-07crates.io database dumpYes
First release2026-02-11crates.io database dumpYes
Latest version0.3.0crates.io database dumpYes
Days the oldest outside issue waits for a reply0GitHub repositoryYes
Maintainer replies over 365 days5GitHub repositoryYes
Repository archivedfalseGitHub repositoryYes
Repository gonefalseGitHub repositoryYes
Release commit or manifest in the repotruecrates.io packageYes
Published docstruecrates.io database dumpYes
Latest release fails cargo checkNot measuredYes
Build check dateNot measuredYes
Build check toolchainNot measuredYes
SecurityUnpatched vulnerabilities: none
Security measurements
SignalValueSourceFetchedCounts
Unpatched vulnerabilities past the grace windownoneRustSec advisory databaseYes
RustSec unmaintained advisorynoneRustSec advisory databaseYes
Deprecation noticenonecrates.io database dumpYes
Deprecated requirementnonecrates.io database dumpYes
Distribution3 releases, 551,810 downloads over 30 days5 not measured
Distribution measurements
SignalValueSourceFetchedCounts
Releases3crates.io database dumpYes
Downloads over 30 days551810crates.io database dumpYes
Binary downloads over the last 3 releasesNot measuredYes
Homebrew installs on request over 365 daysNot measuredYes
Repology repository familiesNot measuredYes
Docker pull growth over 90 daysNot measuredYes
Docker pulls at the growth baselineNot measuredYes
Every version a prereleasefalsecrates.io database dumpYes
Every version 0.0.xfalsecrates.io database dumpYes
Every version yankedfalsecrates.io database dumpYes
Crate deleted from crates.iofalsecrates.io database dumpYes
Repository99 stars, 17 forks, 4 contributors, 282 commits. Stars alone never qualify a project.
Repository measurements
SignalValueSourceFetchedCounts
GitHub stars99GitHub repositoryYes — one part of the repository route
GitHub forks17GitHub repositoryYes — one part of the repository route
Contributors with a GitHub account4GitHub contributorsYes — one part of the repository route
Commits on the default branch282GitHub repositoryNo
Repository's main crate left out of the entrysonoracrates.io database dumpYes
Facts that never count
Facts that never count measurements
SignalValueSourceFetchedCounts
LicenseBSD-3-Clausecrates.io database dumpNo
Runs on, from listed crates and their direct dependenciesGPU support unknowncrates.io database dumpNo
What shows each backendno dependency or feature matches a backend rowcrates.io database dumpNo
Native code, from listed crates and their dependenciesNo native code foundcrates.io database dumpNo
Python bindings, from direct dependencies of listed cratesNo Python binding crate foundcrates.io database dumpNo
Crates that depend on a listed crate directly3crates.io database dumpNo

Corrections and review history

Report a correction

No correction applies to this entry.

Judgments

A judgment enters only through an approved issue and a merged pull request.

No judgment applies to this entry.