Skip to content

w3c/mnxconverter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mnxconverter

A Python package for converting between MusicXML and the new MNX format.

Disclaimer

This is alpha software! The MNX format is being actively designed — so anything in this code might change.

This converter is also very limited in scope at the moment. So far, it only reliably converts the types of notations described in Comparing MNX and MusicXML.

Goals and non-goals

The goals of this code are:

  • Get a sense of how MNX "feels" in practice. Writing an importer and exporter forces us to reckon with design decisions in visceral, unavoidable ways. How easy are the data structures to understand and work with?

  • Get developers involved in the design process for MNX. Play with this code, see what it generates for your MusicXML files, consider how easy (or not) the concepts are to think about — then tell us what needs to change.

  • Eventually serve as a fully featured, production-ready converter between MNX and MusicXML. Not just an academic "reference implementation," but a real-world tool you can use in your music-notation product.

  • Eventually serve as a fully featured, production-ready "cleaner" for MusicXML files. This package contains (and will continue to develop) battle-tested heuristics for many odd music encoding situations. If you've got a library of MusicXML files that were generated by buggy software, you might be able to use this to improve the data quality of your files.

Non-goals are:

  • Becoming a general-purpose abstraction for music notation data in Python. This code includes data structures for notational concepts such as bars, notes, beams, etc. — but it's limited to its purpose of data-format conversion. These internal data structures will deliberately remain undocumented, so that we have the freedom to change them without worrying about backwards compatibility.

  • Any kind of consumer-facing tools such as rendering notation, providing a UI, doing musicology research or altering the semantics of notation data (transposing, editing, etc.).

How you can help

If you work with music notation software, your feedback is highly valued and appreciated. Here are specific types of help we want:

  1. Feedback on concepts. Read through the abstractions in mnxconverter/score.py. These classes are very closely aligned with the concepts of the MNX specification in general. Do they make sense? And do you envision it would be doable to integrate MNX in your notation app — for both import and export?

  2. Feedback on converter accuracy. Run the converter on your MusicXML files. Does it do the right thing? (Keep in mind the scope of the importer is still quite small.)

  3. Help with test cases. Have a collection of zany MusicXML files? Help expand the test suite and find bugs in the converter.

  4. Help with coding. Help implement new MNX features. Anything that's been specified in the spec is fair game for being implemented here.

Installation

This requires Python 3.7.

First, make sure you have lxml installed:

pip install lxml

To convert a MusicXML file, outputting the MNX file to standard output:

python convert.py your-file.musicxml

To run the test suite:

python runtests.py

Test suite

To add a test to the test suite, put two files in the tests directory: a MusicXML file and the expected MNX output. Make sure they have the same name, with two different extensions: .musicxml and .mnx. From then on, runtests.py will find the new test.

At the moment, the test runner looks for an exact match in the generated MNX markup. It would be better to ignore order of attributes, etc.

Credits

This is developed by Adrian Holovaty of Soundslice and the W3C Music Notation Community Group.

The MNX format was originally designed by Joe Berkovitz.

MusicXML was originally designed by Michael Good.

About

A Python package for converting between MusicXML and the new MNX-Common format.

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages