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

Incompletely specified MusicXML files fail to read #46

Closed
vilim opened this issue Jun 9, 2020 · 3 comments · Fixed by #47
Closed

Incompletely specified MusicXML files fail to read #46

vilim opened this issue Jun 9, 2020 · 3 comments · Fixed by #47
Assignees
Labels
bug Something isn't working enhancement New feature or request

Comments

@vilim
Copy link

vilim commented Jun 9, 2020

The construction of MidiInstrumets and Notes fails for some files I exported through music21 in Python, because some elements are not specified. Even though defaults are provided in types.jl, the XML parser complains with errors like:

MethodError: Cannot `convert` an object of type Nothing to an object of type UInt64
Closest candidates are:
  convert(::Type{T}, !Matched::EzXML.NodeType) where T<:Integer at C:\Users\vilim\.julia\packages\EzXML\ZNwhK\src\node.jl:37
  convert(::Type{T}, !Matched::EzXML.ReaderType) where T<:Integer at C:\Users\vilim\.julia\packages\EzXML\ZNwhK\src\streamreader.jl:55
  convert(::Type{T}, !Matched::Unitful.Quantity) where T<:Real at C:\Users\vilim\.julia\packages\Unitful\ytsW0\src\conversion.jl:141
  ...

Stacktrace:
 [1] MusicXML.Note(::MusicXML.Pitch, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::String, ::Nothing, ::Nothing, ::EzXML.Node) at C:\Users\vilim\.julia\dev\MusicXML\src\types.jl:526
 [2] MusicXML.Note(::EzXML.Node) at C:\Users\vilim\.julia\packages\AcuteML\csjnr\src\@aml\@aml_create\get_struct_xml_.jl:53
...

the offending part of the XML file is for example:

<note>
  <grace/>
  <pitch>
    <step>G</step>
    <octave>4</octave>
  </pitch>
  <voice>1</voice>
  <type>16th</type>
  <stem>up</stem>
  <beam number="1">end</beam>
  <beam number="2">end</beam>
</note>
@aminya
Copy link
Member

aminya commented Jun 13, 2020

This is because the duration field is missing. Are grace notes always without duration? I did not know this and have made duration field mandatory. I will fix it in the next release.

@aminya aminya added bug Something isn't working enhancement New feature or request labels Jun 13, 2020
@aminya aminya self-assigned this Jun 13, 2020
@aminya aminya mentioned this issue Jun 13, 2020
@aminya
Copy link
Member

aminya commented Jun 13, 2020

The fixes are available now. Please let me know if you encountered any other errors.

@vilim
Copy link
Author

vilim commented Jun 13, 2020

Thank you! I switched to MIDI for this project, but will have a look again when I try other pieces of music.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants