简体   繁体   中英

Generating pdf & midi from musicxml

I've been trying to load a MusicXML file, edit it (removing several parts), and create a PDF sheet document + midi/mp3, all of this using Python.

I've first looked at music21 , that would load my MusicXML file right, but as far as I could find, would not output a proper file (all the details in the output files have disappeared, all that's left is the notes and the title)

Then I found abjad which looked promising. It did output great quality ly/pdf files, but there was no musicxml imported.

Then, I discovered that Lilypond comes with a musicxml2ly script. I was able to call it and get the result lilypond file in python using sh (great lib !) but then the abjad lilypond parser would not parse it (the doc says it parses a "large subset" for lilypond, without more precisions).

Finally, I found that music21 had an exporter to abjad python objects but it seems not to be present in the codebase anymore and the source code for the exporter clearly just exported the notes.

I'm a little out of options, what could I do to achieve these goals ?

(additional point : I still don't know how I'm going to do the second part, going to midi/mp3 using soundfonts, but that may not be the hardest part. Any suggestion ?)

If you have MuseScore 2, you can set it up in python

import music21
c = music21.converter.parse('path_to_musicxml.xml')
c.show('musicxml.pdf')
c.show('midi')

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM