Skip to content

test: stabilize native audio tail parity - #84

Merged
My-Denia merged 2 commits into
mainfrom
fix/parity-audio-tail-analysis
Jul 17, 2026
Merged

test: stabilize native audio tail parity#84
My-Denia merged 2 commits into
mainfrom
fix/parity-audio-tail-analysis

Conversation

@My-Denia

Copy link
Copy Markdown
Owner

Description

Stabilizes the Windows native parity harness's final-audio-window analysis without changing either capture backend.

  • Extracts PCM tone analysis into a small tested module.
  • Uses hysteresis crossings with sub-frame interpolation and 16-cycle local validation.
  • Retains the strict 997 +/- 10 Hz requirement.
  • Allows at most one AAC frame of below-threshold tail padding and one longest accepted tone cycle after the last valid local window.

Motivation

Valid 997 Hz captures could intermittently fail the final 250 ms parity gate. AAC tail padding and short integer-frame crossing windows made the estimator phase- and quantization-sensitive, even though both helpers produced non-zero AAC packets, decodable frames, and retained audio through pause/resume/stop.

This change fixes the test estimator rather than weakening the audio-quality contract. It does not modify the Rust or legacy C++ capture runtime.

Type of Change

  • New Feature
  • Bug Fix
  • Refactor / Code Cleanup
  • Documentation Update
  • Other: deterministic parity regression coverage

Related Issue(s)

Release-candidate validation follow-up; no separate issue.

Screenshots / Video

Not applicable. There is no UI change.

Testing

  • npx vitest run electron/native/windowsNativeAudioAnalysis.test.mjs - 11/11 passed.
  • npm run test - 63 files / 500 tests passed.
  • npm run lint - passed.
  • npx tsc --noEmit - passed.
  • Four retained parity failure artifacts replayed successfully under the strengthened analyzer.
  • Three consecutive Windows active-system-audio parity runs passed; each run produced 141 AAC packets and 141 decodable frames from both C++ and Rust helpers.
  • Independent execution audit and final Codex review passed with no blocking finding.

Scope

No runtime helper, exporter, version, release-note, tag, or release change is included.

Checklist

  • I have performed a self-review of my code.
  • Screenshots or videos are not applicable.
  • Changelog and issue links are not applicable to this test-only prerequisite.

@My-Denia
My-Denia marked this pull request as ready for review July 17, 2026 09:48
Copilot AI review requested due to automatic review settings July 17, 2026 09:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 80100abfde

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +114 to +115
if (Math.abs(localFrequency - expectedFrequency) <= frequencyTolerance) {
lastValidToneCrossingFrame = crossingFrames[index];

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Stop advancing the valid tail marker on mixed-tone windows

When an out-of-band tail starts, the rolling 16-cycle window initially contains mostly valid 997 Hz cycles, so its averaged frequency remains within tolerance and this assignment advances lastValidToneCrossingFrame into the bad tail. For example, a phase-continuous 1008 Hz tail of 1,600 frames reports an approximately 998.45 Hz whole-span frequency and only about 933 trailingWithoutValidToneFrames, passing both parity assertions despite exceeding the 1,073-frame limit; the added 2,000-frame test only passes because the tail is long enough to outlast this transition bias. Require the local window to consist entirely of accepted tone intervals, or otherwise avoid moving the marker past the actual frequency transition.

Useful? React with 👍 / 👎.

@My-Denia
My-Denia merged commit 13e9526 into main Jul 17, 2026
12 checks passed
@My-Denia
My-Denia deleted the fix/parity-audio-tail-analysis branch July 17, 2026 14:09
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.

2 participants