[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Using lilypond as a music layout library
From: |
Tom Shackell |
Subject: |
Using lilypond as a music layout library |
Date: |
Tue, 11 Sep 2007 15:03:57 +0100 |
User-agent: |
Thunderbird 1.5.0.13 (X11/20070824) |
Hi All,
I was wondering whether it would be possible to extract lilypond's
layout code and use it as a general library for performing music layout.
That is to say a programmer would pass lilypond unformatted musical
notation (as a data structure) and lilypond would perform layout and
return the data structure now with positional information for all the
components.
The reason this would be desirable is that laying out music nicely is
difficult and lilypond is well known for the quality of its output.
Someone wanting to write a WYSIWYG GUI for note-editing (for example)
could then re-use all the hard work that has gone in lilypond to do the
layout of the music on the screen.
Theoretically this should be possible. I would imagine that Lilypond's
code is split into:
- parsing and processing .ly files
- laying out the musical notation
- converting the notation with layout into output of some form
(for example postscript).
It would, in principal at least be possible to separate the part that
performs layout from the rest of the code. However there are several
practical concerns:
- the modularity of lilypond's design. It could simply be that
lilyponds components are too tightly integrated to make this
separation possible.
- incremental layout. For the purposes of producing a GUI
it would have to be possible to perform incremental layout to some
degree. At least to the point of only asking lilypond to
recalculate layout the current bar/line/page. It is possible
lilypond has been written assuming a 'one-shot' approach in which
case making lilypond work incrementally would be almost impossible.
- performance generally. An interactive editor would need to perform
layout with relatively good performance. Incremental layout is
perhaps the biggest component here but it could be that lilypond is
simply too slow for this kind of task.
One point is that even if the entire layout engine could not be
extracted parts of the algorithm could still be useful. For example
perhaps only having the code to do 'vertical' layout, i.e. deciding how
notation on the beat-line should be arranged, even if the horizontal
layout of the beat-line is undefined.
So anyway I would be interested to know whether people think extracting
the layout code is feasible or is broadly impossible/impractical.
Thanks for your help :-)
Tom
- Using lilypond as a music layout library,
Tom Shackell <=