[icon]

GNU LilyPond

-- --

What is LilyPond
Home
Examples
Templates
Download
GNU/Linux binaries
Windows binaries
Source code
Documentation
Tutorial
Manual
Glossary
Index

Support
Mailing lists
Search
WikiWiki

External sites
lilypond.org/stable
lilypond.org/development
savannah.gnu.org
ftp.lilypond.org
Mutopia
Other music online

Advanced Topics

When translating the input to notation, there are number of distinct phases. We list them here:

The purpose of LilyPond is explained informally by the term `music typesetter'. This is not a fully correct name: Not only does the program print musical symbols, it also makes aesthetic decisions. Symbols and their placements are generated from a high-level musical description. In other words, LilyPond would be best described to be a `music compiler' or `music to notation compiler'.

LilyPond is linked to GUILE, GNU's Scheme library for extension programming. The Scheme library provides the glue that holds together the low-level routines and separate modules which are written in C++.

When lilypond is run to typeset sheet music, the following happens:

  • GUILE initialization: Various scheme files are read.
  • Parsing: First standard ly initialization files are read, then the user ly file is read.
  • Interpretation: The music in the file is processed `in playing order', i.e., the order that you use to read sheet music, or the order in which notes are played. The result of this step is a typesetting specification.
  • Typesetting: The typesetting specification is solved: positions and formatting is calculated.
  • The visible results ("virtual ink") are written to the output file.

During these stages different types of data play the the main role: During parsing, Music objects are created. During the interpretation, contexts are constructed, and with these contexts a network of graphical objects (`grobs') is created. These grobs contain unknown variables, and the network forms a set of equations. After solving the equations and filling in these variables, the printed output is written to an output file.

These threemanship of tasks (parsing, translating, typesetting) and data-structures (music, context, graphical objects) permeates the entire design of the program.


Parsing
The ly file is read and converted to a list of Scores, which each contain Music and paper/midi-definitions. Here Music, Pitch, and Duration objects are created.
Interpreting music

All music events are `read' in the same order as they would be played (or read from paper). At every step of the interpretation, musical events are delivered to interpretation contexts, which use them to build Grobs (or MIDI objects for MIDI output).

In this stage Music_iterators do a traversal of the Music structure. The music events thus encountered are reported to Translators, a set of objects that collectively form interpretation contexts.

Prebreaking

At places where line breaks may occur, clefs and bars are prepared for a possible line break.

Preprocessing

In this stage, all information that is needed to determine line breaking is computed.

Break calculation
The lines and horizontal positions of the columns are determined.
Breaking
Relations between all grobs are modified to reflect line breaks: When a spanner, e.g. a slur, crosses a line break, then the spanner is `broken into pieces'; for every line that the spanner is in, a copy of the grob is made. A substitution process redirects all grob references so that each spanner grob will only reference other grobs in the same line.
Outputting
All vertical dimensions and spanning objects are computed, and all grobs are output, line by line. The output is encoded in the form of Molecules

The data types that are mentioned here are all discussed in this section.

Go back to index of LilyPond.

Please send GNU LilyPond questions and comments to lilypond-user@gnu.org.

Please send comments on these web pages to (address unknown)

Copyright (c) 1997--2002 Han-Wen Nienhuys and Jan Nieuwenhuizen.

Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.


This page was built from LilyPond-1.7.14 (development-branch) by

Buchan Milne <(address unknown)>, Thu Mar 6 21:11:35 2003 CET.