Skip to main content

Crate math_rir

Crate math_rir 

Source
Expand description

§math-rir: Room Impulse Response Analysis

SSIR (Spatial Segmentation of Impulse Response) implementation for detecting, segmenting, and analyzing early reflections in measured room impulse responses.

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

§Overview

The SSIR method segments a 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 manipulation.

§Usage

use math_rir::{analyze_rir, SsirConfig};

let rir: Vec<f32> = load_impulse_response(); // your RIR data
let config = SsirConfig::new(48000.0);
let result = analyze_rir(&rir, &config);

println!("Detected {} events ({} reflections)",
    result.num_events(), result.num_reflections());
println!("Mixing time: {:.1}ms", result.mixing_time_ms());

for seg in result.reflections() {
    println!("  Reflection at {:.1}ms, duration {:.1}ms",
        seg.toa_ms(48000.0), seg.duration_ms(48000.0));
}

Modules§

filtfilt
Forward-reverse (zero-phase) filtering for offline signal processing. Forward-reverse (zero-phase) filtering for offline signal processing.

Structs§

RirSegment
A single segment of the RIR identified by SSIR analysis.
SsirConfig
Configuration for SSIR (Spatial Segmentation of Impulse Response) analysis.
SsirResult
Result of SSIR analysis on a room impulse response.

Functions§

analyze_rir
Analyze a mono room impulse response using the SSIR method.
analyze_srir
Analyze a multi-channel Spatial Room Impulse Response (SRIR) using the full SSIR method.