When using fret diagrams, the "Chord/RestDuration" option for the Realize Chord Symbol tool does not work.

• Aug 31, 2020 - 01:54
Reported version
S3 - Major

Steps to Reproduce:
1. Put a fret diagram on a measure.
2. Set the Chord Symbol Duration in the inspector to "Chord/Rest Duration".
3. Use the Tool > Realize Chord Symbol function on the fret diagram chord. The chord will be "realized" as if the "Until Next Chord Symbol" duration was set, which is the default duration.



Note that even with the fix, the results of this setting aren't necessarily what you might expect. If you have a whole note with a chord symbol above it, you might expect a whole note chord. But if there's another chord symbol on beat 3, that's not what you get - which is a good thing, or else it would overlap the chord on beat three. On the other hand, you also get only two beats if there is anything on beat three, like on another staff. So, my PR here fixes the bug, but not the more basic flaw, which is that this option just doesn't make all that much sense in many cases.

Status PR created fixed

Fixed in branch 3.x, commit b161ed8dab

_fix #309852: undefined playback chord symbol attached to fret diagram

Resolves: https://musescore.org/en/node/309852

If a chord symbol has "Chord/Rest Duration" in its playback properties,
and the chord symbol has a fret diagram as a parent,
then the results are not defined, but can potentially crash,
as we are casting the parent to a segment when it isn't.
This yields an assertion failure in debug builds,
just randomly bad results in release builds.

Avoiding the crash is simple, I changed parent() to getParentSeg().
I realize, though, that segment duration isn't really the same
as chord/rest duration, since there might be content on other tracks
that results in the segment duration being shorter.
Or, for that matter, another chord symbol on this track.
Eventually we should look at really making this chord/rest duration.
My initial attempt created corruption if there was in fact
another chord symbol on the same track before the end
of the current chord/rest duration.
Fixing this is no doubt possible, and something to consider.
I left a TODO for this._

In reply to by Jojo-Schmitz

I have a question and a comment about this issue. My question is, where can I get the fixed 3.5.1 version? My comment is, I am not sure whether this issue has anything to do with the issue of the "Chord/Rest Duration" not really giving you a chord duration that lasts until the next Chord/Rest. Is this maybe a different issue that requires a new comment?

In reply to by Marc Sabatella

Marc, it took me a while to understand what you are saying about the "basic flaw" in the Chord/Rest Duration setting. Now I know. If any instrument in your score (lets say you have 6 instruments) has, for example, a 16th note that is directly above or below a chord symbol on any staff, the duration of that chord symbol will be 16th note. IMO, that is a major flaw, not a "basic" flaw. Shouldn't the chord symbol reflect the duration attributable to ONLY that instrument's staff? Why would the programming "logic" look at the duration on other staves to decide what the duration should be on this staff. Sounds like the programming logic is more complicated doing it that way.

In reply to by odelphi231

First, because chord symbols aren’t attached to specific notes but to time positions on a staff that may have 1 note, different notes of different durations on the same staff, or no notes at all. so there really isn’t such a thing as the one true duration of the current chord.

Second, more important, is the very real possibility of ending up with overlap. Add a whole note to a measure, then add chords to beats one and three. Do you really want that first chord realized as a whole note and then have a second chord (of who knows what duration since there is no note there) to overlap it starting in beat? That’s a corrupt score right there.

So certain compromises have to be made. The feature was primarily designed to be useful for simple lead sheets (one staff, one voice), and the current behavior is pretty optimum for that.

In reply to by Marc Sabatella

I can deal with the way it works now. Not a major issue since I know how to handle it. But I don't really understand your example. If a measure has a whole note on a 4/4 (empty measure), then you add chords to beat one and three, beats two and four would only be 1/4 note rests. So you wouldn't have a chord realized as a whole note. It "should" realize the beats 2 and 4 as 1/4 note chords - no overlap. Or are you talking about a whole note on one staff, but chords on beat 1 & 3 on a different staff? In that case, YES, I would want a whole note on the staff that has the whole note. Am I missing something here?
EDIT: I just wanna say something about your first paragraph. Maybe I am different from how other people use the chord symbols, but when I want to "Realize a chord symbol" I want to ADD a chord/notes, where there is NOT one already. Therefore, I only wanna realize a chord symbol on a REST, not on existing notes. So I want the chord duration to be the duration of that rest on THAT staff. You seems to be implying people wanna realize a chord symbol on a note, which would overwrite the notes. If that is the case, then your first paragraph makes sense - it would be programmatically difficult to know what the duration should be if you are overwriting existing notes that can be any combination of notes/rests.

My example is literally just a whole note with chord symbols on 1 & 3 - not rests on 2 & 4:


It's important to realize that the "realize chord symbol" option is not the main usage of chord symbols. Mostly we expect people will just use the default playback. So that is what the "chord/rest duration" is mostly expected to be used for, not people trying to realize chord symbols onto otherwise empty staves. Of course, that's what "realize chord symbols" is for, but it should be expected to work the same as the generic playback, not do something unrelated that only makes sense for blank staves. And anyhow, if the staff if blank, then chord/rest duration by definition makes no sense. I guess one common use case could be a lead sheet with rhythmic slash notation, if you have a slash one beat one followed by three beats rest, chord/rest duration gives you exactly that.

In reply to by Marc Sabatella

Ok, you will have to show me how to do that. When I do Ctrl-K (chord symbol), unless I click on a note or rest, it gives me an error message. So I don't know how to put the F-chord symbol, in your example.
EDIT: I figured it out. I can see you wanting to do that for like Fake book leadsheets, but I am transcribing completely written out scores. No one thought that anyone would want to use "realize chord" for that reason? I mostly do it when the bass staff has a single note line for some instrument but I wanna "fill out" the sound with chords on an additional instrument that I added. Maybe the piece is piano only but I wanna an organ part or another lead part and a bass part. So I do a chord then explode the chord into different lines.
So am not using it for single line leadsheets where you only want the chord symbol above the staff that may or may not be attached to a single note (as you noted, pun intended).
EDIT (part 2). It is also useful if I am transcribing a piece that doesn't have guitar tabs/chord symbols already above the score - older scores. I use a chord realization plugin, to tell me the chord, then I realize the chord. Yes, I know how to figure out the chord without a plugin and what beat it should be on, but I am lazy.

Again, it’s not that we do t expect to use Realize Chord Symbols, it’s that this is expected to be by far the less common way of using the feature. So first we needed to make sure the basic playback feature worked. Then the Realize Chord Symbol feature simply uses the same algorithms. So it is important that at one time does any of this risk corrupting your score.

I’m not saying other algorithms wouldn’t be possible to implement some day. But for now, the algorithms are what they are, designed for a specific workflow that Just might happen to differ from yours.

Fix version