Skip to content

Add background-noise injection for voice simulations - #127

Open
dalmia wants to merge 9 commits into
mainfrom
claude/festive-rosalind-92d0d6
Open

Add background-noise injection for voice simulations#127
dalmia wants to merge 9 commits into
mainfrom
claude/festive-rosalind-92d0d6

Conversation

@dalmia

@dalmia dalmia commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

What

  • Simulate a caller in a noisy place (street / cafe / crowd / home) so the tested agent's STT is stressed under realistic background. Noise is a per-persona setting, mixed continuously under the simulated caller's audio; off by default.
  • New calibrate_agent/agent/noise/ package — config schema + per-run resolver (off/fixed/random/mixture, seeded), asset prep, the generator (steady loop / event scatter / crowd overlay + backgroundify filters + synthetic-IR reverb / merge / RMS-normalize / seamless loop), and clean+noisy save — wired into run_simulation.py via SoundfileMixer. Adds a prefix kwarg to combine_audio_files.
  • Per-persona example configs + README, a user docs page, and the full design spec + TODO under design/.

Notes

  • Generated ESC-50-derived assets (CC BY-NC) are gitignored — CC0 re-source before shipping (Phase 10 in design/noise_injection_todo.md); regenerate locally via prepare_assets.
  • audiomentations couldn't be used (its soxr<1.0 pin conflicts with pipecat 1.0) → implemented with scipy + soundfile + soxr.
  • 57 unit tests; verified end-to-end across all noise modes with real sims. A pre-existing Sarvam STT websocket-drop flakiness (unrelated) was spun off as a separate task.
  • docs/noise-injection.mdx isn't in docs/docs.json nav yet.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@codecov

codecov Bot commented Jul 10, 2026

Copy link
Copy Markdown

@dalmia
dalmia force-pushed the claude/festive-rosalind-92d0d6 branch 2 times, most recently from 4524010 to bccfc80 Compare July 10, 2026 07:36
dalmia and others added 9 commits July 11, 2026 15:20
Simulate a caller in a noisy place (street, cafe, crowd, home) so the tested
agent's STT is stressed under realistic background. Noise is a per-persona
setting, mixed continuously under the simulated caller's audio.

- calibrate_agent/agent/noise/: schema + resolver (off/fixed/random/mixture,
  seeded per run), assets (env + Vaani speaker pool, prepare_assets), the
  SimulationNoiseGenerator (steady loop / event scatter / crowd overlay +
  backgroundify via scipy filters + synthetic-IR reverb / merge / RMS-normalize
  / seamless loop), and clean+noisy save (continuous reconstruction).
- run_simulation.py: read persona.noise, build the track, attach SoundfileMixer
  to the sim-user transport, write clean_ + noisy conversation audio.
- utils.combine_audio_files: optional prefix kwarg (default "").
- pyproject: add soundfile + scipy (audiomentations dropped — soxr conflicts
  with pipecat 1.0); register agent/assets/noise package-data.
- Examples (per-persona noise variants + README), docs page, and full design
  spec + TODO under design/. Default-off: existing runs unchanged.

Generated ESC-50-derived assets are gitignored (CC BY-NC; CC0 re-source before
shipping — Phase 10). 57 unit tests; verified end-to-end across all noise modes.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
- run_simulation.py: when max_turns is reached, force-cancel the pipeline after a
  short grace if the graceful EndFrame hasn't drained. A continuous background-noise
  mixer emits audio non-stop, so the EndFrame could stall behind an endless output
  stream and the call hung until the agent's idle-timeout (~5 min). Verified: the
  hang condition now ends in ~2s; non-noise sims still flush gracefully first.
- Spec/docs: merge Terminology + glossary and de-jargon it, per-persona distribution
  wording (noise resolves per persona × scenario), drop "babble" for "background
  speakers".
- Add example configs: easy/hard (env/people/mixed at low vs high difficulty),
  matrix (type × difficulty grid), progressive (monotonic ramp), showcase (all modes).

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Add scripts/fetch_noise_assets.py: pulls ESC-50 environmental clips and Vaani
speaker clips from the Hugging Face Hub, places them under data/, and runs
prepare_assets(). Runbook step B.3 is now a single command.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@dalmia
dalmia force-pushed the claude/festive-rosalind-92d0d6 branch from bccfc80 to 18528ba Compare July 11, 2026 09:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant