Skip to content

Fix the earliest negative correlation offset - #70

Merged
chrisn merged 1 commit into
bbc:masterfrom
Shubham-Padkonde:fix/earliest-offset-boundary
Oct 2, 2026
Merged

chrisn merged 1 commit into
bbc:masterfrom
Shubham-Padkonde:fix/earliest-offset-boundary

Conversation

@Shubham-Padkonde

Copy link
Copy Markdown
Contributor

When the strongest match occurs at the earliest negative offset, find_offset_between_buffers reports a positive offset instead. The boundary returned by cross_correlation is exclusive, as also used by the plotting code's range, but the wraparound check uses > rather than >=.

Include that boundary in the negative-offset conversion. A deterministic regression uses matching feature frames and the real standardization/correlation code: it reports +21 frames before the fix and the correct -10 frames afterward.

Validation: all seven tests pass under Linux with FFmpeg, including the existing audio-file and CLI tests. Black and git diff --check pass.

@elvum

elvum commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

LGTM. @chrisn?

@chrisn

chrisn commented Oct 2, 2026

Copy link
Copy Markdown
Member

Thank you for contributing @Shubham-Padkonde. And thank you for reviewing, @elvum.

@chrisn
chrisn merged commit 2fe2fc7 into bbc:master Oct 2, 2026
18 checks passed
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.

3 participants