JuliaMusic / MusicTheory.jl

Music theory in Julia
MIT License
47 stars 1 forks source link

Add MusicXML compatibility #15

Open dpsanders opened 9 months ago

NeroBlackstone commented 5 months ago

Hi, It's great to see you contribute this package, it's exactly what this organization needs. I originally wanted to implement the features in this package in MIDI.jl, but now it seems too good to be true, so MIDI.jl can focus on MIDI parsing.

I think there is still a lot of work to be done on MusicXML support at this point.

  1. MusicXML.jl is not actively maintained and has not been updated for a long time.
  2. MusicXML.jl uses AcuteML.jl as a mapper to convert XML files and Julia types. But we have to define the structure of MusicXML julia types manually, rather than automatically generated from the official MusicXML 4.0 schema, which may cause some unexpected behavior in MusicXML file parsing.
  3. Unfortunately, Julia still does not have a ready-made tool for converting XSD to julia types, so maybe we need to implement it ourselves.
dpsanders commented 5 months ago

Unfortunately I personally don't know anything about XML or MusicXML, but it if you are able to implement that it would be fantastic! I'm happy to help where I can of course.

NeroBlackstone commented 5 months ago

Unfortunately I personally don't know anything about XML or MusicXML, but it if you are able to implement that it would be fantastic! I'm happy to help where I can of course.

Thank you very much!

I don't think this will happen anytime soon, the continued maintenance of MusicXML.jl requires a lot of work. At least I think that MusicXML.jl is not performing very well right now, and there are many scores that cannot be parsed correctly.

I think we can keep this issue open until we have a mature MusicXML.jl.

NeroBlackstone commented 5 months ago

Another thing I want to emphasize is whether we have to implement MusicXML export in MusicTheory.jl?

In my opinion we should separate concerns and make this package contain only music theory stuff.

Other packages in this organization have made similar mistakes. One package implements a feature that should be implemented by another package

My suggestion is to let MusicManipulation.jl do the corresponding MusicXML/Lilypond export function. Make this package contain music theory content only.

Until we have identified the compatibility issues of related functions, we will make the minimum necessary changes . This achieves orthogonality in the functionality of each software package within the organization.

NeroBlackstone commented 5 months ago

All in all, I think this package should focus on "The computable part of music theory”, like pitch, notes, chords, duration, intervals, modes.

Other features should be added with caution or contributed to other packages within the organization.

dpsanders commented 5 months ago

I totally agree about orthogonality. Ideally this package could effectively be a MusicBase.jl package that other packages depend on for basic types representing notes etc.

NeroBlackstone commented 5 months ago

Ideally this package could effectively be a MusicBase.jl package that other packages depend on for basic types representing notes etc.

In fact, in my own practice, trying to design universal symbolic musical structures would lead to enormous complexity.

The basic types in MusicTheory.jl should focus only on music theory calculations. In practice, to map the data in symbolic music files, different packages use different types to represent notes. For example, the Note in MIDI.jl is actually an abstraction of the Note On and Note Off events, while the Note in MusicXML.jl contains the necessary musical notation information.

Therefore, I personally think that the types in MusicTheory.jl should not exist as base types for other packages, but only provide basic data conversion compatible with other symbolic music types.

In short, focusing on the implementation of music theory and providing minimal support for other symbolic music will improve the cohesion of this package.

Thank you again for your work and for filling the gap in this organization. I just want to share some of my personal experience and reach some consensus before further development. I think this will be of some benefit to the subsequent development of this package.

dpsanders commented 5 months ago

OK thanks, that makes sense. I'm interested to see what you come up with.