math-rir 0.5.2

Room Impulse Response analysis: SSIR-based reflection detection, segmentation, and mixing time estimation
Documentation
  • Coverage
  • 100%
    28 out of 28 items documented1 out of 3 items with examples
  • Size
  • Source code size: 62.74 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 3.74 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 51s Average build duration of successful builds.
  • all releases: 51s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • pierreaubert/sotf
    26 3 9
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • pierreaubert

math-rir

Room Impulse Response analysis using the SSIR (Spatial Segmentation of Impulse Response) method.

Based on: Pawlak & Lee, "Spatial segmentation of impulse response for room reflection analysis and auralization", Applied Acoustics 249 (2026).

What it does

Segments a measured Room Impulse Response (RIR) into consecutive, variable-length sound events (direct sound + early reflections), each with a constant direction of arrival (DOA). This preserves the full temporal energy profile while enabling per-reflection analysis and manipulation.

Key algorithms

  • Direct sound onset detection (Algorithm 1 from paper): log-magnitude peak detection with 11 dB threshold
  • Local Energy Ratio reflection detection: 1ms analysis windows, median energy threshold, DOA/TOA validation
  • Onset refinement: per-segment onset detection within pre-onset windows
  • Mixing time estimation: Abel & Huang echo density method

API

use math_rir::{analyze_rir, analyze_srir, SsirConfig};

// Mono RIR (energy-based detection only)
let result = analyze_rir(&rir_samples, &SsirConfig::new(48000.0));

// B-format SRIR (full DOA estimation + validation)
let result = analyze_srir(&[&w, &x, &y, &z], &SsirConfig::new(48000.0));

println!("{} events, mixing time {:.1}ms",
    result.num_events(), result.mixing_time_ms());

Used by

  • sotf-plugin-binaural: SSIR-analyzed measured room reflections with per-reflection HRTF
  • autoeq/roomeq: SSIR-informed correction weights for room EQ optimization