"Grace note after" doesn't sound during playback

• May 16, 2016 - 10:33
Reported version
S5 - Suggestion

Grace notes "after" the anchor note do not sound during playback.

E.g. bars 20 & 22 in https://musescore.com/user/9743111/scores/2146431

Additionally, creating a slur between the note and the grace note after, the slur appears upside down until manually transformed.

Forum post that brought me here: https://musescore.org/en/node/111191

Cheers! Keep up the great work.


I don't understand the comment about slurs. They appear correctly for me. Can you post precise steps to reproduce that issue? Probably best to do so in a forum post, because my guess is whatever you are seeing is not a bug but a misunderstanding of some sort.

The slur appears upside down like this (attached) until I manually transform it. It makes the notes look unhappy.

Slurs appear up the right way for everything else I do. But this happens to me with grace notes after the note.

I selected the anchor note, ctrl+clicked the grace-note-after, then double clicked Lines > Slur in the palette, which is what I have been doing to create other slurs.

Do you think this is the right way up for a slur to a grace-note-after? Because in the palette, the icon shows the slur up the other way.

Attachment Size
grace note slur.PNG 1.91 KB

I tried the following:

1) I downloaded the score you linked to originally
2) deleted the slur from the last note of measure 20 to the grace note after
3) click the note
4) double click slur

This worked just fine. So if you are seeing something different, we'd need you to post the actual score you are having problems with and tell us exactly where you are trying to add this slur. Again, though, best to do this in a forum post, because it seems unrelated to the playback feature request.

What you describe should work, although instead of double clicking the slur, you could simply press the "S" key.

Aha! Your step 3 is not what I did.

When I follow your steps, it works correctly.

What I was doing differently was selecting both the main note, AND the grace note (with ctrl+click). Then double clicking the slur in the palette. (Pressing 'S' is the same.)

I can log this as a separate bug? To me it is a bug, because as a user, I have been selecting all the notes I want to slur together, i.e. with shift+click or ctrl+click, which seems logical to me, and has worked.


Well, the way it normally works is, you can select a *range* of notes to slur, or you can select just one note and it will create a slur from that note to the next. Ctrl+clicking individual notes isn't really the right way of creating a slur, but I can see it does happen to work, except in this case. So sure, file it as a bug.

??? I don't understand. I didn't mean to offend you, but I am sorry you seem to have taken it that way. As I said, the way you created the slur *does* mostly work except in this case, so it *is* a bug, and if you'd like to see it fixed, you should file it separately.

Reported version 2.1 3.0

I'm looking into the playback of the grace notes (after). But the issue of layout is beyond my expertise. Can we split this issue into two?

I have an implementation decision to make in the playback of grace notes.

BACKGROUND: MuseScore music capture supports two type of grace notes,
1) Acciaccatura, the grace note with a slash through it, which is played back very short,
it is actually played back as 65 milliseconds (or less for very short notes or fast tempo)
2) Appoggiatura, long grace notes with no slash, which is played back as 50% of the main note,
(different percentage for dotted and double dotted, don't understand why).

Currently only before grace notes are included in the playback.
Additionally grace-notes-after have no slash, so should evidently be treated as Appoggiatura
(long grace).

PROBLEM: suppose a note has an Appoggiatura before and also after. If both get 50% of the time, there will be no time remaining for the note.

QUESTION: what is the preferred way of dividing up the time between the note, before-grace, and after-grace.

1) total of before and after Appoggiatura should be 50%, so each grace note gets the same duration.
2) if there is a before only or after only it gets 50%, but if there are both, they get 33% each leaving 34% for the main note. This means if there are two before and 1 after, the before will be played faster than the after.
3) treat grace-notes-after as Acciaccatura (short 65ms notes) or some other constant duration.

If someone wants to suggest another implementation, please append to the issue. Otherwise please comment about which proposed solution is preferred.

@jim.newton.562 it seems there are actually two parts to your question...

1. How should grace-notes-after behave on their own?
2. How should they behave if there is also a grace-note-before?

You need an answer to (1) before you can tackle (2). The only case that I can think of for having a grace note *after* is to indicate the sub-notes in a trill or other ornament. Take this quote from Wikipedia:

"Sometimes it is expected that the trill will end with a turn (by sounding the note below rather than the note above the principal note, immediately before the last sounding of the principal note), or some other variation. Such variations are often marked with a few grace notes following the note that bears the trill indication."

Presumably the implementation should give the same effect as a "shake with turn".

Can anyone think of a different reason for having a grace note *after* the main note?

In my experience, grace notes after are meant to be very close to the beat that follows, normally following a trill (effectively, replacing what would be the last note(s) of the trill)). So more analogous to an acciaccatura.

Isn't it also common to have a sustained note ending with a grace note leading into the next note, but you want the next note to be on the downbeat rather than the grace note being on the downbeat?

Yes, which is what I meant by "analogous"—it certainly comes before the downbeat, but it's like an acciaccatura if the measure was played backwards. If that doesn't make sense, then never mind. You summarized it perfectly in comment #12 .

These are indeed the msot common use cases I can think of. But there are others. Some people use them as a tricky way of getting a one-sided tie (tie to invisible grace note after). I've also seen people use them to indicate the upper note in a trill, or to simply indicate an optional note. Pretty hard to get all these cases to work as expected, probably best to focus on the main one.

Presumably the user would disable playback for an invisible grace note anyway, so it doesn't matter how it sounds. I tend to use normal notes for optional notes and manually set them to be small in the Inspector, but if I ever did use a grace-note-after to represent an optional note then it should be short and before the beat.

There is a PR https://github.com/musescore/MuseScore/pull/2757
which implements this feature. Currently I've chosen to implement proposal 1 in comment #9
The total grace-before + grace-after = 50% and each note gets the same value.
So if there are 3 before and 2 after, they get 50% meaning each each grace note gets
10% of the main note's original unadorned value.

There are exceptions for dotted and double-dotted notes but this only effects the total-grace percentage, not the general strategy.

Please let me know if anyone has questions about the implementation.

@jim.newton.562, your implementation seems to use a behaviour that is not what was agreed upon even though (for once!) there was actually an agreement. @Isaac, @Marc and I all said that a grace-note-after should always be short (like an acciaccatura but before the beat). If you want to be exact then the duration should be equal to the duration of a sub-note of a trill since that is the most common usage, but it would probably be acceptable to make it equal to the current acciaccatura duration. The duration of each grace-note-after shouldn't be affected by the number of grace-notes-after (unless the main note is extremely short).

hi Shoogle, yes you're right I didn't follow the advise of the posters. I started the implementation before there was a consensus. The hard part was figuring out how to do it. It's not really hard to change the durations of the notes.

That being said, I think I do like the sound of what I implemented so far. I was wondering however, whether it would make sense for the trill/articulation code to also be aware of the graceNotesAfter, and treat them sort of like a trill suffix. That way their tempo would match the trill tempo exactly other than arbitrarily resolving to 65nm, which sounds awkward to my ear.

The potentially confusing part would be that grace-notes-after would change their behavior if you attach a trill to the note they are attached to. Would that be too confusing?

@jim, I don't think it would be confusing - that would actually be the ideal behaviour. It would be fantastic if articulation/ornaments/grace notes could be stacked and have the behaviour change! If that's something you are willing to implement then great, but if it is too much work then a fixed length should be fine.

So should grace notes before work the same way? If I put grace notes before a trill, shouldn't those notes just appear as a prefix to the trill in the same tempo? Is this different for Acciaccatura vs Appoggiatura?

I don't think there is a need to change the behaviour of grace notes before a trill, though others may disagree. However, I think the appoggiatura should always be "long" (half the length of the main note).

I might take your advise because, my code for merging the before and after graces notes into the trill works for the after-grace but not the before-grace. I wanted to finish debugging it, but I think I'll leave it to monday morning when the bug will probably be obvious after 5 minutes.

I've updated the PR https://github.com/musescore/MuseScore/pull/2757 to implement the graceNotesBefore and graceNotesAfter begin merged into the articulation such as a trill. It is not yet clear whether it is a good idea to that the graceNotesBefore as such? I can still change that so that graceNotesBefore are not effected by the note articulation, depending on the consensus. Personally, I like it. Nevertheless, I can change it.

There are some other crazy cases to consider to have a robust implementation.
Apparently grace notes are really grace chords. I.e., you can stack chords inside grace
notes. In addition each such note has a play-boolean.

What are the semantics of the play-boolean on notes within grace chords?
the Chord::graceNotesBefore() and Chord::graceNotesAfter() functions return all the before
or after grace notes, even the ones marked as play=false.

Is it the responsibility of the event generator to skip the ones with play=false?

What should happen if there are several grace notes, some of which have play=true and some with play=false?

If one of the grace notes is marked as play=false, does that effect the timing? E.g., if there are 4 graceNotesBefore, one of which is play=false, does that behave the same as 3 graceNotesBefore?

What if a trilled notes has grace notes, and the trill is marked play=false?

It seems there are lots and lots of possible combinations, of situations which is almost never occur in reality.

Is it the responsibility of the event generator to skip the ones with play=false?
Definitely, please do not change Chord::graceNotesBefore()/After() since this is used for layouting.

What should happen if there are several grace notes, some of which have play=true and some with play=false?
play=false notes are considered as rests in the other parts of rendermidi.

For grace chords, all the notes in the chord should be played at the same time I guess...

Status (old) active fixed

Fixed in branch master, commit 10ecb8bbc9

fix #111346: initial implementation of playback of graceNotesAfter
creating function graceNotesMerged
this entailed refactoring several data structure to make them visible globally.
used function graceNotesMerged to avoid duplicating grace notes if they are played by trill code.
added handing of play=false for grace note midi rendering
added test cases
updated test cases because of recent metronome changes on master

Severity S5 - Suggestion S4 - Minor
Reported version 2.2 2.3

I'm currently using version 2.3.2 with a revision of (too long for one line, see below):
OS: Ubuntu 18.04.1 LTS, Arch.: x86_64, MuseScore version (64-bit): 2.3.2, revision: 4592407
This bug is still not fixed (the note not playing one, not the slur one).

The way I suggest for this feature to implement is:
Treat grace notes literally, no matter how long they are, even if they occupy all of the whole interval (which leaves no time for the main note to play).
When the intervals of pre and post grace notes add up to a bigger value than the main interval, the algorithm will automatically cut them to fit, leaving the cut-out part as a normal note.

Severity S4 - Minor S5 - Suggestion
Status (old) active fixed
Status active fixed
Reported version 2.3 3.0

Fixed in master (so will be in 3.0) and there won't be more fixes or features for 2.x