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

Make sure gap rests correspond to the <location> gap duration #22931

Open
wants to merge 64 commits into
base: master
Choose a base branch
from

Conversation

lpugin
Copy link
Contributor

@lpugin lpugin commented May 21, 2024

Make sure that filling gaps uses only rest with valid DurationType. This means sometimes adding more than one rest (still flagged as gap). Adjust the MEI exporter accordingly.

@lpugin
Copy link
Contributor Author

lpugin commented May 21, 2024

These are the images of the visual test failing

chord-layout-dots-2-1

chord-layout-dots-2-1 ref

I am not sure what the difference is?

@lpugin
Copy link
Contributor Author

lpugin commented May 22, 2024

To give a little more background to the PR. When deleting rests when there is more than one voice, a location gap is added in the MuseScore file. A gap cannot always be represented with one single valid duration type (e.g., a half-note and a 16th note will be a gap of 9/16. This change makes sure that when the gap is filled, this is done with the number of rests needed to avoid invalid duration types.

@Jojo-Schmitz
Copy link
Contributor

Jojo-Schmitz commented May 22, 2024

Don't worry about thise vtests, the difference is minimal, see
chord-layout-dots-2-1 diff
and
chord-layout-dots-2-1 diff

But what about those failing unit tests?

@lpugin
Copy link
Contributor Author

lpugin commented May 22, 2024

But what about those failing unit tests?

Sorry, I missed these. I'll have a look.

@lpugin lpugin marked this pull request as draft May 22, 2024 21:03
@cbjeukendrup
Copy link
Contributor

I'm not 100% sure about those VTests. This looks like it's not just a rounding error. It might mean that gap rests can somehow affect horizontal spacing, which is of course not desirable, but also wouldn't be in scope of this PR to fix, in my opinion. Anyway, let's wait for a more official comment from the Engraving team.

rettinghaus and others added 5 commits May 23, 2024 09:26
* The removed block was creating a rest not necessarily corresponding to the gap, yield issues in the MEI exporter
@mike-spa
Copy link
Contributor

mike-spa commented May 23, 2024

I don't understand the reason for this change. What issue is it solving? If it isn't solving any specific issue, I would prefer it to stay as it is, because
a) We are representing something that's doesn't exist as a musical element, it's just there to fill a gap, so it's better to have a single gap-filling object, why have more than one?
b) There could be other logic in the program that relies on there being a single gap-rest. If we were solving an issue, it would be worth the risk of changing it, but if we are not why take that risk?
c) If we split the gap rest into several rests, it also creates more stuff for the horizontal spacing system to compute (it's not as trivial as "just ignore them": they create segments, segments have a duration, duration corresponds to spacing, etc, there's some math in place to deal with that). That is likely the reason for the vtest differences, but it's also a waste of performance. Not big, but still a waste.

Transpose keysigs in parts after changing instrument
@lpugin
Copy link
Contributor Author

lpugin commented May 23, 2024

It solves problems (such as in the MEI exporter) where the gap is filled with a rest that is actually not representing the duration of the gap. This seems like problematic data to me. Making sure that rests used to fill gaps actually represent the duration of the gaps seems to be of higher priority than the performance impact of the extra processing yielded, which I expect to be not significant.

Also, one thing that I noticed is that MuseScore is not consistent when creating these gaps. If you take the following situation:
image
And delete the two invisible rests at the beginning of the second voice, MuseScore will create one location gap:

<location>
  <fractions>9/16</fractions>
</location>

if you delete the 16th note rest first and the half-note rest after, but two location gaps:

<location>
  <fractions>1/2</fractions>
</location>
<location>
  <fractions>1/16</fractions>
</location>

if you delete the half-note reset first.

Loading the file with two location gaps will create two rests, so I assume that creating two rests when there is one location gap should be fine too.

@lpugin
Copy link
Contributor Author

lpugin commented May 23, 2024

(PS as it stands, MuseScore inserts a dotted half note rest for the 9/16 gap, which is one 16th note too long)

RomanPudashkin and others added 28 commits May 27, 2024 15:09
New dynamics properties for voicing and stave positioning
…layback_fix

FIx musescore#21244: Ensure all tracks are updated when a caesura is edited
MusicXML: Add support for part-name-display
MusicXML: set all note components invisible
MEI: make measure repeat symbol explicit
feat: add import/export of rehearsal marks to MEI support
* The removed block was creating a rest not necessarily corresponding to the gap, yield issues in the MEI exporter
@mike-spa
Copy link
Contributor

Gap rests have been known in the past to cause a lot of problems (score corruptions, most prominently), so forgive me if I am extremely hesitant to change anything related to them, especially now as we're entering a stabilization phase.

In general, my impression has always been that gap rests are a horrible hack to work around the limitations of our representation model, so I'd prefer to work out a comprehensive solution to improve the model (and if possible get rid of them entirely) rather than keep working with them.

@lpugin I do see the merit of the change you're proposing, and it may indeed be a good thing to do until we have a better solution to replace them. We'll come back to this after the release.

@lpugin
Copy link
Contributor Author

lpugin commented Jun 18, 2024

@mike-spa thank you for the feedback. I understand the need to be careful with this since score corruption is very annoying. I think the proposed change remains very minimal and should make things more consistent, which I would expect to be helpful. But of course, no problem for waiting until after the release.

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.

None yet