-
Notifications
You must be signed in to change notification settings - Fork 29
Open
Labels
bugSomething isn't workingSomething isn't workingenhancementNew feature or requestNew feature or request
Description
As far as I can tell, it seems that grace notes are simply notes with a zero duration, which does work for simple cases like a single grace note, or a succession of single grace notes. However, grace notes can contain chords, such as in the ASAP score Liszt/Concert_Etude_S145/2:
In that case, I've observed two behaviours:
- 1, 3, 4: Partitura parses the grace notes correctly, however there is no way to tell if the grace notes are forming a chord, or were simply two successive grace notes.
- 2: Partitura fails to parse correctly the grace notes. It links the two grace notes from the second chord (A4-C#5) to the correct main note, and links the two grace notes from the first chord (A4-D5) to the next F# (probably due to some conflicting behaviour between chords and grace note processing):
Code
from pathlib import Path
import partitura as pt
import partitura.score
path = Path("~/Documents/datasets/asap-dataset/Liszt/Concert_Etude_S145/2/xml_score.musicxml").expanduser()
score = pt.load_musicxml(path)
part = score.parts[0]
measure = part.measures[8]
for element in part.iter_all(
cls=pt.score.Note,
include_subclasses=True,
start=measure.start.t,
end=measure.end.t,
):
if isinstance(element, pt.score.GraceNote):
print(" ", element)
else:
print(">>>", element)
>>> 576--588 Note id=None voice=1 staff=1 type=eighth articulations=(staccato) pitch=C#6
576--576 GraceNote id=None voice=1 staff=1 type=eighth pitch=F#5 main_note=576--588 Note id=None voice=1 staff=1 type=eighth articulations=(staccato) pitch=C#6
576--576 GraceNote id=None voice=1 staff=1 type=eighth pitch=A5 main_note=576--588 Note id=None voice=1 staff=1 type=eighth articulations=(staccato) pitch=C#6
>>> 588--600 Note id=None voice=5 staff=2 type=eighth articulations=(staccato) pitch=A5
588--588 GraceNote id=None voice=5 staff=2 type=eighth pitch=C#5 main_note=588--600 Note id=None voice=5 staff=2 type=eighth articulations=(staccato) pitch=A5
588--588 GraceNote id=None voice=5 staff=2 type=eighth pitch=F#5 main_note=588--600 Note id=None voice=5 staff=2 type=eighth articulations=(staccato) pitch=A5
>>> 600--612 Note id=None voice=1 staff=1 type=eighth articulations=(staccato) pitch=F#5
600--600 GraceNote id=None voice=1 staff=1 type=eighth pitch=A4 main_note=600--612 Note id=None voice=1 staff=1 type=eighth articulations=(staccato) pitch=F#5
600--600 GraceNote id=None voice=1 staff=1 type=eighth pitch=C#5 main_note=600--612 Note id=None voice=1 staff=1 type=eighth articulations=(staccato) pitch=F#5
>>> 612--624 Note id=None voice=1 staff=1 type=eighth articulations=(staccato) pitch=F#5
612--612 GraceNote id=None voice=1 staff=1 type=eighth pitch=A4 main_note=612--624 Note id=None voice=1 staff=1 type=eighth articulations=(staccato) pitch=F#5
612--612 GraceNote id=None voice=1 staff=1 type=eighth pitch=D5 main_note=612--624 Note id=None voice=1 staff=1 type=eighth articulations=(staccato) pitch=F#5
>>> 624--636 Note id=None voice=5 staff=2 type=eighth articulations=(staccato) pitch=A4
624--624 GraceNote id=None voice=5 staff=2 type=eighth pitch=F#4 main_note=624--636 Note id=None voice=5 staff=2 type=eighth articulations=(staccato) pitch=A4
>>> 636--648 Note id=None voice=1 staff=1 type=eighth articulations=(staccato) pitch=B4
636--636 GraceNote id=None voice=1 staff=1 type=eighth pitch=D4 main_note=636--648 Note id=None voice=1 staff=1 type=eighth articulations=(staccato) pitch=B4
636--636 GraceNote id=None voice=1 staff=1 type=eighth pitch=F#4 main_note=636--648 Note id=None voice=1 staff=1 type=eighth articulations=(staccato) pitch=B4
To summarize, there is two problems with how Partitura handles grace chords:
- There is no way to tell apart two successive grace notes from two simultaneous grace notes in a chord.
- This is probably not trivial to solve with the current implementation. It would likely be needed to rethink how the Partitura schema works, by defining a
Chord
object, containingNote
s. This would be quite a big change, and I'm not sure that we want to do this. There might be better ways of dealing with that, feel free to propose if you have any idea.
- This is probably not trivial to solve with the current implementation. It would likely be needed to rethink how the Partitura schema works, by defining a
- Successive grace chords seems to result in a bug in the main note attribution, resulting in some grace notes belonging to the wrong main note.
- This is why I also added the label "bug" to this issue. I could separate them into two issues, but as they are closely linked to the same underlying problem (support of grace chords), I felt like it might be better to let them together. Let me know if you would rather have two issues.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingenhancementNew feature or requestNew feature or request