Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Render lilypond24a #195

Merged
merged 10 commits into from
Jan 4, 2024
Merged

Render lilypond24a #195

merged 10 commits into from
Jan 4, 2024

Conversation

jaredjj3
Copy link
Collaborator

@jaredjj3 jaredjj3 commented Jan 3, 2024

This PR renders lilypond24a by adding support for rendering grace notes. I used the reference implementations in vexflow gracenote_tests.

Divergences

  • lilypond incorrectly renders a slur when there is a grace slash.
  • vexml incorrectly renders succeeding grace notes (last note in measure 2).
  • MuseScore 4 incorrectly renders a slur.
  • Guitar Pro 7 does not seem to always render the correct grace note duration.

lilypond

image

vexml

image

osmd

image

MuseScore 4

image

Guitar Pro 7

image

@jaredjj3 jaredjj3 self-assigned this Jan 3, 2024
@jaredjj3
Copy link
Collaborator Author

jaredjj3 commented Jan 3, 2024

The current approach collects grace notes while accumulating context to make rendering.Note, rendering.Chord, and rendering.Rest objects. This works fine when grace notes are exclusively before the note they're modifying. However, the end of measure 2 shows that this isn't universally the case, since there's a grace note after a note.

I've made a lot of effort to avoid "lookahead" logic in rendering, because it tends to add a lot of complexity on an already-complex module. I'm going to try to solve this in the data layer, similar to how chords are rendered. In the musicxml.Note object, I'm going to add a getPrecedingGraceNotes(): musicxml.Note and getSucceedingGraceNotes(): musicxml.Note methods. If the musicxml.Note is a grace note, these methods should return empty arrays. Otherwise, I can perform the "lookahead" to see if a succeeding grace belongs to the note in question.

@jaredjj3
Copy link
Collaborator Author

jaredjj3 commented Jan 4, 2024

@rvilarl, when you get a chance, take a look at the vexml rendering in the first comment. There are two things I notice:

  1. Setting a position on a vexflow.GraceNoteGroup doesn't seem to affect it. For succeeding grace notes, I'm setting the position to vexflow.ModifierPosition.RIGHT, but it's still being rendered on the left (last note in measure 2).

  2. When an accidental is set on a grace note, the scale seems a little large for it — especially when compared to osmd and MuseScore 4.

I think these are both very minor issues, so I thought you'd be interested.

@jaredjj3 jaredjj3 marked this pull request as ready for review January 4, 2024 01:25
@jaredjj3 jaredjj3 merged commit 948a9d3 into master Jan 4, 2024
1 check passed
@jaredjj3 jaredjj3 deleted the lilypond branch January 4, 2024 01:25
@rvilarl rvilarl mentioned this pull request Jan 4, 2024
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