feat: DelaySum beamform plus hop process latency

Keep C920 stereo through SpeechBrain GCC-PHAT Delay-and-Sum, then
MetricGAN, and publish mono to LiveKit. Record last_dt_ms and log
process_ms/capture_ms every 50 hops for the latency plan.
This commit is contained in:
root
2026-08-28 06:16:25 +00:00
parent abeea6256c
commit 950128deec
8 changed files with 252 additions and 56 deletions
+6
View File
@@ -38,6 +38,8 @@ class Config:
enhance_model: str = "speechbrain/metricgan-plus-voicebank"
enhance_chunk_s: float = 1.0
enhance_hop_s: float = 0.2
# SpeechBrain Delay-and-Sum (GCC-PHAT) on C920 stereo before enhance
beamform_mode: str = "auto" # auto | force | off
# misc
publish_timeout_s: float = 60.0
log_level: str = "INFO"
@@ -83,6 +85,7 @@ def load_config(env_path: Optional[Path] = None) -> Config:
),
enhance_chunk_s=float(os.environ.get("ENHANCE_CHUNK_S", "1.0")),
enhance_hop_s=float(os.environ.get("ENHANCE_HOP_S", "0.2")),
beamform_mode=os.environ.get("BEAMFORM_MODE", "auto").lower(),
publish_timeout_s=float(os.environ.get("PUBLISH_TIMEOUT_S", "60")),
log_level=os.environ.get("LOG_LEVEL", "INFO").upper(),
cameras=_parse_cameras(os.environ.get("CAMERAS", "all")),
@@ -90,4 +93,7 @@ def load_config(env_path: Optional[Path] = None) -> Config:
if cfg.enhance_mode not in ("auto", "force", "off"):
raise ValueError(f"ENHANCE_MODE must be auto|force|off, got {cfg.enhance_mode}")
if cfg.beamform_mode not in ("auto", "force", "off"):
raise ValueError(
f"BEAMFORM_MODE must be auto|force|off, got {cfg.beamform_mode}")
return cfg