Skip to content

Fix trange rounding that makes back-to-back clips overlap by 1us - #85

Open
RayanR000 wants to merge 1 commit into
sun-guannan:mainfrom
RayanR000:fix-trange-rounding-overlap
Open

RayanR000 wants to merge 1 commit into
sun-guannan:mainfrom
RayanR000:fix-trange-rounding-overlap

Conversation

@RayanR000

Copy link
Copy Markdown

Fixes #84.

trange now rounds the start and the end, then takes the difference as the duration. That way a clip that starts where the previous one ended always lines up exactly. String inputs like "1.5s" still parse the same way. tim is unchanged. It just uses a new helper that returns the unrounded value.

I added tests/test_time_util.py. Without the fix, 18 of its cases fail. The repro from the issue now runs clean for 32 bars.

The 3 failures in tests/test_draft_profiles.py happen on main too (Windows drive path tests running on macOS), so they're unrelated.

trange rounded start and duration separately, so a segment placed exactly
at the previous segment's end could come out 1us before it and raise
SegmentOverlap. Round start and end instead and derive the duration.
Copilot AI lite review requested due to automatic review settings September 23, 2026 06:24

Copilot AI 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.

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

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.

trange rounding makes back-to-back clips raise SegmentOverlap

2 participants