Repository navigation
End-to-end echo path: a fixed room, a warning filter, evidence that tells where the echo moved - #14
Merged
Merged
Conversation
…e it AEC3 estimates the echo's delay itself and uses an external one only with delay.use_external_delay_estimator (off, and not exposed by the binding): replaying the same audio with the hint at 0 to 500 ms changes the residual by 0.1 dB. The spec no longer says the estimator is "seeded" by it, and the guides no longer say to raise it when the agent hears itself. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…dio callback sounddevice 0.5.6 assigns `data.shape` in each callback. A plain run ignores the warning, but pytest records each one, ~17k per end-to-end conversation, and processes them at the end of each test: the process froze ~300 ms while the app's audio ran, its mic stream then stayed ~85 ms behind for the rest of the run, and the echo canceller leaked while it relearned (found with a stall probe in CI). Filtered for that message and module only; fixed upstream (spatialaudio/python-sounddevice#641), to drop once a release after 0.5.6 is locked. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Its audio.npz recordings are what the echo canceller is measured on, and the echo check no longer fails, so a failure-only upload left nothing to measure. Kept 30 days. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The room recorded the app's speaker on one stream and played it into the cable on another; with their clocks 250-400 ppm apart its echo crept 20-30 ms per conversation, which a laptop's does not and the canceller pays for. It now holds the delay from recording to playback (PortAudio's ADC and DAC times): one resampled sample per block against the drift, the whole excess cut after a late block. Offline, at 0, +-400 and +1000 ppm with a 90 ms late burst, it holds within 0.1 ms (the old room: 50 -> 103 ms over 40 s); in CI the delay seen by the app stays flat. The evidence now also tells where a change in the echo's delay comes from: the room's log of its echo path (room.npz) and each callback of the app's own two audio streams (in audio.npz: latency, underflow and overflow flags). The echo recorder is entered before the build, which opens the voice's output stream. specs/e2e.md: Implemented -> Updated -> Implemented, with its plan Done. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The computer's end-to-end tier records ~1.4–3.6 s of the app's own voice leaking through the echo canceller per conversation (step 8 records it, does not fail on it). Measuring it across eight manual CI runs showed that part of it was the test setup moving the echo path, not the canceller. This PR removes both causes and keeps the evidence that found them.
What changes
pyproject.toml). sounddevice 0.5.6 raises it in every audio callback. A plain run ignores it, but pytest recorded ~17k per conversation and processed them at the end of each test, freezing the process ~300 ms while the app's audio ran. The app's mic stream then stayed ~87 ms behind for the rest of the run (input latency 87 → 174 ms, no overflow), the echo arrived later against its reference, and AEC3 leaked for ~3 s while it relearned. It happened in 3 of 5 runs, always after step 6's request, and failed one run (the agent answered a fragment of its own story). The filter matches that message and module only. Fixed upstream (Remove deprecated assignment to.shapespatialaudio/python-sounddevice#641) but not released; the comment says to drop the filter once a release after 0.5.6 is locked.tests-e2e/room.py,specs/e2e.md"The echo's delay holds", plan202611101900_room-holds-echo-delay.md). The room's two streams ran 250–400 ppm apart, so its echo crept 20–30 ms per conversation, which a laptop's does not. It now holds the time from recording to playback (PortAudio's ADC and DAC times): one resampled sample per 10 ms block against the drift, the whole excess cut after a late block. Offline, at 0, ±400 and +1000 ppm with a 90 ms late burst, it holds within 0.1 ms; the old room went 50 → 103 ms over 40 s. In CI the delay the app sees stays flat (188–189 ms for 60 s).room.npzlogs the room's echo path, andaudio.npznow also logs each callback of the app's own two audio streams (latency, underflow and overflow flags). The echo recorder is entered before the build, so the voice's output stream is logged too.specs/ci.md), since the echo check no longer fails.stream_delay_msis no longer presented as a tuning knob. AEC3 estimates the delay itself and all but ignores the hint (replaying the same audio at 0–500 ms changes the residual by 0.1 dB).specs/audio-processing.md, the computer guide, troubleshooting and the configuration reference are corrected; the field stays, harmless.What it does not change
The leaks that remain are the canceller's own: while and just after the person talks over a story, and after some short replies (2.2 s in the last run, within the 1.4–2.0 s spread of earlier runs without a jump). A better canceller is still
specs/audio-processing.mdopen question 3. No app code changes.Verification
uv run ruff check .,uv run ruff format --check .,uv run pyright,uv run pytest(301 passed).🤖 Generated with Claude Code