8000 feat(triage): slice a chunk into fixed N-bar intervals by johannboehme · Pull Request #53 · johannboehme/tk-1 · GitHub
[go: up one dir, main page]

Skip to content

feat(triage): slice a chunk into fixed N-bar intervals - #53

Merged
johannboehme merged 1 commit into
mainfrom
claude/heuristic-zhukovsky-3147de
Jun 14, 2026
Merged

johannboehme merged 1 commit into
mainfrom
claude/heuristic-zhukovsky-3147de

Conversation

@johannboehme
Copy link
Copy Markdown
Owner

What

Adds a one-shot SLICE TO BARS action to the Triage chunk inspector: pick an interval (1–X bars) on the bar-count LCD and cut the focused chunk into that many bar-length pieces in a single click — instead of N manual splits. Built for a long take that's really many repeated phrases.

Why

Manually splitting a 14-bar take into 4-bar phrases meant clicking Split repeatedly at each downbeat. This carves the whole chunk on the bar grid in one action.

How it works

  • Grid-true cuts — pieces land on downbeats of the chunk's own bar grid (audioStartMs anchor). The remainder stays as a shorter final piece (14 bars @ interval 4 → 4+4+4+2). The first piece keeps the original chunk id so persistent references survive.
  • Reused widget — extracted MinBarsFilter out of DetectionPanel into a shared BarCountLcd component (now the single source of truth for the LCD palette), used by both the existing MIN filter and the new slice control.
  • Arrangement-safe — sliceFocusedGuarded confirms when the chunk is in the arrangement, then applySliceToArrangement expands each occurrence into the pieces back-to-back (the N-way generalisation of split's "both" branch).
  • Reveal animation — a "downbeat guillotine" in the timeline (framer-motion): a phosphor blade drops on each cut staggered left→right, then each new piece deals in from its seam with a one-shot flash. Respects prefers-reduced-motion.

Files

  • BarCountLcd.tsx (new) — shared LCD widget extracted from DetectionPanel
  • triage-store.ts — sliceIntervalBars state + sliceChunkIntoBars action + transient sliceReveal marker
  • triage-arrangement-ops.ts — applySliceToArrangement
  • triage-guarded-actions.ts — sliceFocusedGuarded
  • ChunkInspector.tsx — the SLICE section
  • TriageTimeline.tsx — the reveal animation

Testing

  • TDD: 24 new unit tests for sliceChunkIntoBars + applySliceToArrangement (exact-multiple, remainder, sub-interval, no-BPM, grid alignment, metadata inheritance, arrangement expansion).
  • Full suite green (1272 tests); typecheck clean.
  • Verified the live store action in-browser produces correct geometry + reveal marker.

Reviewer note: the animation + inspector layout need a real loaded session to see (no saved jobs / media upload couldn't be automated here). To test: open a session → Triage, select a chunk with a BPM, set BARS, hit Cut into Nb.

🤖 Generated with Claude Code

…imation

Add a one-shot "SLICE TO BARS" action to the chunk inspector: pick an
interval (1–X bars) and cut the focused chunk into that many bar-length
pieces in a single click, instead of N manual splits. Useful for a long
take that's really many repeated phrases.

- Cuts land on downbeats of the chunk's own bar grid; the remainder
  stays as a shorter final piece (14 bars @ 4 -> 4+4+4+2). The first
  piece keeps the original id so persistent refs survive.
- Reuse the bar-count LCD: extract MinBarsFilter out of DetectionPanel
  into a shared BarCountLcd component (now the single source of truth
  for the LCD palette), used by both the MIN filter and the slice ctrl.
- Arrangement-safe: sliceFocusedGuarded confirms when the chunk is in
  use, then applySliceToArrangement expands each occurrence into the
  pieces back-to-back (N-way generalisation of split "both").
- "Downbeat guillotine" reveal in the timeline (framer-motion): a
  phosphor blade drops on each cut staggered left->right, then each new
  piece deals in from its seam with a one-shot flash. Respects
  prefers-reduced-motion.

TDD: 24 new unit tests for sliceChunkIntoBars + applySliceToArrangement;
full suite green, typecheck clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@johannboehme
johannboehme merged commit 79006dd into main Jun 14, 2026
1 check passed
@johannboehme
johannboehme deleted the claude/heuristic-zhukovsky-3147de branch June 14, 2026 19:08
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.

1 participant

0