Skip to content

Fix LilyPond melody/guide tones staff overlap and web UI null checks - #18

Merged
johnksterling merged 1 commit into
mainfrom
fix/lilypond-melody-overlap-and-ui-nulls
Sep 20, 2026
Merged

johnksterling merged 1 commit into
mainfrom
fix/lilypond-melody-overlap-and-ui-nulls

Conversation

@johnksterling

Copy link
Copy Markdown
Owner

Summary

This PR addresses two issues:

  1. LilyPond Dual-Staff Formatting Overhaul:

    • Encloses melody and guide tones staves in a \new GrandStaff with explicit StaffGrouper.staff-staff-spacing (padding 3.5, basic distance 11) and system spacing overrides.
    • Eliminates hardcoded page-count = #1 compression when melody is enabled with multiple systems, allowing lead sheets to naturally paginate across pages without vertically colliding staves.
    • Groups simultaneous polyphonic/chord melody notes into chords (<pitch1 pitch2 ...>dur) rather than emitting them sequentially, preventing measure overflow.
    • Adds decomposeDuration and durationToSixteenths with exact sixteenth-unit tracking to guarantee measures always match the time signature duration and properly tie complex values.
    • Supports arbitrary meter full-measure rests (e.g. 5/4, 3/4) and exact skip durations (lilypondSkip) for device spanners.
    • Sorts and deduplicates harmony events across multi-voice MusicXML tracks (e.g. Blue Monk) to preserve correct chord chronological ordering.
  2. Web UI & API Null-Safety:

    • Initializes empty non-nil slices for chords, devices, and journeySpans in JSON responses to prevent front-end null.map() runtime exceptions on tunes with unharmonized measures.
    • Adds null-safety guards in ChordsTable, ScoreViewer, and App.
    • Rebuilds frontend bundle in web/dist.

Testing

  • go test -v ./... passes all unit and integration tests.
  • Tested LilyPond PDF & PNG generation across Autumn Leaves, Take Five (5/4 meter), Blue Monk (multi-voice blues), and Jordu, verifying zero barcheck warnings and clean layout.

…l checks

- LilyPond layout overhaul:
  - Enclose melody and guide tones staves in \new GrandStaff with explicit StaffGrouper vertical spacing overrides.
  - Make page-count = #1 conditional on single-staff or low-density scores so multi-system lead sheets paginate naturally without vertical squishing.
  - Group simultaneous melody notes into chords instead of sequential notes.
  - Add decomposeDuration and durationToSixteenths to ensure exact measure durations and tie handling across staves.
  - Handle full-measure rests across any time signature (e.g. 5/4, 3/4).
  - Use lilypondSkip for exact bracket and text spanner alignment.
- MusicXML import:
  - Sort and deduplicate harmony events across polyphonic voices to avoid inverted chord timing.
- Web UI & API:
  - Ensure API returns non-null arrays for chords, devices, and journeySpans.
  - Guard ChordsTable and App components against undefined or null chords/timeSignature.
@johnksterling
johnksterling merged commit 02e09fd into main Sep 20, 2026
3 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.

1 participant