Sonora
Pure Rust implementation of WebRTC audio processing -- the full pipeline with echo cancellation (AEC3), noise suppression, automatic gain control (AGC2), and high-pass filtering.
Provides a Rust API. A C API is available via the separate sonora-ffi crate.
Usage
use sonora::{AudioProcessing, Config, StreamConfig};
use sonora::config::{EchoCanceller, NoiseSuppression, GainController2};
let config = Config {
echo_canceller: Some(EchoCanceller::default()),
noise_suppression: Some(NoiseSuppression::default()),
gain_controller2: Some(GainController2::default()),
..Default::default()
};
let mut apm = AudioProcessing::builder()
.config(config)
.capture_config(StreamConfig::new(48000, 1))
.render_config(StreamConfig::new(48000, 1))
.build();
// Process 10ms frames (48kHz * 10ms = 480 samples)
let src = vec![0.0f32; 480];
let mut dest = vec![0.0f32; 480];
apm.process_capture_f32(&[&src], &mut [&mut dest]).unwrap();
See the workspace README for benchmarks, platform support, and the full crate listing.
License
BSD-3-Clause. See LICENSE for details.