GNU LilyPond is a computer program and file format for music engraving. One of LilyPond's major goals is to produce scores that are engraved with traditional layout rules, reflecting the era when scores were engraved by hand.

The LilyPond project was started in 1996 by Han-Wen Nienhuys and Jan Nieuwenhuizen, after they decided to abandon work on MPP (MusiXTeX PreProcessor), a project they began collaborating on in 1995.[4][5] Its name was inspired both by the Rosegarden project and an acquaintance of Nienhuys and Nieuwenhuizen named Suzanne, a name that means lily in Hebrew (שׁוּשָׁן).[6]

LilyPond is mostly written in C++ and uses Scheme (interpreted by GNU Guile) as its extension language, allowing for user customization.[9] It has a relatively large codebase; as of March 21, 2015, the source comprises over 600,000 lines of C++ and 120,000 lines of Scheme and Python code.[10]

Screenshot of LilyPond running on Linux

It uses a simple text notation for music input, which LilyPond interprets and processes in a series of stages.[11] In the final stage, music notation is output to PDF (via PostScript) or other graphical formats, such as SVG or PNG. LilyPond also has the facility to generate MIDI files that correspond to the music notation output.

LilyPond is a text-based application, so it does not contain its own graphical user interface to assist with score creation. It does, however, have a flexible input language that strives to be simple, easing the learning curve for new users. LilyPond adheres to the WYSIWYM paradigm; the workflow for typesetting music notation with LilyPond is similar to that of preparing documents with LaTeX.

LilyPond's primary goal is to produce output comparable to professionally engraved scores instead of output that looks mechanical and computer-generated. An essay from the LilyPond website, written by LilyPond developers, explains some typographical issues addressed by LilyPond:[13]

Optical font scaling: depending on the staff size, the design of the music font is slightly altered; this is a feature that Donald Knuth'sComputer Modern font is known for. As a result, note heads become more rounded, and staff lines become thicker.

Optical spacing: stem directions are taken into account when spacing subsequent notes.

Special ledger line handling: ledger lines are shortened when accidentals are nearby, thus enhancing readability.

Proportional spacing: notes can be positioned in such a way that exactly reflects their duration. For example, with this setting, the space between consecutive quarter notes is four times greater than between consecutive sixteenth notes.[14]

The native input language for LilyPond is comprehensive, consisting of many commands needed for expressing any sort of articulation, dynamic, meter, etc. The ability to embed Scheme code within a LilyPond source file permits arbitrary extensions to the input language and assists with algorithmic composition. Some general syntactic features are listed below.

Notes are represented in pitch-duration format: pitch is specified with Helmholtz pitch notation, and duration is specified with a numeral based system. The semantics of the pitch-duration format change depending on the active input mode; this is explained in depth in the LilyPond manual. For example, in absolute mode, a'4 is an A, one octave up from the base A (A3 in scientific pitch notation), of quarter note length.[16]

Commands usually begin with a backslash (such as \time, or \slurUp). The function of the command in question determines where the command is placed; for example, if the command is used to indicate a fixed dynamic on a specific note, it is placed after the note.[17]

Some common commands are represented symbolically to ease typing. One example is with slurs, where ( and ) indicate the beginning and ending of a slur, respectively.[18] Another example is with manual beaming, where [ and ] indicate the extent of the beam.[19]

LilyPond's interface with Pango requires the input character encoding to be UTF-8.[20] One benefit of this is that more than one language can be included in the same source file.

Several graphical scorewriters—such as Rosegarden, NoteEdit, Canorus, Denemo, and TuxGuitar—can export files directly to LilyPond format. Other graphical applications serve as front ends to LilyPond, including Frescobaldi and the LilyPondTool plugin for jEdit. Denemo integrates the PDF output of LilyPond in its display, allowing some editing operations on the final typeset score.

The Mutopia Project, which distributes free content sheet music, uses LilyPond to typeset its music, as does Musipedia, a collaborative music encyclopedia.

Sorry, your browser either has JavaScript disabled or does not have any supported player.
You can download the clip or download a player to play the clip in your browser.

The above excerpt is a simplified version of Solfeggio in C Minor by C.P.E. Bach. More complex scores, including lyrics, are also possible within MediaWikis. See Pastime with Good Company for an example.