Skip to main content

synthesize_hrir

Function synthesize_hrir 

Source
pub fn synthesize_hrir(
    gains: &BinauralGains,
    sample_rate: f32,
    taps: usize,
) -> (Vec<f32>, Vec<f32>)
Expand description

Synthesize left/right HRIRs from gains.

Each ear is a unit impulse scaled by gain_l/gain_r, delayed by its ear delay: the nearer ear sits at ~0, the farther ear is delayed by |itd_seconds|·sample_rate samples (placed with linear-interpolated fractional delay). A gentle one-pole low-pass (head shadow) is applied ONLY to the contralateral (farther, quieter) ear so its highs are attenuated.

itd_seconds < 0 ⇒ source to the left ⇒ right ear is the farther/contralateral one; itd_seconds > 0 ⇒ left ear is farther. Returns (left_ir, right_ir), both length taps (min 1).