Repository navigation
fix(editor): anchor the bar ruler to the song start, not where master-0 plays - #52
Merged
Merged
Conversation
…-0 plays The editor keeps one master beat grid for every job and projects beat 0 into the arr-time canvas axis. It did this with masterToArr(beatPhase), which returns the arr-time at which beat 0 (a single master instant ~0.3s into the source) is *played* — i.e. wherever the chunk covering master ~0 lands in the playback order. On a long-form arrangement whose first chunk starts late in the source (or whose master-0 chunk plays last), that anchored bar 1 far down the timeline: the ruler "started way back in the song." Replace the projection with a dedicated selector arrBeatPhaseS, which anchors the grid to the first PLAYED segment (beatPhaseMaster - seg0.in), so the bar grid runs continuously from arr-time 0. Identity for single-take's whole-master [0,dur] segment. Apply the same anchor everywhere the grid is consumed on the arr axis so they stay in lockstep with the ruler: BeatRuler, snapTimelineTime, and the clip/pill/loop drag-snap paths in Timeline. Co-Authored-By: Claude Opus 4.8 (1M context) <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.
Problem
Going through a long project Triage → Arrange → Edit, the editor's bar/measure ruler started way back in the song — bar 1 rendered far to the right with empty ruler on the left, the bar numbers crammed against the right edge.
Root cause
The editor keeps one master beat grid for the whole job and projects "beat 0" onto the arrangement-time canvas (where the ruler is drawn). It did that projection with
masterToArr(beatPhase).But
beatPhase(beat 0) is a single master instant — ~0.3 s into the source recording.masterToArrreturns the arr-time at which that instant is played back, i.e. wherever the chunk covering master-time ≈ 0 sits in the playback order. On a long-form arrangement whose first-played chunk starts late in the source (or whose master-0 chunk plays near the end), beat 0 mapped to a large arr-time → bar 1 anchored far down the timeline.Fix
Added a dedicated selector
arrBeatPhaseSthat anchors the grid to the first played segment (beatPhaseMaster − seg0.in), so the bar grid runs continuously from arr-time 0 — the start of the assembled song. Identity for single-take's whole-master[0, dur]segment, so direct-mode jobs are unchanged.Applied the same anchor at every place that consumes the grid on the arr axis, so they stay locked to the ruler:
BeatRuler.tsx— the ruler itselfstore.tssnapTimelineTime— beat-snappingTimeline.tsx— clip / pill / loop drag-snapTesting
timing.test.tscover the out-of-order long-form case, single-take identity, and the empty-segments fallback.tsc --noEmitclean.Reviewer notes
🤖 Generated with Claude Code