Skip to content

Conversation

@iveshenry18
Copy link
Contributor

@iveshenry18 iveshenry18 commented Jul 29, 2021

Resolves: ENG-91: Excessive hidden staves cause note import to fail

Dolet sometimes exports scores with up to 10 staves, most of which are
hidden. Since MuseScore has a MAX_STAFF limit of 4, such scores are
corrupted (and many other issues are introduced when there are parts
with greater than 2 staves).

This commit adds a mechanism for discarding these hidden staves in such
cases. In doing so, it also must implement a mapping from MusicXML staff
number to index in the Part's Staff list. Therefore, this commit also
adds a function to MusicXmlPart that applies this mapping if present,
or defaults to decrementing the value, and uses this function wherever
the MusicXML staff number is read.

In addition to this mechanism, this PR contains a commit that increases the
MAX_STAVES constant from 4 to 10. This particular commit probably ought
NOT be ported to master.

Also adds handling for staff-size, which is relevant to many scores with hidden staves
(where hidden staves are for ornament clarification).

Also, this fixes the handling of some corner cases involving part-group barline spanning and brackets/braces.
The spec is somewhat ambiguous about some of the defaults here, but these adjustments are
sensible and produce better results in many complicated scores.

Also, this adds a fix for default <pedal> handling, adding a Pedal element to the score
rather than Symbol elements, which fixes layout and playback issues.

Finally, this is built on the commit from #8447.

  • I signed CLA
  • I made sure the code in the PR follows the coding rules
  • I made sure the code compiles on my machine
  • I made sure there are no unnecessary changes in the code
  • I made sure the title of the PR reflects the core meaning of the issue you are solving
  • I made sure the commit message(s) contain a description and answer the question "Why do those changes fix that particular issue?" or "Why are those changes really necessary as improvements?"
  • I made sure the commit message title starts with "fix #424242:" if there is a related issue
  • I created the test (mtest, vtest, script test) to verify the changes I made

@iveshenry18 iveshenry18 force-pushed the ENG-91-mozart-disaster branch from 0a01616 to cb067eb Compare July 31, 2021 03:21
@iveshenry18 iveshenry18 force-pushed the ENG-91-mozart-disaster branch from eaccb93 to 36a75bb Compare August 3, 2021 21:34
@iveshenry18 iveshenry18 changed the title [MU3 Backend] ENG-91: Fix parts with excessive hidden staves [MU3 Backend] ENG-91: Fix parts with excessive hidden staves (and related issues) Aug 3, 2021
@iveshenry18 iveshenry18 force-pushed the ENG-91-mozart-disaster branch 2 times, most recently from f944310 to 2557919 Compare August 4, 2021 05:50
Currently, MuseScore displays copyright metadata in a centered footer.
This results in the information being displayed on every page, which
is inconsistent with many published scores.

This commit hides the footers on import and rather creates a VBox,
populates it with the copyright metadata, and places it at the bottom
of the first page (either below the first explicit pagebreak, or below
the last system of the first page after an initial layout).
Dolet sometimes exports scores with up to 10 staves, most of which are
hidden. Since MuseScore has a MAX_STAFF limit of 4, such scores are
corrupted.

This commit adds a mechanism for discarding these hidden staves in such
cases. In doing so, it also must implement a mapping from MusicXML staff
number to index in the Part's Staff list. Therefore, this commit also
adds a function to MusicXmlPart that applies this mapping if present,
or defaults to decrementing the value, and uses this function wherever
the MusicXML staff number is read.
The best fix for the majority of excess-staff related issues
is simply to increase the MAX_STAVES constant to accomodate them.
This doesn't seem to cause any problems with MusicXML import. That said,
since this variable is so ubiquitous and may be misused or hard-coded
somewhere sneaky, and because this may cause performance reduction,
I don't recommend this be ported to master without thorough testing.
@Jojo-Schmitz
Copy link
Contributor

rebase needed

Previously, barlines would only span to 2 staves, even if the part had
more staves. This commit changes that so all but the bottom staff has
barLineSpan set to true if in the same part or group.

This commit also ensures that multi-staff parts have braces by default,
even if they are part of a group that doesn't have a bracket or brace.

Also, this commit adds a small condition that prevents redundant
brackets (which are sometimes exported by Dolet) from being imported.

In the above fixes, many tests had to be tweaked to account for changes
in the underlying data which mostly don't effect presentation.
When line and sign are not specified on a pedal element, they default
to "no" and "yes" respectively. Previously, this was handled by adding
Symbol elements for the "Ped." and "*" markings. These would layout
poorly and were inconsistent with pedal markings added to the score
manually.

This commit better handles this default case, and also makes the
corresponding changes to the export code to correctly handle such
pedal markings.
This commit adds a map of ticks where print-object is specified for
each staff. This map is then referred to when importing directions,
throwing the direction out when a staff has been hidden.

TODO: use this map in more places to enforce hidden staves (i.e. in note
import).
This commit adds code to cleanupLayoutBreaks() that attempts to reduce
the size of the copyrightVBox by 20% if it is present and there is page
overflow
Dolet tends to erroneously export tab staves at 150% scale. This looks
terrible (and less like the original Sibelius file), so this commit
adds a check to the staff-size import code that checks for and
ignores attempts to increase the scale of a tab staff.
@iveshenry18 iveshenry18 force-pushed the ENG-91-mozart-disaster branch from 5c99bbc to eb40844 Compare August 5, 2021 18:49
In MusicXML, instrument names and abbreviations aren't necessarily
meant to be displayed in notation. Nonetheless, due to the instrument
creation process on import this would occur, even in scores where
part-name and part-abbreviation are set to "no".

This commit fixes that, and to that end creates member functions of
Part that change the name of EVERY instrument in the part (rather than
just the first one).
This commit adds a mechanism by which automatically-added part braces
only cover normal staves.

More specifically, there is now a function that finds the largest
contiguous span of non-hidden, non-small staves, and the brace is
applied to that span of staves. Also, small and hidden staves no longer
have spanned barlines.

In pursuit of this, there are various utility functions added, as well
as improved consistency with naming for mxmlStaff (1-based) and msStaff
(0-based, may not include all mxmlStaff values).
Sometimes Dolet exports instrument changes erroneously as staff text.
This commit adds a function for hiding these.
Previously, the VoiceList was indexed by QString. This caused incorrect
voice ordering when there are more than 10 voices due to QString sorting
issues (e.g. "1", "10", "11", "2", "3", etc.).

This commit refactors the key to an int, since most exporters use ints
as voices. For those that use non-int strings, that string is hashed to
an int using qHash.
@vpereverzev vpereverzev merged commit 08e4002 into musescore:3.6.2_backend Aug 9, 2021
Jojo-Schmitz pushed a commit to Jojo-Schmitz/MuseScore that referenced this pull request Aug 9, 2021
Currently, MuseScore displays copyright metadata in a centered footer.
This results in the information being displayed on every page, which
is inconsistent with many published scores.

This commit hides the footers on import and rather creates a VBox,
populates it with the copyright metadata, and places it at the bottom
of the first page (either below the first explicit pagebreak, or below
the last system of the first page after an initial layout).

Duplicate of musescore#8763, part 1
Jojo-Schmitz pushed a commit to Jojo-Schmitz/MuseScore that referenced this pull request Aug 9, 2021
Dolet sometimes exports scores with up to 10 staves, most of which are
hidden. Since MuseScore has a MAX_STAFF limit of 4, such scores are
corrupted.

This commit adds a mechanism for discarding these hidden staves in such
cases. In doing so, it also must implement a mapping from MusicXML staff
number to index in the Part's Staff list. Therefore, this commit also
adds a function to MusicXmlPart that applies this mapping if present,
or defaults to decrementing the value, and uses this function wherever
the MusicXML staff number is read.

Duplicate of musescore#8763, part 2
Jojo-Schmitz pushed a commit to Jojo-Schmitz/MuseScore that referenced this pull request Aug 9, 2021
The best fix for the majority of excess-staff related issues
is simply to increase the MAX_STAVES constant to accomodate them.
This doesn't seem to cause any problems with MusicXML import. That said,
since this variable is so ubiquitous and may be misused or hard-coded
somewhere sneaky, and because this may cause performance reduction,
I don't recommend this be ported to master without thorough testing.

Duplicate of musescore#8763, part 3
Jojo-Schmitz pushed a commit to Jojo-Schmitz/MuseScore that referenced this pull request Aug 9, 2021
Jojo-Schmitz pushed a commit to Jojo-Schmitz/MuseScore that referenced this pull request Sep 23, 2021
This commit adds code to cleanupLayoutBreaks() that attempts to reduce
the size of the copyrightVBox by 20% if it is present and there is page
overflow

Duplicate of musescore#8763, part 9
Jojo-Schmitz pushed a commit to Jojo-Schmitz/MuseScore that referenced this pull request Sep 23, 2021
Duplicate of musescore#8763, part 11, plus fixing a merge conflict
Jojo-Schmitz pushed a commit to Jojo-Schmitz/MuseScore that referenced this pull request Sep 23, 2021
In MusicXML, instrument names and abbreviations aren't necessarily
meant to be displayed in notation. Nonetheless, due to the instrument
creation process on import this would occur, even in scores where
part-name and part-abbreviation are set to "no".

This commit fixes that, and to that end creates member functions of
Part that change the name of EVERY instrument in the part (rather than
just the first one).

Duplicate of musescore#8763, part 12
Jojo-Schmitz pushed a commit to Jojo-Schmitz/MuseScore that referenced this pull request Sep 26, 2021
Currently, MuseScore displays copyright metadata in a centered footer.
This results in the information being displayed on every page, which
is inconsistent with many published scores.

This commit hides the footers on import and rather creates a VBox,
populates it with the copyright metadata, and places it at the bottom
of the first page (either below the first explicit pagebreak, or below
the last system of the first page after an initial layout).

Duplicate of musescore#8763, part 1
Jojo-Schmitz pushed a commit to Jojo-Schmitz/MuseScore that referenced this pull request Sep 26, 2021
Dolet sometimes exports scores with up to 10 staves, most of which are
hidden. Since MuseScore has a MAX_STAFF limit of 4, such scores are
corrupted.

This commit adds a mechanism for discarding these hidden staves in such
cases. In doing so, it also must implement a mapping from MusicXML staff
number to index in the Part's Staff list. Therefore, this commit also
adds a function to MusicXmlPart that applies this mapping if present,
or defaults to decrementing the value, and uses this function wherever
the MusicXML staff number is read.

Duplicate of musescore#8763, part 2
Jojo-Schmitz pushed a commit to Jojo-Schmitz/MuseScore that referenced this pull request Sep 26, 2021
When line and sign are not specified on a pedal element, they default
to "no" and "yes" respectively. Previously, this was handled by adding
Symbol elements for the "Ped." and "*" markings. These would layout
poorly and were inconsistent with pedal markings added to the score
manually.

This commit better handles this default case, and also makes the
corresponding changes to the export code to correctly handle such
pedal markings.

Duplicate of musescore#8763, part 6, fixing an mtest, maybe due to skipped commits
Jojo-Schmitz pushed a commit to Jojo-Schmitz/MuseScore that referenced this pull request Sep 26, 2021
This commit adds code to cleanupLayoutBreaks() that attempts to reduce
the size of the copyrightVBox by 20% if it is present and there is page
overflow

Duplicate of musescore#8763, part 9
Jojo-Schmitz pushed a commit to Jojo-Schmitz/MuseScore that referenced this pull request Sep 26, 2021
Duplicate of musescore#8763, part 11, plus fixing a merge conflict
Jojo-Schmitz pushed a commit to Jojo-Schmitz/MuseScore that referenced this pull request Sep 26, 2021
In MusicXML, instrument names and abbreviations aren't necessarily
meant to be displayed in notation. Nonetheless, due to the instrument
creation process on import this would occur, even in scores where
part-name and part-abbreviation are set to "no".

This commit fixes that, and to that end creates member functions of
Part that change the name of EVERY instrument in the part (rather than
just the first one).

Duplicate of musescore#8763, part 12
Jojo-Schmitz pushed a commit to Jojo-Schmitz/MuseScore that referenced this pull request Sep 29, 2021
Currently, MuseScore displays copyright metadata in a centered footer.
This results in the information being displayed on every page, which
is inconsistent with many published scores.

This commit hides the footers on import and rather creates a VBox,
populates it with the copyright metadata, and places it at the bottom
of the first page (either below the first explicit pagebreak, or below
the last system of the first page after an initial layout).

Duplicate of musescore#8763, part 1
Jojo-Schmitz pushed a commit to Jojo-Schmitz/MuseScore that referenced this pull request Sep 29, 2021
Dolet sometimes exports scores with up to 10 staves, most of which are
hidden. Since MuseScore has a MAX_STAFF limit of 4, such scores are
corrupted.

This commit adds a mechanism for discarding these hidden staves in such
cases. In doing so, it also must implement a mapping from MusicXML staff
number to index in the Part's Staff list. Therefore, this commit also
adds a function to MusicXmlPart that applies this mapping if present,
or defaults to decrementing the value, and uses this function wherever
the MusicXML staff number is read.

Duplicate of musescore#8763, part 2
Jojo-Schmitz pushed a commit to Jojo-Schmitz/MuseScore that referenced this pull request Sep 29, 2021
When line and sign are not specified on a pedal element, they default
to "no" and "yes" respectively. Previously, this was handled by adding
Symbol elements for the "Ped." and "*" markings. These would layout
poorly and were inconsistent with pedal markings added to the score
manually.

This commit better handles this default case, and also makes the
corresponding changes to the export code to correctly handle such
pedal markings.

Duplicate of musescore#8763, part 6, fixing an mtest, maybe due to skipped commits
Jojo-Schmitz pushed a commit to Jojo-Schmitz/MuseScore that referenced this pull request Sep 29, 2021
This commit adds code to cleanupLayoutBreaks() that attempts to reduce
the size of the copyrightVBox by 20% if it is present and there is page
overflow

Duplicate of musescore#8763, part 9
Jojo-Schmitz pushed a commit to Jojo-Schmitz/MuseScore that referenced this pull request Sep 29, 2021
Duplicate of musescore#8763, part 11, plus fixing a merge conflict
Jojo-Schmitz pushed a commit to Jojo-Schmitz/MuseScore that referenced this pull request Sep 29, 2021
In MusicXML, instrument names and abbreviations aren't necessarily
meant to be displayed in notation. Nonetheless, due to the instrument
creation process on import this would occur, even in scores where
part-name and part-abbreviation are set to "no".

This commit fixes that, and to that end creates member functions of
Part that change the name of EVERY instrument in the part (rather than
just the first one).

Duplicate of musescore#8763, part 12
Jojo-Schmitz pushed a commit to Jojo-Schmitz/MuseScore that referenced this pull request May 12, 2022
Currently, MuseScore displays copyright metadata in a centered footer.
This results in the information being displayed on every page, which
is inconsistent with many published scores.

This commit hides the footers on import and rather creates a VBox,
populates it with the copyright metadata, and places it at the bottom
of the first page (either below the first explicit pagebreak, or below
the last system of the first page after an initial layout).

Duplicate of musescore#8763, part 1
Jojo-Schmitz pushed a commit to Jojo-Schmitz/MuseScore that referenced this pull request May 12, 2022
Dolet sometimes exports scores with up to 10 staves, most of which are
hidden. Since MuseScore has a MAX_STAFF limit of 4, such scores are
corrupted.

This commit adds a mechanism for discarding these hidden staves in such
cases. In doing so, it also must implement a mapping from MusicXML staff
number to index in the Part's Staff list. Therefore, this commit also
adds a function to MusicXmlPart that applies this mapping if present,
or defaults to decrementing the value, and uses this function wherever
the MusicXML staff number is read.

Duplicate of musescore#8763, part 2
Jojo-Schmitz pushed a commit to Jojo-Schmitz/MuseScore that referenced this pull request May 12, 2022
When line and sign are not specified on a pedal element, they default
to "no" and "yes" respectively. Previously, this was handled by adding
Symbol elements for the "Ped." and "*" markings. These would layout
poorly and were inconsistent with pedal markings added to the score
manually.

This commit better handles this default case, and also makes the
corresponding changes to the export code to correctly handle such
pedal markings.

Duplicate of musescore#8763, part 6, fixing an mtest, maybe due to skipped commits
Jojo-Schmitz pushed a commit to Jojo-Schmitz/MuseScore that referenced this pull request May 12, 2022
This commit adds code to cleanupLayoutBreaks() that attempts to reduce
the size of the copyrightVBox by 20% if it is present and there is page
overflow

Duplicate of musescore#8763, part 9
Jojo-Schmitz pushed a commit to Jojo-Schmitz/MuseScore that referenced this pull request May 12, 2022
Duplicate of musescore#8763, part 11, plus fixing a merge conflict
Jojo-Schmitz pushed a commit to Jojo-Schmitz/MuseScore that referenced this pull request May 12, 2022
In MusicXML, instrument names and abbreviations aren't necessarily
meant to be displayed in notation. Nonetheless, due to the instrument
creation process on import this would occur, even in scores where
part-name and part-abbreviation are set to "no".

This commit fixes that, and to that end creates member functions of
Part that change the name of EVERY instrument in the part (rather than
just the first one).

Duplicate of musescore#8763, part 12
Jojo-Schmitz pushed a commit to Jojo-Schmitz/MuseScore that referenced this pull request Mar 5, 2023
Currently, MuseScore displays copyright metadata in a centered footer.
This results in the information being displayed on every page, which
is inconsistent with many published scores.

This commit hides the footers on import and rather creates a VBox,
populates it with the copyright metadata, and places it at the bottom
of the first page (either below the first explicit pagebreak, or below
the last system of the first page after an initial layout).

Duplicate of musescore#8763, part 1
Jojo-Schmitz pushed a commit to Jojo-Schmitz/MuseScore that referenced this pull request Mar 5, 2023
Dolet sometimes exports scores with up to 10 staves, most of which are
hidden. Since MuseScore has a MAX_STAFF limit of 4, such scores are
corrupted.

This commit adds a mechanism for discarding these hidden staves in such
cases. In doing so, it also must implement a mapping from MusicXML staff
number to index in the Part's Staff list. Therefore, this commit also
adds a function to MusicXmlPart that applies this mapping if present,
or defaults to decrementing the value, and uses this function wherever
the MusicXML staff number is read.

Duplicate of musescore#8763, part 2
Jojo-Schmitz pushed a commit to Jojo-Schmitz/MuseScore that referenced this pull request Mar 5, 2023
When line and sign are not specified on a pedal element, they default
to "no" and "yes" respectively. Previously, this was handled by adding
Symbol elements for the "Ped." and "*" markings. These would layout
poorly and were inconsistent with pedal markings added to the score
manually.

This commit better handles this default case, and also makes the
corresponding changes to the export code to correctly handle such
pedal markings.

Duplicate of musescore#8763, part 6, fixing an mtest, maybe due to skipped commits
Jojo-Schmitz pushed a commit to Jojo-Schmitz/MuseScore that referenced this pull request Mar 5, 2023
This commit adds code to cleanupLayoutBreaks() that attempts to reduce
the size of the copyrightVBox by 20% if it is present and there is page
overflow

Duplicate of musescore#8763, part 9
Jojo-Schmitz pushed a commit to Jojo-Schmitz/MuseScore that referenced this pull request Mar 5, 2023
Duplicate of musescore#8763, part 11, plus fixing a merge conflict
Jojo-Schmitz pushed a commit to Jojo-Schmitz/MuseScore that referenced this pull request Mar 5, 2023
In MusicXML, instrument names and abbreviations aren't necessarily
meant to be displayed in notation. Nonetheless, due to the instrument
creation process on import this would occur, even in scores where
part-name and part-abbreviation are set to "no".

This commit fixes that, and to that end creates member functions of
Part that change the name of EVERY instrument in the part (rather than
just the first one).

Duplicate of musescore#8763, part 12
Jojo-Schmitz pushed a commit to Jojo-Schmitz/MuseScore that referenced this pull request Nov 7, 2023
Backport of musescore#11953

Mu3 doesn't allow for staves to get hidden, only parts, at least that is what I guess to be the reason for the mtest failure, so need to adjust the newly added mtest file

Also need to fix another mtest file which doesn't exist in Mu4, as it stems from (the backport of) musescore#8763, part 2, which never got ported to master.
Jojo-Schmitz pushed a commit to Jojo-Schmitz/MuseScore that referenced this pull request Nov 14, 2023
Backport of musescore#11953

Mu3 doesn't allow for staves to get hidden, only parts, at least that is what I guess to be the reason for the mtest failure, so need to adjust the newly added mtest file

Also need to fix another mtest file which doesn't exist in Mu4, as it stems from (the backport of) musescore#8763, part 2, which never got ported to master.
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.

4 participants