MusicXML export - should it be a separate utility?

1,071 views
Skip to first unread message

Pavel Roskin

unread,
Jan 20, 2015, 1:40:42 AM1/20/15
to fresc...@googlegroups.com
Hello!

I have always assumed that there is no easy way to transform Lilypond
source to MusicXML. I was surprised to find "Export MusicXML"
functionality in the Frescobaldi menu. I'm even more surprised that
it's a part of Frescobaldi, not a separate utility.

I think that code should be a separate utility and Frescobaldi should
call it instead of using the internal code.

The reasons are:

Visibility. A project with a separate name and separate homepage would
be easier to find than a feature of Frescobaldi. Likewise, if
Frescobaldi users try to export to MusicXML and get a message that the
program is missing, they would know the name of the recommended
program for Lilypond to MusicXML conversion. Better visibility means
more contributors.

Batch processing. A non-GUI program can be used to process multiple
files automatically.

Testing. A separate program could have an extensive testsuite.

Fine tuning. A separate program can have many switches that would be
impractical to expose in GUI.

Tool choice. A separate program can be written in a programming
language more suitable for the task. It may use Guile or include parts
of Lilypond.

--
Regards,
Pavel Roskin

Peter Bjuhr

unread,
Jan 20, 2015, 4:51:14 AM1/20/15
to fresc...@googlegroups.com

On 2015-01-20 07:40, Pavel Roskin wrote:
> Hello!

Hello Pavel! Thanks for your thoughts! I'll try to explain some of the
reasoning behind the Frescobaldi export below.
>
> I have always assumed that there is no easy way to transform Lilypond
> source to MusicXML. I was surprised to find "Export MusicXML"
> functionality in the Frescobaldi menu. I'm even more surprised that
> it's a part of Frescobaldi, not a separate utility.
>
> I think that code should be a separate utility and Frescobaldi should
> call it instead of using the internal code.

Agreed, there should be a separate ly2musicxml in analogy with the
music2xml utility. But given that there isn't, a Frescobaldi tool is
better than nothing. You could see it as something of a temporary
compromise.

Actually there's a start-up for the development of the separate utility.
You can find it here: https://github.com/openlilylib/ly2xml

In addition the Frescobaldi exporter uses a totally different approach.
It's heavily integrated with ly.music which is built so that Frescobaldi
will have as much knowledge of the LilyPond source code as possible. It
creates a tree structure with information about the score. From this to
exporting the information as MusicXML the step is relatively small.

Overall I see no problem with Frescobaldi developing own solutions (also
an own importer could be a good idea I think). I think it's important to
have good tools for import and export to attract a wider user base. And
having alternative tools could be useful, especially given the
development activity of the stand-alone utilities.
>
> The reasons are:
>
> Visibility. A project with a separate name and separate homepage would
> be easier to find than a feature of Frescobaldi. Likewise, if
> Frescobaldi users try to export to MusicXML and get a message that the
> program is missing, they would know the name of the recommended
> program for Lilypond to MusicXML conversion. Better visibility means
> more contributors.
>
> Batch processing. A non-GUI program can be used to process multiple
> files automatically.

There actually is a non-GUI version of this as part of the ly module.
See https://pypi.python.org/pypi/python-ly
>
> Testing. A separate program could have an extensive testsuite.
I document the testing here:
https://github.com/openlilylib/ly2xml/wiki/musicXML-export-in-Frescobaldi#performed-tests
(Should be updated shortly).
>
> Fine tuning. A separate program can have many switches that would be
> impractical to expose in GUI.
>
> Tool choice. A separate program can be written in a programming
> language more suitable for the task. It may use Guile or include parts
> of Lilypond.
>

Agreed! To simplify things the Frescobaldi exporter can only export
music in LilyPond syntax and not music created by Guile/Scheme code.

To sum up, I think you have shown that separate tools have greater
potential. And when this potential is reached or even approached the
development of the tools internal to Frescobaldi could be stopped, or
perhaps integrated.

Best
Peter

Wilbert Berendsen

unread,
Jan 20, 2015, 6:20:16 PM1/20/15
to fresc...@googlegroups.com
Op Tue, 20 Jan 2015 01:40:41 -0500
Pavel Roskin <plro...@gmail.com> schreef:

> I think that code should be a separate utility and Frescobaldi should
> call it instead of using the internal code.

It is a separate utility, although not yet well known.
The functionality is contained in the ly tool.

https://pypi.python.org/pypi/python-ly

this provides (besides all python library functions that are also
contained in Frescobaldi) the ly commandline program that can do
various things.

converting to musicxml would be:

ly musicxml output.xml file.ly

Over the last year I moved all interesting stuff (e.g. transpose,
highlight, translate pitch names, reindent etc.) to the ly library
which is included in Frescobaldi but also separately packaged as the
python-ly package.

Installing python-ly and then running ly -h shows how the command can
be used.

Installing python-ly also installs the Python package 'ly', which
provides all functionality as a python library.

Hope this helps!

--
Wilbert Berendsen
(http://www.wilbertberendsen.nl)

Pavel Roskin

unread,
Jan 21, 2015, 9:19:25 PM1/21/15
to fresc...@googlegroups.com
That's all great, I guess this effort just needs more visibility.
Having good exporters is really needed for better Lilypond acceptance.
People want to have a Plan B. If they invest time typesetting music in
Lilypond, they want to have an option to switch to different software
without losing their work. Export to MusicXML offers that Plan B.

Pavel

Peter Bjuhr

unread,
Jan 22, 2015, 7:02:29 AM1/22/15
to fresc...@googlegroups.com

On 2015-01-22 03:19, Pavel Roskin wrote:
> That's all great, I guess this effort just needs more visibility.

I guess it will get more visibility ones it reaches the next level,
which I hope will happen very soon.
> Having good exporters is really needed for better Lilypond acceptance.
> People want to have a Plan B. If they invest time typesetting music in
> Lilypond, they want to have an option to switch to different software
> without losing their work. Export to MusicXML offers that Plan B.
>
I totally agree!

Best
Peter

david....@gmail.com

unread,
Feb 20, 2016, 9:00:46 AM2/20/16
to Frescobaldi
Hi all,

I am also looking for possibilities to convert ly to MusicXML. I could not find the UI functionality for that in Frescobaldi (Version 2.18.2, Mac OS X 10.11.2). Where is it supposed to be located?

As a good real world example I also tried a command line conversion of the first Arabesque by Debussy, available from the Mutopia Project (Download Link) using ly 0.9.3. Unfortunately this fails, I guess because no explicit time signature is defined:

Traceback (most recent call last):
 
File "/Library/Frameworks/Python.framework/Versions/3.4/bin/ly", line 4, in <module>
    sys
.exit(main())
 
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/ly/cli/main.py", line 277, in main
    c
.run(options, cursor, output)
 
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/ly/cli/command.py", line 191, in run
    writer
.parse_text(cursor.document.plaintext())
 
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/ly/musicxml/lymus2musxml.py", line 96, in parse_text
   
self.parse_document(doc)
 
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/ly/musicxml/lymus2musxml.py", line 109, in parse_document
   
self.parse_tree(mustree)
 
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/ly/musicxml/lymus2musxml.py", line 123, in parse_tree
   
self.parse_nodes(mus_nodes)
 
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/ly/musicxml/lymus2musxml.py", line 135, in parse_nodes
    func_call
(m)
 
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/ly/musicxml/lymus2musxml.py", line 332, in Tempo
   
self.mediator.new_tempo(0, (), tempo.tempo(), tempo.text())
 
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/ly/musicxml/ly2xml_mediator.py", line 734, in new_tempo
    tempo
.set_tempo(unit, durval2type(unit), beats, dots, text)
 
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/ly/musicxml/xml_objs.py", line 696, in set_tempo
   
self.tempo = TempoDir(unit, unittype, beats, dots, text)
 
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/ly/musicxml/xml_objs.py", line 738, in __init__
   
self.midi = self.set_midi_tempo(unit, beats, dots)
 
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/ly/musicxml/xml_objs.py", line 746, in set_midi_tempo
    u
= Fraction(1, int(unit))
 
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/fractions.py", line 167, in __new__
   
raise ZeroDivisionError('Fraction(%s, 0)' % numerator)
ZeroDivisionError: Fraction(1, 0)


Are there any updates on the progress of ly2xml development? Is this feature actively developed? Can the community contribute anything to help?

Best,
Dave

Peter Bjuhr

unread,
Feb 21, 2016, 5:35:19 AM2/21/16
to fresc...@googlegroups.com


On 2016-02-20 15:00, david....@gmail.com wrote:

I am also looking for possibilities to convert ly to MusicXML. I could not find the UI functionality for that in Frescobaldi (Version 2.18.2, Mac OS X 10.11.2). Where is it supposed to be located?

This is still an experimental feature, so you have to enable the experimental features in the general preferences. Then you'll find it under File -> Export.
Yes, that is the command line verson from the Python-ly repo, that also Frescobaldi uses. I'll take a look at this error, hopefully during the day!


Are there any updates on the progress of ly2xml development? Is this feature actively developed? Can the community contribute anything to help?

The documentation we have is this: https://github.com/wbsoft/python-ly/wiki/Export-LilyPond-to-MusicXML

I'm very happy for anybody that uses the exporter! Using the latest version and reporting any issue on the Python-ly issue tracker https://github.com/wbsoft/python-ly/issues would be a great contribution! Anybody is of course also welcome to contribute with PR:s (Pull Requests)!

Best
Peter

Reply all
Reply to author
Forward
0 new messages