lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

converting LilyPond score to XML


From: Wilbert Berendsen
Subject: converting LilyPond score to XML
Date: Wed, 4 Feb 2015 21:37:30 +0100

Friends,

there have been some efforts in the past to convert LilyPond music to
XML. One of the approaches would be to convert the LilyPond music tree
to XML and be able to process it with other tools, which could read the
XML and convert it to MusicXML or other XML music formats.

I have now written a script that can be included in a LilyPond file and
has functions that can map LilyPond score, music and markup objects
etc. to XML, which is written to the current output port (standard
output).

The script is here[1] and there is some documentation included and also
visible here[2].

[1]
https://github.com/wbsoft/python-ly/blob/master/ly/xml/xml-export.ily
[2]
http://python-ly.readthedocs.org/en/latest/ly.xml.html#the-xml-export-ily-file

Usage example:

  \include "/path/to/xml-export.ily"
  \displayLilyXML { c d e f }

The XML closely mimics the LilyPond music structure. Markup objects are
also properly converted, as are pitches, durations, moments, stencils,
generic scheme lists, strings, numbers, pairs, symbols etc.

If you are interested in output the LilyPond music structure in XML
format, please test and experiment with this. Note that it is not
MusicXML or another XML format, but just the LilyPond music in XML
notation. This could be further processed or analyzed with other tools.

I am planning to make the XML output as complete and well-structured as
possible. In the documentation I describe how the XML is structured. It
currently supports \score (and all the music and markup, (even scores
inside markup!), but I want to add \book and \bookpart support, and
support for \layout, \paper etc.

(Reason for writing this was that I am trying to design an intermediate
tree-structured storage for parsed LilyPond code in
python-ly/Frescobaldi. I decided to look at how LilyPond itself stores
the music and to possibly mimic that in the python-ly/Frescobaldi
parser.)

best wishes,
Wilbert Berendsen
Frescobaldi and python-ly developer


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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]