Sort exported notes by step when same midi_pitch
#407
Merged
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.
In MusicXML export, the notes are currently sorted using their
midi_pitch
attribute. However, this can lead to inconsistent exports when the score contains notes that are enharmonic equivalents (such as D# and Eb, or B# and C), as the export will differ depending on the order the user inserts the notes in thePart
object:This PR simply adds the step as a second key for the sorting. Therefore, notes are first sorted by
midi_pitch
, and when they are enharmonic equivalents they are sorted bystep
, so that the export file is consistent no matter the order the notes are added to the score.This will solve a potential issue raised in the second message of #406.