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

Unpitched grace note in a voice exports a malformed musicxml file #1732

Open
ggsimao opened this issue Sep 17, 2024 · 1 comment
Open

Unpitched grace note in a voice exports a malformed musicxml file #1732

ggsimao opened this issue Sep 17, 2024 · 1 comment

Comments

@ggsimao
Copy link

ggsimao commented Sep 17, 2024

music21 version

9.1.0

Problem summary
If there is an unpitched grace note in a measure with multiple voices, the exported musicxml is malformed, with the error being that the 'voice' element is not defined.

Steps to reproduce

from music21 import note, duration, stream
grace = note.Unpitched(duration=duration.GraceDuration())
v1 = stream.Voice(grace)
v2 = stream.Voice(note.Note())
stream.Measure([v1, v2]).show("musicxml")

Expected vs. actual behavior
The <voice> element should be after the <unpitched> element, but it comes before.

More information
I changed the line
helpers.insertBeforeElements(mxNote, mxUnpitched, tagList=['duration', 'type'])
in the unpitchedToXml method in the m21ToXml.py file to have the element 'voice' in the variable tagList and the output was well-formed. Not sure if it can cause a problem elsewhere.

@mscuthbert
Copy link
Member

Eeek but Not surprised -- never thought about unpitched grace-notes esp. w/ voices, but they are so common in percussion parts. Glad to take a fix or will try to work on it later.

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

No branches or pull requests

2 participants