Files
headmic/spatial.py
Alex cae14023b7 Add ITD (Interaural Time Difference) via cross-correlation (#12)
Cross-correlates left/right ear audio frames (512 samples, ~32ms window)
to find the sub-millisecond delay between arrays. Converts delay to
bearing angle using speed of sound and array separation.

At 16kHz with 175mm separation, resolution is ~1 sample = 62.5μs = ~7°.
Not lab-grade, but adds a third independent angle estimate alongside
DoA and ILD. Works with current 2-channel firmware — no raw mics needed.

New fields in /doa spatial response:
  itd_angle: bearing from cross-correlation (degrees)
  itd_delay_us: raw time delay (microseconds, positive = source on right)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-12 21:51:25 -05:00

15 KiB