-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
More beautiful default layout related to tremolos (fix #20390) (+ collect_artifacts) #5619
Conversation
Definitely a big improvement! I wonder though, if it's really necessary to make the stem so long with the hooks? Seems Gould is OK with the hooks overlapping a bit, and it looks less weird to me. Maybe 1sp less long for that second note? Also, I'm not sure the ramifications of altering stem length in "minAbs..." versus "default..." but be sure there are no weird dependencies where this causes, say, autoplaced text above the staff to not position itself properly. Could you do an update with "+ collect_artifacts" to make it easier for others to test? |
Under this musical font, you'll probably find the occasions of 16th and shorter notes pretty ugly, if the stem is shorter, even if an 8th note looks fine, because the offset of different hooks is, well, different. But if you then want to differentiate the offset based on note duration, then some other musical fonts, which have the same offset for all kinds of hooks, will not be happy too. Besides, this is not that weird to look at. Personally, I find shortening the stem another kind of "weird" too. |
Commit message or PR title? |
Commit message. See the "git workflow" documentation for MuseScore for more on build artifacts. I do this when I particularly want to get some real world testing of a proposed change, it allows people to download a nightly build without needing to build for themselves. |
180f8fe
to
01319ff
Compare
@MarcSabatella Done. I saw that artifacts had been attached to the build job. |
01319ff
to
84f0074
Compare
be487b0
to
1eb3628
Compare
libmscore/tremolo.cpp
Outdated
y1 = _chord1->stemPosBeam().y() - firstChordStaffY + _chord1->defaultStemLength(); | ||
y2 = _chord2->stemPosBeam().y() - firstChordStaffY + _chord2->defaultStemLength(); | ||
const std::array<double, 2> extendedLen | ||
= extendedStemLenWithTwoNoteTremolo(this, spatium(), _chord1->defaultStemLength(), _chord2->defaultStemLength()); | ||
y1 = _chord1->stemPos().y() - firstChordStaffY + extendedLen[0]; | ||
y2 = _chord2->stemPos().y() - firstChordStaffY + extendedLen[1]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In case anyone is wondering, regarding the stemPosBeam()
to stemPos()
change: this is intended. We're actually getting the y coordinate of stem tip here by calculating stem position (which is where it's attached to a note) and stem length. stemPosBeam()
gives the position of the nearest note to beam, whereas stemPos()
gives the real start position of the stem (the position of the furthest note to beam). So stemPosBeam()
is actually a bad mistake.
EDIT: In the PR description there's an example (tremolo in the third measure) of how this affects layout.
9b948ee
to
acd5da0
Compare
Hey Howard, looks way better. The note on the right belongs to the (not shown) staff below through cross-staffing. A screen capture of what is "supposed to be correct" is included here: The dotted lines are apparently to provide a visual aid as to how the placement should be considered. I figured since you seem to have a grip on what's going on, maybe you can check it out or something :) Anyways, thanks again for this PR. |
b1c8e59
to
6018579
Compare
@worldwideweary I'm working on it, but there're some problems I cannot get rid of very soon. I posted a question in the developers' chat and haven't get any answer yet. |
6018579
to
d44acb4
Compare
// if there is a two-note tremolo attached, and it is too steep, | ||
// extend stem of one of the chords (if not cross-staff) | ||
// or extend both stems (if cross-staff) | ||
// this should be done after the stem lengths of two notes are both calculated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess the problem you are having is that there is no way stem lengths can be known this early for the cross staff case, at least not if beams are involved. Probably not for the cross-measure case either. This is only finalized later.
While it might be possible to resolve these issues with some work, to me it would be acceptable to not do any such adjustment for cross-staff or cross-measure cases,and just let users contonue to need to adjust these manually. not sure how easy it is to detect cross-measure at this point though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aside: One of the issues of leaving customization of tremolos between notes up to the user is that the user can't adjust the "grow left/right" (cf. feather beams terminology) related to the tremolos (or maybe they can and I'm missing something). Although the placement algorithm works well enough for most use cases, maybe it would be appropriate to have inspector attributes for changing the angles of note tremolos for some "off cases", ... but that's another story.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MarcSabatella Manual adjustment can work for minim cross-staff tremolo and shorter, because you can adjust stem lengths. But for semibreve and longer there's no way of manual adjustment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Plus, there aren't any grips ("adjustment handles") for the tremolo strokes themselves. Inspector attributes are nice, but it's nicer to have grips ;-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True, I mixed up one and two note tremolos in my head here. Anyhow, I assume it's still the case that this isn't going to work here, you'd need to do this at the point where the stem length is actually calculated during cross-staff layout.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stem lengths are correct now, it's stemPos()
(or stem()->pagePos()
) that's wrong. But thanks for replying!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stem directions also are not known for sure until cross staff processing, and thus, stem positions too.
8c16ad2
to
42820ca
Compare
t = up ? -3.0 - (2.0 * (lines() - 1)) * td - 2.0 * sw : 3.0; | ||
} | ||
else { | ||
if (!up && !(line & 1)) // stem is down; even line |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I intend to align the conditionals, in this way it's clearer.
4aa34be
to
2d568a4
Compare
fix musescore#20390: tremolo through stem collide with ledger lines
…ng it in a Chord member function + provide a commented-out part of adjusting stem lengths for cross-staff two-note tremolos that currently isn't working in some cases
…Between() (+ collect_artifacts) The case of two chords having the same `up()` value is already taken care of in the usage of `extendedStemLenWithTwoNoteTremolo()`.
+ fix one bug regarding `_spatium` not considerated
2d568a4
to
dc08f91
Compare
@Howard-C vtests failed |
Yes, @AntonioBL told me failure just indicates some generated images were different from previous commits. It doesn't necessarily mean something went wrong. In this case, |
Not good for tremolos on grace notes. |
Behind Bars doesn't specify this, probably because the chance of adding tremolos to grace notes is too rare. But you're probably right. |
Same for small notes, so probably should get fixed in the same go |
This PR uses
minAbsStemLength()
for all stems with tremolos (default placement and placing mid-stem), after some modification.Below are a quick overview and some explanations. All layout principles stated below are in Behind Bars:
Layout diff:
See #5619 (review) for the layout change of the tremolo in the third measure
Fixes https://musescore.org/node/20390. The tremolo should be inside the staff. This is done here in
Tremolo::layoutOneNoteTremolo()
.Avoid collision between hook/beam and tremolo by extending stem. This is done in
Chord::minAbsStemLength()
with the calculation ofbeamLvl
andbeamDist
. It becomes very effective by calculating a fairly new variable: the vertical distance between note and the far edge of tremolo, which can be seen here.Set a minimum value and reasonable interval of note-tremolo distance, and extend stem accordingly. The former is done here in
Tremolo::layoutOneNoteTremolo()
. and the latter is done inChord::minAbsStemLength()
. This is based on the principle that nearest distance between chord and tremolo stroke should be no less than 1sp, which is represented by3.0
in the code.Reduce slope of beam stroke(s) if too steep by extending stem (if stem exists, which can automatically alter tremolo layout subsequently) or altering tremolo layout (if no stem). This is seen in various examples provided by Behind Bars. The new stem lengths are calculated in a new function
extendedStemLenWithTwoNotesTremolo()
, which is called after the default stem lengths of two notes are both calculated. Semibreves and longer notes don't have stem, so for those tremolos. the layout is directly altered. Since layout of these tremolos also depend on the concept of "stem length" even if there're no stem, in here,extendedStemLenWithTwoNotesTremolo()
is called externally to get the right layout.Avoid collison between beam and tremolo. This is also done in
Chord::minAbsStemLength()
.