math-rir (lib: math_rir)
Room Impulse Response analysis using the SSIR (Spatial Segmentation of Impulse Response) method.
Version: 0.5.5
Overview
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.
Based on: Pawlak & Lee, "Spatial segmentation of impulse response for room reflection analysis and auralization", Applied Acoustics 249 (2026).
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 ;
// Mono RIR (energy-based detection only)
let result = analyze_rir;
// B-format SRIR (full DOA estimation + validation)
let result = analyze_srir;
println!;
Modules
detection— Direct sound and reflection detection algorithmssegmentation— SSIR segmentation and event buildingmixing_time— Echo density and mixing time estimationmetrics— ISO 3382 room-acoustic metrics (EDT, T20, T30, C50, C80, D50, Ts)bands— Octave-band and third-octave-band filtering (ISO/IEC 61260)
Dependencies
math-iir-fir— Butterworth bandpass filters for octave-band analysisrayon— Parallel processing
Testing
&&
Used by
sotf-plugin-binaural: SSIR-analyzed measured room reflections with per-reflection HRTFautoeq/roomeq: SSIR-informed correction weights for room EQ optimization
License
See the root workspace LICENSE file.