Skip to content

Size the gap between staves to the chords in each system - #9

Merged
PaulJoshi merged 1 commit into
mainfrom
claude/sheet-staff-gap
Oct 3, 2026
Merged

PaulJoshi merged 1 commit into
mainfrom
claude/sheet-staff-gap

Conversation

@PaulJoshi

Copy link
Copy Markdown
Owner

Requested by Paul · project thread

Before: with note names on, the sheet left room under every staff for the biggest chord anywhere in the piece. One 4-note chord pushed the treble and bass staves apart in every system, even where both hands only play single notes.

After: each staff gets only the room its own chords' name pills need, measured under each chord. Simple passages stay tight, and the gap grows only in systems that hold big chords. With names on, the full Für Elise sheet is 24% shorter (7,436 to 5,687 px at 1440 wide) and the full Gymnopédie No. 1 from #7 is 17% shorter. Pieces with single notes look the same as before.

How: SheetView no longer adds a constant to OSMD's MinSkyBottomDistBetweenStaves/MinSkyBottomDistBetweenSystems. reservePillSpace wraps two steps of OSMD's layout calculator. After the sky/bottom lines are computed, it records how low each staff line's notes reach. After fingerings, dynamics and pedals are placed (just before OSMD spaces the staves), it lowers the bottom line under each staff entry by that entry's stack of pills. OSMD's own staff-distance optimisation then does the rest. The pill overlay draws from the same recorded depth, so the pills land in the reserved space.

Checked: npm run typecheck, npx vitest run (108 passed, 5 skipped), npm run build, and the full Playwright suite (10 passed). I compared before/after screenshots of Für Elise (Full), Gymnopédie No. 1 (Full, with #7 applied locally) and the Prelude in C with note names on, and saw no page errors.

🤖 Generated with Claude Code

https://claude.ai/code/session_014oVTjqwWe51bFsyUnDqaeJ


Generated by Claude Code

The sheet reserved room for the note-name pills by widening every staff gap
by the biggest chord in the whole piece, so one 4-note chord spread every
system apart. Now OSMD's bottom line is lowered only under each chord by its
own stack of pills, so the gap follows what each system actually holds.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014oVTjqwWe51bFsyUnDqaeJ
@vercel

vercel Bot commented Oct 3, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
open-keys Ready Ready Preview Oct 3, 2026 9:24am UTC

@PaulJoshi PaulJoshi self-assigned this Oct 3, 2026
@PaulJoshi
PaulJoshi merged commit 9c97c77 into main Oct 3, 2026
4 checks passed

This branch was successfully deployed

1 active deployment
Preview — 23251b69 Deployed Oct 3, 2026 by vercel[bot]
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