tooling: align audio packet levels with input timestamps #1756

Merged
R0Y00 merged 1 commit from upstream-pr/1763 into main 2026-11-24 19:09:12 +00:00
R0Y00 commented 2026-11-24 18:13:14 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T18:13:14Z.


Refs #1145

Change

Add a standalone Python tool that aligns process-loopback packet statistics with controller action timestamps on a shared QueryPerformanceCounter clock. Each event reports packet coverage, time-weighted RMS, peak and discontinuities. Uncovered intervals produce null levels so a capture gap cannot pass as silence. The tool only reads statistics and input-event files and has no external dependencies.

Verification

Verified commit f6ea28fb on Windows with Python 3.12, based on 312f5613.

  • python -B tests/startup_audio_timeline_check.py passed. The generated CSV and JSONL cover an audible window, a fully covered silent window, a timestamp-error gap, and an uncovered window.
  • git diff --cached --check passed before committing.

Usage and the packet schema are documented in docs/startup-audio-timeline.md. All test inputs are generated in the fixture.

This contribution was AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6588402258 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1763). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-24T18:13:14Z. --- Refs #1145 ## Change Add a standalone Python tool that aligns process-loopback packet statistics with controller action timestamps on a shared QueryPerformanceCounter clock. Each event reports packet coverage, time-weighted RMS, peak and discontinuities. Uncovered intervals produce null levels so a capture gap cannot pass as silence. The tool only reads statistics and input-event files and has no external dependencies. ## Verification Verified commit `f6ea28fb` on Windows with Python 3.12, based on `312f5613`. - `python -B tests/startup_audio_timeline_check.py` passed. The generated CSV and JSONL cover an audible window, a fully covered silent window, a timestamp-error gap, and an uncovered window. - `git diff --cached --check` passed before committing. Usage and the packet schema are documented in `docs/startup-audio-timeline.md`. All test inputs are generated in the fixture. This contribution was AI-assisted.
tedin7 commented 2026-11-24 18:34:01 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T18:34:01Z.

Review: COMMENTED


Reviewed at f6ea28fb645a91845b3dbcf4434c24b9f686a4bf.

No P1 or P2 defects found in local verification. tools/startup_audio_timeline.py validates finite inputs, non-negative flags, positive frame counts, and normalized [0, rms <= peak <= 1] bounds, excludes packets with WASAPI timestamp-error flag 0x4, and advances cursor across sorted packets so overlapping intervals are not double-counted.

Verification executed:

  • git diff --check origin/main...HEAD -> pass
  • /root/.local/share/x2w-rev-venv/bin/python -B tests/docs_links_check.py -> pass (18 Markdown files, 367 links)
  • /root/.local/share/x2w-rev-venv/bin/python -B tests/bidi_controls_check.py -> pass (1304 tracked files)
  • /root/.local/share/x2w-rev-venv/bin/python -B tests/startup_audio_timeline_check.py -> pass (1 test)
  • python3 /root/.local/state/xbox2windows/pipeline/x2w_pipe.py win2025 1763 --py-checks tests/startup_audio_timeline_check.py -> pass on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP), tests/startup_audio_timeline_check.py ok (0.27s)
  • Local mutation check: changed flags & 4 to flags & 8 in tools/startup_audio_timeline.py; tests/startup_audio_timeline_check.py failed as expected (AssertionError: 1.0 != 0.5), then restored with git checkout -- ..

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6045123526 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1763#pullrequestreview-6045123526). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T18:34:01Z. **Review:** COMMENTED --- Reviewed at `f6ea28fb645a91845b3dbcf4434c24b9f686a4bf`. No P1 or P2 defects found in local verification. `tools/startup_audio_timeline.py` validates finite inputs, non-negative flags, positive frame counts, and normalized `[0, rms <= peak <= 1]` bounds, excludes packets with WASAPI timestamp-error flag `0x4`, and advances `cursor` across sorted packets so overlapping intervals are not double-counted. Verification executed: - `git diff --check origin/main...HEAD` -> pass - `/root/.local/share/x2w-rev-venv/bin/python -B tests/docs_links_check.py` -> pass (18 Markdown files, 367 links) - `/root/.local/share/x2w-rev-venv/bin/python -B tests/bidi_controls_check.py` -> pass (1304 tracked files) - `/root/.local/share/x2w-rev-venv/bin/python -B tests/startup_audio_timeline_check.py` -> pass (1 test) - `python3 /root/.local/state/xbox2windows/pipeline/x2w_pipe.py win2025 1763 --py-checks tests/startup_audio_timeline_check.py` -> pass on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP), `tests/startup_audio_timeline_check.py` ok (`0.27s`) - Local mutation check: changed `flags & 4` to `flags & 8` in `tools/startup_audio_timeline.py`; `tests/startup_audio_timeline_check.py` failed as expected (`AssertionError: 1.0 != 0.5`), then restored with `git checkout -- .`. AI-assisted; commands listed were executed locally.
upstream-sync closed this pull request 2026-11-24 20:00:31 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
R0Y00/Xbox2Windows!1756
No description provided.