This file documents GNU LilyPond.
Copyright 1999–2004 by the authors
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections. A copy of the license is included in the section entitled “GNU Free Documentation License”.
This is the user manual for GNU LilyPond 2.2 series. (See the bottom of this page for the exact version number).
A further source of information is the website, which can be found at http://www.lilypond.org/. The website contains on-line copies of this and other documentation.
We would like to dedicate this program to all the friends that we met through music.Han-Wen and Jan
It must have been during a rehearsal of the EJE (Eindhoven Youth Orchestra), somewhere in 1995 that Jan, one of the cranked violists told Han-Wen, one of the distorted French horn players, about the grand new project he was working on. It was an automated system for printing music (to be precise, it was MPP, a preprocessor for MusiXTeX). As it happened, Han-Wen accidentally wanted to print out some parts from a score, so he started looking at the software, and he quickly got hooked. It was decided that MPP was a dead end. After lots of philosophizing and heated email exchanges Han-Wen started LilyPond in 1996. This time, Jan got sucked into Han-Wen's new project.
In some ways, developing a computer program is like learning to play an instrument. In the beginning, discovering how it works is fun, and the things you cannot do are challenging. After the initial excitement, you have to practice and practice. Scales and studies can be dull, and if you are not motivated by others—teachers, conductors or audience—it is very tempting to give up. You continue, and gradually playing becomes a part of your life. Some days it comes naturally, and it is wonderful, and on some days it just does not work, but you keep playing, day after day.
Like making music, working on LilyPond is can be dull work, and on some days it feels like plodding through a morass of bugs. Nevertheless, it has become a part of our life, and we keep doing it. Probably the most important motivation is that our program actually does something useful for people. When we browse around the net we find many people that use LilyPond, and produce impressive pieces of sheet music. Seeing that feels unreal, but in a very pleasant way.
Our users not only give us good vibes by using our program, many of them also help us by giving suggestions and sending bug reports, so we would like to thank all users that sent us bug reports, gave suggestions or contributed in any other way to LilyPond.
Playing and printing music is more than nice analogy. Programming together is a lot of fun, and helping people is deeply satisfying, but ultimately, working on LilyPond is a way to express our deep love for music. May it help you create lots of beautiful music!
Han-Wen and Jan
Utrecht/Eindhoven, The Netherlands, July 2002.
During the 2.1 development cycle, the cleanup of the existing features has continued unabated. Major areas of improvement are orchestral notation, lyrics formatting and font size handling.
Han-Wen and Jan
Utrecht/Eindhoven, The Netherlands, March 2004.
LilyPond is a system for formatting music prettily. This chapter discusses the backgrounds of LilyPond. It explains the problem of printing music with computers, and our approach to solving those problems.
The art of music typography is called (plate) engraving. The term derives from the traditional process of music printing. Just a few decades ago, sheet music was made by cutting and stamping the music into a zinc or pewter plate in mirror image. The plate would be inked, the depressions caused by the cutting and stamping would hold ink. An image was formed by pressing paper to the plate. The stamping and cutting was completely done by hand. Making a correction was cumbersome, if possible at all, so the engraving had to be perfect in one go. Engraving was a highly specialized skill, a craftsman had to complete around ten years of practical training before he could be a master engraver.
Nowadays, all newly printed music is produced with computers. This has obvious advantages; prints are cheaper to make, editorial work can be delivered by email. Unfortunately, the pervasive use of computers has also decreased the graphical quality of scores. Computer printouts have a bland, mechanical look, which makes them unpleasant to play from.
The images below illustrate the difference between traditional engraving and typical computer output, and the third picture shows how LilyPond mimics the traditional look. The left picture shows a scan of a flat symbol from a Henle edition published in 2000. In the center show symbol from a hand engraved Bärenreiter edition of the same music. The left scan illustrates typical flaws of computer print: the staff lines are thin, the weight of the flat symbol matches the light lines and it has a straight layout with sharp corners. By contrast, the Bärenreiter flat has a bold, almost voluptuous rounded look. Our flat symbol is designed after, among others, this one. It is rounded, and its weight harmonizes with the thickness of our staff lines, which are also much thicker than Henle's lines.
![]() |
![]() |
![]() | |
Henle (2000) | Bärenreiter (1950) |
LilyPond Feta font (2003)
|
In spacing, the distribution of space should reflect the durations between notes. However, many modern scores adhere to the durations with mathematical precision, which leads to a poor result. In the next example a motive is printed twice. It is printed once using exact mathematical spacing, and once with corrections. Can you spot which fragment is which?
The fragment only uses quarter notes: notes that are played in a constant rhythm. The spacing should reflect that. Unfortunately, the eye deceives us a little; not only does it notice the distance between note heads, it also takes into account the distance between consecutive stems. As a result, the notes of an up-stem/down-stem combination should be put farther apart, and the notes of a down-up combination should be put closer together, all depending on the combined vertical positions of the notes. The first two measures are printed with this correction, the last two measures without. The notes in the last two measures form down-stem/up-stem clumps of notes.
Musicians are usually more absorbed with performing than with studying the looks of piece of music; nitpicking about typographical details may seem academical. But it is not. In larger pieces with monotonous rhythms, spacing corrections lead to subtle variations in the layout of every line, giving each one a distinct visual signature. Without this signature all lines would look the same, they become like a labyrinth. If the musician looks away once or has a lapse in his concentration, he will be lost on the page.
Similarly, the strong visual look of bold symbols on heavy staff lines stands out better when music is far away from reader, for example, if it is on a music stand. A careful distribution of white space allows music to be set very tightly without cluttering symbols together. The result minimizes the number of page turns, which is a great advantage.
This is a common characteristic of typography. Layout should be pretty, not only for its own sake, but especially because it helps the reader in his task. For performance material like sheet music, this is doubly important: musicians have a limited amount of attention. The less attention they need for reading, the more they can focus on playing itself. In other words, better typography translates to better performances.
Hopefully, these examples also demonstrate that music typography is an art that is subtle and complex, and to produce it requires considerable expertise, which musicians usually do not have. LilyPond is our effort to bring the graphical excellence of hand-engraved music to the computer age, and make it available to normal musicians. We have tuned our algorithms, font-designs, and program settings to produce prints that match the quality of the old editions we love to see and love to play from.
How do we go about implementing typography? If craftsmen need over ten years to become true masters, how could we simple hackers ever write a program to take over their jobs?
The answer is: we cannot. Typography relies on human judgment of appearance, so people cannot be replaced ultimately. However, much of the dull work can be automated. If LilyPond solves most of the common situations correctly, this will be a huge improvement over existing software. The remaining cases can be tuned by hand. Over the course of years, the software can be refined to do more and more automatically, so manual overrides are less and less necessary.
When we started we wrote the LilyPond program entirely in the C++ programming language, the program's functionality was set in stone by the developers. That proved to be unsatisfactory for a number of reasons:
These problems have been addressed by integrating the GUILE interpreter for the Scheme programming language and rewriting parts of LilyPond in Scheme. The new, flexible formatting is built around the notion of graphical objects, described by Scheme variables and functions. This architecture encompasses formatting rules, typographical style and individual formatting decisions. The user has direct access to most of these controls.
Scheme variables control layout decisions. For example, many graphical objects have a direction variable that encodes the choice between up and down (or left and right). Here you see two chords, with accents and arpeggio. In the first chord, the graphical objects have all directions down (or left). The second chord has all directions up (right).
The process of formatting a score consists of reading and writing the variables of graphical objects.
Some variables have a preset value. For example, the thickness of many lines—a characteristic of typographical style—are preset variables. Changing them gives a different typographical impression
Formatting rules are also preset variables: each object has variables containing procedures. These procedure perform the actual formatting, and by substituting different ones, we can change behavior. In the following example, the rule that note head objects use to produce their symbol is changed during the music fragment
The formatting process in LilyPond decides where to place symbols. However, this can only be done once it is decided what symbols should be printed, in other words what notation to use.
Common music notation is a system of recording music that has evolved over the past 1000 years. The form that is now in common use, dates from the early renaissance. Although, the basic form (i.e. note heads on a 5-line staff) has not changed, the details still change to express the innovations of contemporary notation. Hence, it encompasses some 500 years of music. Its applications range from monophonic melodies to monstrous counterpoint for large orchestras.
How can we get a grip on such a many-headed beast, and force it into
the confines of a computer program? We have broken up the problem of
notation (as opposed to engraving, i.e. typography) into digestible
and programmable chunks: every type of symbol is handled by a separate
module, a so-called plug-in. Each plug-in is completely modular and
independent, so each can be developed and improved separately. People
that translate musical ideas to graphic symbols are called copyists or
engravers, so by analogy, each plug-in is called engraver
.
In the following example, we see how we start out with a plug-in for
note heads, the Note_heads_engraver
.
Then a Staff_symbol_engraver
adds the staff
The Clef_engraver
defines a reference point for the staff
And the Stem_engraver
adds stems
The Stem_engraver
is notified of any note head coming along.
Every time one (or more, for a chord) note head is seen, a stem
object is created and connected to the note head.
By adding engravers for beams, slurs, accents, accidentals, bar lines,
time signature, and key signature, we get a complete piece of
notation.
This system works well for monophonic music, but what about polyphony? In polyphonic notation, many voices can share a staff.
In this situation, the accidentals and staff are shared, but the stems, slurs, beams, etc. are private to each voice. Hence, engravers should be grouped. The engravers for note heads, stems, slurs, etc. go into a group called “Voice context,” while the engravers for key, accidental, bar, etc. go into a group called “Staff context.” In the case of polyphony, a single Staff context contains more than one Voice context. In polyphonic notation, many voices can share a staff. Similarly, more Staff contexts can be put into a single Score context
Ideally, the input format for any high-level formatting system is an abstract description of the content. In this case, that would be the music itself. This poses a formidable problem: how can we define what music really is? Instead of trying to find an answer, we have reversed the question. We write a program capable of producing sheet music, and adjust the format to be as lean as possible. When the format can no longer be trimmed down, by definition we are left with content itself. Our program serves as a formal definition of a music document.
The syntax is also the user-interface for LilyPond, hence it is easy to type
c'4 d'8
a quarter note C1 (middle C) and eighth note D1 (D above middle C)
On a microscopic scale, such syntax is easy to use. On a larger scale, syntax also needs structure. How else can you enter complex pieces like symphonies and operas? The structure is formed by the concept of music expressions: by combining small fragments of music into larger ones, more complex music can be expressed. For example
c4
Combine this simultaneously with two other notes by enclosing in << and >>
<<c4 d4 e4>>
This expression is put in sequence by enclosing it in curly braces
{ ... }
{ <<c4 d4 e4>> f4 }
The above is another expression, and therefore, it many combined again with a simultaneous expression; in this case, a half note
<< { <<c4 d4 e4>> f4 } g2 >>
Such recursive structures can be specified neatly and formally in a context-free grammar. The parsing code is also generated from this grammar. In other words, the syntax of LilyPond is clearly and unambiguously defined.
User-interfaces and syntax are what people see and deal with most. They are partly a matter of taste, and also subject of much discussion. Although discussions on taste do have their merit, they are not very productive. In the larger picture of LilyPond, the importance of input syntax is small: inventing neat syntax is easy, writing decent formatting code is much harder. This is also illustrated by the line-counts for the respective components: parsing and representation take up less than 10% of the code.
We have written LilyPond as an experiment of how to condense the art of music engraving into a computer program. Thanks to all that hard work, the program can now be used to perform useful tasks. The simplest application is printing notes
By adding chord names and lyrics we obtain a lead sheet
Polyphonic notation and piano music can also be printed. The following example combines some more exotic constructs
The fragments shown above have all been written by hand, but that is not a requirement. Since the formatting engine is mostly automatic, it can serve as an output means for other programs that manipulate music. For example, it can also be used to convert databases of musical fragments to images for use on websites and multimedia presentations.
This manual also shows an application: the input format is text, and can therefore be easily embedded in other text-based formats such as LaTeX, HTML or in the case of this manual, Texinfo. By means of a special program, the input fragments can be replaced by music images in the resulting PostScript or HTML output files. This makes it easy to mix music and text in documents.
The manual is divided into the following chapters:
.ly
format. In addition, this section explains
how to upgrade input files from previous versions of LilyPond.
Once you are an experienced user, you can use the manual as reference: there is an extensive index1, but the document is also available in a big HTML page which can be searched easily using the search facility of a web browser. If you are not familiar with music notation or music terminology (especially if you are a non-native English speaker), it is advisable to consult the glossary as well. The glossary explains musical terms, and includes translations to various languages. It is a separate document.
This manual is not complete without a number of other documents. They are not available in print, but should be included with the documentation package for your platform:
The program reference is a set of heavily cross linked HTML pages, which documents the nit-gritty details of each and every LilyPond class, object and function. It is produced directly from the formatting definitions used.
Almost all formatting functionality that is used internally, is available directly to the user. For example, all variables that control thicknesses, distances, etc, can be changed in input files. There are a huge number of formatting options, and all of them are described in the generated documentation. Each section of the notation manual has a See also subsection, which refers to the the generated documentation. In the HTML document, these subsections have clickable links.
After you have gone through the tutorial, you should be able to write input files. In practice, writing files from scratch turns out to be intimidating. To give you a head start, we have collected a number of often-used formats in example files. These files can be used as a start; simply copy the template and add notes in the appropriate places.
This collection of files tests each notation and engraving feature of LilyPond in one file. The collection is primarily there to help us debug problems, but it can be instructive to see how we exercise the program. The format is similar to the the tips and tricks document.
In all HTML documents that have music fragments embedded, the LilyPond input that was used to produce that image can be viewed by clicking the image.
The location of the documentation files that are mentioned here can vary from system to system. On occasion, this manual refers to initialization and example files. Throughout this manual, we refer to input files relative to the top-directory of the source archive. For example, input/test/bla.ly may refer to the file lilypond-1.7.19/input/test/bla.ly. On binary packages for the Unix platform, the documentation and examples can typically be found somewhere below /usr/share/doc/lilypond/. Initialization files, for example scm/lily.scm, or ly/engraver-init.ly, are usually found in the directory /usr/share/lilypond/.
Finally, this and all other manuals, are available online both as PDF files and HTML from the web site, which can be found at http://www.lilypond.org/.
This tutorial starts with a short introduction to the LilyPond music language. After this first contact we will show you how to produce printed output. Then you will be able to create and print your own sheets of music.
Many people learn programs by trying and fiddling around with the program. This is also possible with LilyPond. If you click on a picture in the HTML version of this manual, you will see the exact LilyPond input that was used to generate that image. Try it on this image
By cutting and pasting the full input into a test file, you have a starting template for experiments. If you like learning in this way, you will probably want to print out or bookmark the Cheat sheet, which is a table listing all commands for quick reference.
The first example demonstrates how to enter the most elementary piece of music, a scale. A note can be entered by typing its name, from a through g. So, if you enter
c d e f g a b
the result looks like this
The duration of a note is specified by a number after the note name. 1 for a whole note, 2 for a half note, 4 for a quarter note and so on
a1 a2 a4 a16 a32
If you do not specify a duration, the duration last entered is used; the duration of the first note defaults to a quarter
a a8 a a2 a
Rests are entered just like notes, but with the name “r
”
r2 r4 r8 r16
Add a dot . after the duration to get a dotted note
a2. a4 a8. a16
The
meter (or
time signature) can be set with the
\time
command
\time 3/4 \time 6/8 \time 4/4
The
clef can be set using the \clef
command
\clef treble \clef bass \clef alto \clef tenor
To recognize names like c
and d
as pitches, they have to
be entered inside a so-called \notes
block. This block is
formed by enclosing notes and commands are enclosed in curly braces
{ ... }
and adding the keyword \notes
before the
opening brace
\notes { \time 3/4 \clef bass c2 e4 g2. f4 e d c2 r4 }
Now the piece of music is almost ready to be printed. Enclose
the \notes
block in a \score
block
\score { \notes { \time 3/4 \clef bass c2 e4 g2. f4 e d c2 r4 } }
and the music will be converted to printable output.
In many examples in this manual, both \score
and \notes
and accompanying braces are left out for brevity. However, they must
be present when feeding the file to LilyPond.
For more elaborate information on
In the last section we explained what kind of things you could enter in a LilyPond file. In this section we will explain what commands to run and how to view or print the output. If you have not used LilyPond before, want to test your setup, or want to run an example file yourself, read this section. The instructions that follow are for Unix-like systems. Some additional instructions for Microsoft Windows are given at the end of this section.
Begin by opening a terminal window and starting a text editor. For
example, you could open an xterm and execute
joe
2. In your text editor, enter the following
input and save the file as test.ly
\score { \notes { c'4 e' g' } }
To process test.ly, proceed as follows
lilypond test.ly
You will see something resembling
GNU LilyPond 1.8.0 Now processing: `/home/fred/ly/test.ly' Parsing... Interpreting music...[1] ... more interesting stuff ... PDF output to `test.pdf'... DVI output to `test.dvi'...
The result is the file test.pdf3 which you can print or with the standard facilities of your operating system.4
On Windows, start up a text-editor5 and enter
\score { \notes { c'4 e' g' } }
Save it on the desktop as test.ly and make sure that it is not called test.ly.TXT. Double clicking test.ly will process the file and show the resulting PDF file.
A sharp (#) pitch is made by adding is to the name, a flat (b) pitch by adding es. As you might expect, a double sharp or double flat is made by adding isis or eses:6
cis1 ees fisis aeses
The key signature is set with the command “\key
”, followed by
a pitch and \major
or \minor
\key d \major g1 \key c \minor g
Key signatures together with the pitches (including alterations) are used together to determine when to print accidentals. This is a feature that often causes confusion to newcomers, so let us explain it in more detail
LilyPond makes a sharp distinction between musical content and layout. The alteration (flat, natural or sharp) of a note is part of the pitch, and is therefore musical content. Whether an accidental (a flat, natural or sharp sign) is a printed in front of the corresponding note is a question of layout. Layout is something that follows rules, so accidentals are printed automatically according to those rules. The pitches in your music are works of art, so they will not be added automatically, and you must enter what you want to hear.
In this example
no note gets an explicit accidental, but still you enter
\key d \major d cis fis
The code d
does not mean “print a black dot just below the
staff.” Rather, it means: “a note with pitch D-natural.” In the key
of A-flat, it does get an accidental
\key as \major d
Adding all alterations explicitly might require a little more effort when typing, but the advantage is that transposing is easier, and music can be printed according to different conventions. See Accidentals for some examples how accidentals can be printed according to different rules.
For more information on
A tie is created by adding a tilde “~
” to the first note
being tied
g4~ g a2~ a4
For more information on Ties, see Ties.
a8 ais d es r d
If you do not like where beams are put, they can be entered by
hand. Mark the first note to be beamed with [
and the last one
with ]
.
a8[ ais] d[ es r d]
For more information on beams, see Beaming.
Here are key signatures, accidentals and ties in action
\score { \notes { \time 4/4 \key g \minor \clef violin r4 r8 a8 gis4 b g8 d4.~ d e8 fis4 fis8 fis8 eis4 a8 gis~ gis2 r2 } }
There are some interesting points to note in this example. Bar lines and beams are drawn automatically. Line breaks are calculated automatically; it does not matter where the line breaks are in the source file. Finally, the order in which time, key and clef changes are entered is not relevant: in the printout, these are ordered according to standard notation conventions.
To raise a note by an octave, add a high quote '
(apostrophe) to
the note name, to lower a note one octave, add a “low quote” ,
(a comma). Middle C is c'
c'4 c'' c''' \clef bass c c,
An example of the use of quotes is in the following Mozart fragment
\key a \major \time 6/8 cis''8. d''16 cis''8 e''4 e''8 b'8. cis''16 b'8 d''4 d''8
This example shows that music in a high register needs lots of quotes.
This makes the input less readable, and it is a source of errors. The
solution is to use “relative octave” mode. In practice, this is the
most convenient way to copy existing music. To use relative mode, add
\relative
before the piece of music. You must also give a note
from which relative starts, in this case c''
. If you do not
use octavation quotes (i.e. do not add '
or ,
after a
note), relative mode chooses the note that is closest to the previous
one. For example, c f
goes up while c g
goes down
\relative c'' { c f c g c }
Since most music has small intervals, pieces can be written almost without octavation quotes in relative mode. The previous example is entered as
\relative c'' { \key a \major \time 6/8 cis8. d16 cis8 e4 e8 b8. cis16 b8 d4 d8 }
Larger intervals are made by adding octavation quotes.
\relative c'' { c f, f c' c g' c, }
In \relative
mode, quotes or commas no longer determine the
absolute height of a note. Rather, the height of a note is relative to
the previous one, and changing the octave of a single note shifts all
following notes an octave up or down.
For more information on Relative octaves see Relative octaves and Octave check.
In input files, music is represent by so-called music expression. We have already seen in the previous examples; a single note is a music expression
a4
Enclosing group of notes in braces creates a new music expression
{ a4 g4 }
Putting a bunch of music expressions (notes) in braces, means that they should be played in sequence. The result again is a music expression, which can be grouped with other expressions sequentially. Here, the expression from the previous example is combined with two notes
{ { a4 g } f g }
This technique is useful for non-monophonic music. To enter music
with more voices or more staves, we also combine expressions in
parallel. Two voices that should play at the same time, are entered
as a simultaneous combination of two sequences. A “simultaneous”
music expression is formed by enclosing expressions in <<
and
>>
. In the following example, three sequences (all containing
two notes) are combined simultaneously
<< { a4 g } { f e } { d b } >>
This mechanism is similar to mathematical formulas: a big formula is created by composing small formulas. Such formulas are called expressions, and their definition is recursive, so you can make arbitrarily complex and large expressions. For example,
1 1 + 2 (1 + 2) * 3 ((1 + 2) * 3) / (4 * 5)
This example shows a sequence of expressions, where each expression is contained in the next one. The simplest expressions are numbers and operators (like +, * and /). Parentheses are used to group expressions.
Like mathematical expressions, music expressions can be nested arbitrarily deep, e.g.
{ c <<c e>> << { e f } { c <<b d>> } >> }
When spreading expressions over multiple lines, it is customary to use an indent that indicates the nesting level. Formatting music like this eases reading, and helps you insert the right number of closing braces at the end of an expression. For example,
\score { \notes << { ... } { ... } >> }
Some editors have special support for entering LilyPond, and can help indenting source files. See Editor support for more information.
To print more than one staff, each piece of music that makes up a
staff is marked by adding \new Staff
before it. These
Staff
's are then combined parallel with <<
and
>>
, as demonstrated here
<< \new Staff { \clef violin c'' } \new Staff { \clef bass c } >>
The command \new
introduces a “notation context.” A notation
context is an environment in which musical events (like notes or
\clef
commands) are interpreted. For simple pieces, such
notation contexts are created implicitly. For more complex pieces, it
is best to mark contexts explicitly. This ensures that each fragment
gets its own stave.
There are several types of contexts: Staff
, Voice
and
Score
handle normal music notation. Other staves are also
Lyrics
(for setting lyric texts) and ChordNames
(for
printing chord names).
In terms of syntax, prepending \new
to a music expression
creates a bigger music expression. In this way it resembles the minus
sign in mathematics. The formula (4+5) is an expression, so -(4+5) is a bigger
expression.
We can now typeset a melody with two staves
\score { \notes << \new Staff { \time 3/4 \clef violin \relative c'' { e2 d4 c2 b4 a8[ a] b[ b] g[ g] a2. } } \new Staff { \clef bass c2 e4 g2. f4 e d c2. } >> }
For more information on context see the description in Interpretation contexts.
Common accents can be added to a note using a dash (`-
') and a
single character
c-. c-- c-> c-^ c-+ c-_
Similarly, fingering indications can be added to a note using a dash
(`-
') and the digit to be printed
c-3 e-5 b-2 a-1
Dynamic signs are made by adding the markings (with a backslash) to the note
c\ff c\mf
Crescendi and decrescendi are started with the commands \<
and
\>
. An ending dynamic, for example \f
, will finish the
crescendo, or the command \!
can be used
c2\< c2\ff\> c2 c2\!
A slur is a curve drawn across many notes, and indicates legato
articulation. The starting note and ending note are marked with a
“(
” and a “)
” respectively
d4( c16)( cis d e c cis d e)( d4)
A slur looks like a tie, but it has a different meaning. A tie simply makes the first note sound longer, and can only be used on pairs of notes with the same pitch. Slurs indicate the articulations of notes, and can be used on larger groups of notes. Slurs and ties are also nested in practice
Slurs to indicate phrasing can be entered with \(
and
\)
, so you can have both legato slurs and phrasing slurs at the
same time.
a8(\( ais b c) cis2 b'2 a4 cis, c\)
For more information on
Chords can be made by surrounding pitches with angled brackets.
Angled brackets are the symbols <
and >
.
r4 <c e g>4 <c f a>8
You can combine markings like beams and ties with chords. They must be placed outside the angled brackets
r4 <c e g>8[ <c f a>]~ <c f a>
r4 <c e g>8\>( <c e g> <c e g> <c f a>8\!)
A pickup is entered with the keyword \partial
. It
is followed by a duration: \partial 4
is a quarter note upstep
and \partial 8
an eighth note
\partial 8 f8 c2 d e
Tuplets are made with the \times
keyword. It takes two
arguments: a fraction and a piece of music. The duration of the piece
of music is multiplied by the fraction. Triplets make notes occupy
2/3 of their notated duration, so a triplet has 2/3 as its fraction
\times 2/3 { f8 g a } \times 2/3 { c r c }
Grace notes are also made by prefixing a music expression with the
keyword \appoggiatura
or \acciaccatura
c4 \appoggiatura b16 c4 c4 \acciaccatura b16 c4
For more information on
A comment is a remark for the human reader of the music input, it is
ignored and has no effect on the printed output. There are two types
of comments. The percent symbol %
introduces a line comment;
the rest of the line is ignored. A block comments marks a whole
section of music input, anything that is enclosed in %{
and
%}
is ignored. The following fragment shows possible uses for
comments
% notes for twinkle twinkle follow c4 c g' g a a %{ This line, and the notes below are ignored, since they are in a block comment. g g f f e e d d c2 %}
There is a special statement that really is a kind of comment. The version statement marks for which version of LilyPond the file was written. To mark a file for version 2.1.17, use
\version "2.1.17"
These annotations make future upgrades of LilyPond go more
smoothly. Changes in the syntax are handled with a special program,
convert-ly (see Invoking convert-ly), and it uses
\version
to determine what rules to apply.
Lyrics are entered by separating each syllable with a space,
I want to break free
To prevent certain words (for example “as”) as being read as a
pitch, the input-mode must be switched. This is done with
\lyrics
. In \lyrics
mode, all words are read as lyric
syllables.
\lyrics { I want to break free }
Again, the braces {}
signify that the syllables are sung in
sequence.
By default, music expressions are interpreted in Staff
context. For
lyrics, this is obviously not desirable, so it is necessary
to explicitly specify a Lyrics
context,
\new Lyrics \lyrics { I want to break free }
The melody for this song is as follows
The lyrics can be set to these notes, combining both with the
\lyricsto
keyword
\lyricsto "name" \new Lyrics ...
where name identifies to which melody the lyrics should be aligned. In this case, there is only one melody, so we can leave it empty.
The final result is
\score { \notes << \partial 4 \relative c' { c4 \times 2/3 { f g g } \times 2/3 { g4( a2) } } \lyricsto "" \new Lyrics \lyrics { I want to break free } >> }
This melody ends on a melisma, a single syllable (“free”) sung to more than one note. This is indicated with an extender line. It is entered as two underscores, i.e.
\lyrics { I want to break free __ }
Similarly, hyphens between words can be entered as two dashes, resulting in a centered hyphen between two syllables
Twin -- kle twin -- kle
More options, like putting multiple lines of lyrics below a melody are discussed in Vocal music.
In popular music, it is common to denote accompaniment as chord-names. Such chords can be entered like notes,
c2 f4. g8
but now, each pitch is read as the root of a chord instead of a note.
This mode is switched on with \chords
\score { \chords { c2 f4. g8 } }
Other chords can be created by adding modifiers after a colon. The following example shows a few common modifiers
\chords { c2 f4:m g4:maj7 gis1:dim7 }
For lead sheets, chords are not printed on staves, but as names on a
line of themselves. Hence, we have to override the context with
\new
, rendering the music expression in a ChordNames
context
\new ChordNames \chords { c2 f4.:m g4.:maj7 gis8:dim7 }
When put together, chord names, lyrics and a melody form a lead sheet, for example,
\score { << \new ChordNames \chords { chords } \notes the melody \lyricsto "" \new Lyrics \lyrics { the text } >> }
A complete list of modifiers and other options for layout can be found in Chords.
MIDI (Musical Instrument Digital Interface) is a standard for connecting and controlling digital instruments. A MIDI file is like a tape recording of a MIDI instrument.
To create a MIDI from a music piece of music, add a
\midi
block causes LilyPond to create a MIDI file, so you
can listen to the music you entered. It is great for checking the
music: octaves that are off or accidentals that were mistyped stand
out very much when listening to the musical transcription.
The \midi
block is added to \score
, for example,
\score { ..music.. \midi { \tempo 4=72 } }
Here, the tempo is specified using the \tempo
command. In this
case the tempo of quarter notes is set to 72 beats per minute. More
information on auditory output in the notation manual, Sound.
If there is a \midi
command in a \score
, only MIDI will
be produced. If notation is needed too, a \paper
block must be
added too
\score { ..music.. \midi { \tempo 4=72 } \paper { } }
Bibliographic information is entered in a separate block, the
\header
block. The name of the piece, its composer, etc. are
entered as an assignment, within \header { ... }
. For
example,
\header { title = "Eight miniatures" composer = "Igor Stravinsky" tagline = "small is beautiful" } \score { ... }
When the file is processed the title and composer are printed above the music. The `tagline' is a short line printed at bottom of the last page which normally says “Engraved by LilyPond, version ...”. In the example above it is replaced by the line “small is beautiful.”7
Normally, the \header
is put at the top of the file. However,
for a document that contains multiple pieces (e.g. an etude book, or
an orchestral part with multiple movements), the header can be
put in the \score
block as follows; in this case, the name of
each piece will be printed before each movement
\header { title = "Eight miniatures" composer = "Igor Stravinsky" tagline = "small is beautiful" } \score { ... \header { piece = "Adagio" } } \score { ... \header { piece = "Menuetto" } }
More information on titling can be found in Invoking lilypond.
When different melodic lines are combined on a single staff they are printed as polyphonic voices: each voice has its own stems, slurs and beams, and the top voice has the stems up, while the bottom voice has them down.
Entering such parts is done by entering each voice as a sequence (with
{ .. }
), and combining those simultaneously, separating the
voices with \\
<< { a4 g2 f4~ f4 } \\ { r4 g4 f2 f4 } >>
For polyphonic music typesetting, spacer rests can also be convenient: these are rests that do not print. It is useful for filling up voices that temporarily do not play. Here is the same example with a spacer rest instead of a normal rest
Again, these expressions can be nested arbitrarily
More features of polyphonic typesetting in the notation manual in Polyphony.
Piano music is typeset in two staves connected by a brace. Printing such a staff is similar to the polyphonic example in More staves
<< \new Staff { ... } \new Staff { ... } >>
but now this entire expression must be interpreted as a
PianoStaff
\new PianoStaff << \new Staff ... >>
Here is a full-fledged example
More information on formatting piano music is in Piano music.
When all of the elements discussed earlier are combined to produce
larger files, the \score
blocks get a lot bigger, because the
music expressions are longer, and, in the case of polyphonic pieces,
more deeply nested. Such large expressions can become unwieldy.
By using variables, also known as identifiers, it is possible to break up complex music expressions. An identifier is assigned as follows
namedMusic = \notes { ...
The contents of the music expression namedMusic
, can be used
later by preceding the name with a backslash, i.e. \namedMusic
.
In the next example, a two note motive is repeated two times by using
variable substitution
seufzer = \notes { e'4( dis'4) } \score { \new Staff { \seufzer \seufzer } }
The name of an identifier should have alphabetic characters only;
no numbers, underscores or dashes. The assignment should be outside of
the \score
block.
It is possible to use variables for many other types of objects in the input. For example,
width = 4.5\cm name = "Wendy" aFivePaper = \paper { paperheight = 21.0 \cm }
Depending on its contents, the identifier can be used in different places. The following example uses the above variables
\score { \notes { c4^\name } \paper { \aFivePaper linewidth = \width } }
More information on the possible uses of identifiers is in the technical manual, in TODO.
In orchestral music, all notes are printed twice: both in a part for the musicians, and in a full score for the conductor. Identifiers can be used to avoid double work: the music is entered once, and stored in a variable. The contents of that variable is then used to generate both the part and the score.
It is convenient to define the notes in a special file, for example, suppose that the horn-music.ly contains the following part of a horn/bassoon duo,
hornNotes = \notes \relative c { \time 2/4 r4 f8 a cis4 f e d }
Then, an individual part is made by putting the following in a file
\include "horn-music.ly" \header { instrument = "Horn in F" } \score { \notes \transpose f c' \hornNotes }
The line
\include "horn-music.ly"
substitutes the contents of horn-music.ly at this position in
the file, so hornNotes
is defined afterwards. The command
\transpose f c'
indicates that the argument, being
\hornNotes
, should be transposed by a fifth downwards: sounding
f
is denoted by notated c'
, which corresponds with
tuning of a normal French Horn in F. The transposition can be seen in
the following output
In ensemble pieces, one of the voices often does not play for many
measures. This is denoted by a special rest, the multi-measure
rest. It is entered with a capital R
followed by a duration (1
for a whole note, 2 for a half note, etc.) By multiplying the
duration, longer rests can be constructed. For example, this rest
takes 3 measures in 2/4 time
R2*3
When printing the part, multi-rests must be condensed. This is done by setting a run-time variable
\set Score.skipBars = ##t
This commands sets the property skipBars
property in the
Score
context to true (##t
). Prepending the rest and
this option to the music above, leads to the following result
The score is made by combining all of the music in a \score
block. Assuming that the other voice is in bassoonNotes
in the
file bassoon-music.ly, a score is made with
\include "bassoon-music.ly" \include "horn-music.ly" \score { \simultaneous { \new Staff \hornNotes \new Staff \bassoonNotes } }
leading to
More in-depth information on preparing parts and scores in the notation manual, in Orchestral music.
Setting run-time variables (“properties”) is discussed in ref-TODO.
Some texts include music examples. Examples are musicological treatises, songbooks or manuals like this. Such texts can be made by hand, simply by importing a PostScript figure into the word processor. However, there is an automated procedure to reduce the amount of work involved HTML, LaTeX, and Texinfo documents.
A script called lilypond-book
will extract the music fragments,
run format them, and put back the resulting notation. This program is
fully described in lilypond-book manual. Here we show a small
example. The example also contains explanatory text, so we will not
comment on it further
\documentclass[a4paper]{article} \begin{document} Documents for lilypond-book may freely mix music and text. For example, \begin{lilypond} \score { \notes \relative c' { c2 g'2 \times 2/3 { f8 e d } c'2 g4 } } \end{lilypond} If there is no \verb+\score+ block in the fragment, \texttt{lilypond-book} will supply one \begin{lilypond} c'4 \end{lilypond} In this example two things happened: a \verb+\score+ block was added, and the line width was set to natural length. Options are put in brackets. \begin[staffsize=26,verbatim]{lilypond} c'4 f16 \end{lilypond} Larger examples can be put in a separate file, and introduced with \verb+\lilypondfile+. \lilypondfile{screech-boink.ly} \end{document}
Under Unix, you can view the results as follows
$ cd input/tutorial $ mkdir -p out/ $ lilypond-book --output=out/ lilybook.tex lilypond-book (GNU LilyPond) 2.1.19 Reading `input/tutorial/lilybook.tex' Reading `input/screech-boink.ly' lots of stuff deleted Writing `out/lilybook.tex' $ cd out $ latex lilybook lots of stuff deleted $ xdvi lilybook
To convert the file into a nice PDF document, run the following commands
$ dvips -Ppdf -u +lilypond lilybook $ ps2pdf lilybook.ps
Running lilypond-book and running latex creates a lot of temporary
files, which would clutter up the working directory. To remedy this,
use the output
option. It will create the files in a separate
subdirectory out.
The result looks more or less like
Documents for lilypond-book may freely mix music and text. For example
If you have no \score
block in the fragment,
lilypond-book
will supply one
In this example two things happened: a
score
block was added, and the line width was set to natural
length.
Options are put in brackets.
c'4 f16
Larger examples can be put in a separate file, and introduced with
\lilypondfile
.
This chapter describes all the different types of notation supported by LilyPond. It is intended as a reference for users that are already somewhat familiar with LilyPond.
This section is about basic notation elements notes, rests and related constructs, such as stems, tuplets and ties.
A note is printed by specifying its pitch and then its duration 8
cis'4 d'8 e'16 c'16
The most common syntax for pitch entry is used in \chords
and
\notes
mode. In these modes, pitches may be designated by
names. The notes are specified by the letters a
through
g
, while the octave is formed with notes ranging from c
to b
. The pitch c
is an octave below middle C and the
letters span the octave above that C
\clef bass a,4 b, c d e f g a b c' d' e' \clef treble f' g' a' b' c''
A sharp is formed by adding -is
to the end of a pitch name and
a flat is formed by adding -es
. Double sharps and double flats
are obtained by adding -isis
or -eses
. These
names are the Dutch note names. In Dutch, aes
is contracted to
as
, but both forms are accepted. Similarly, both
es
and ees
are accepted.
Half-flats and half-sharps are formed by adding -eh
and
-ih
; the following is a series of Cs with increasing pitches
ceses4 ceseh ces ceh c cih cis cisih cisis
There are predefined sets of note names for various other languages.
To use them, include the language specific init file. For
example: \include "english.ly"
. The available language files
and the note names they define are
Note Names sharp flat nederlands.ly c d e f g a bes b -is -es english.ly c d e f g a bf b -s/-sharp -f/-flat -x (double) deutsch.ly c d e f g a b h -is -es norsk.ly c d e f g a b h -iss/-is -ess/-es svenska.ly c d e f g a b h -iss -ess italiano.ly do re mi fa sol la sib si -d -b catalan.ly do re mi fa sol la sib si -d/-s -b espanol.ly do re mi fa sol la sib si -s -b
The optional octave specification takes the form of a series of
single quote (`'
') characters or a series of comma
(`,
') characters. Each '
raises the pitch by one
octave; each ,
lowers the pitch by an octave
c' c'' es' g' as' gisis' ais'
Notes can be hidden and unhidden with the following commands
Program reference: NoteEvent, and NoteHead.
Normally accidentals are printed automatically, but you may also
print them manually. A reminder accidental
can be forced by adding an exclamation mark !
after the pitch. A cautionary accidental
(i.e. an accidental within parentheses) can be obtained by adding the
question mark `?
' after the pitch
cis' cis' cis'! cis'?
The automatic production of accidentals can be tuned in many ways. For more information, refer to Accidentals.
There are no generally accepted standards for denoting three quarter flats, so LilyPond's symbol does not conform to any standard.
A chord is formed by a enclosing a set of pitches in <
and
>
. A chord may be followed by a duration, and a set of
articulations, just like simple notes.
Rests are entered like notes, with the note name r
r1 r2 r4 r8
Whole bar rests, centered in middle of the bar, must be done with multi-measure rests. They are discussed in Multi measure rests.
A rest's vertical position may be explicitly specified by entering a
note with the \rest
keyword appended. This makes manual
formatting in polyphonic music easier. Rest collision testing will
leave these rests alone
a'4\rest d'4\rest
Program reference: RestEvent, and Rest.
An invisible rest (also called a `skip') can be entered like a note
with note name `s
' or with \skip
duration
a2 s4 a4 \skip 1 a4
The s
syntax is only available in note mode and chord mode. In
other situations, you should use the \skip
command
\score { \new Staff << { \time 4/8 \skip 2 \time 4/4 } \notes\relative c'' { a2 a1 } >> }
The skip command is merely an empty musical placeholder. It does not produce any output, not even transparent output.
The s
skip command does create Staff and
Voice when necessary, similar to note and rest
commands. For example, the following results in an empty staff.
\score { \notes { s4 } }
The same fragment using \skip
results in an empty page.
Program reference: SkipEvent, SkipMusic.
In Note, Chord, and Lyrics mode, durations are designated by numbers
and dots: durations are entered as their reciprocal values. For example,
a quarter note is entered using a 4
(since it is a 1/4 note), while
a half note is entered using a 2
(since it is a 1/2 note). For notes
longer than a whole you must use variables
c'\breve c'1 c'2 c'4 c'8 c'16 c'32 c'64 c'64 r\longa r\breve r1 r2 r4 r8 r16 r32 r64 r64
If the duration is omitted then it is set to the previously entered
duration. The default for the first note is a quarter note. The duration
can be followed by dots (`.
') in order to obtain dotted note
lengths
a' b' c''8 b' a'4 a'4. b'4.. c'8.
You can alter the length of duration by a fraction N/M
appending `*
N/M' (or `*
N' if M=1). This
will not affect the appearance of the notes or rests produced.
In the following example, the first three notes take up exactly two beats, but no triplet bracket is printed.
\time 2/4 a4*2/3 gis4*2/3 a4*2/3 a4
Dots are normally moved up to avoid staff lines, except in polyphonic situations. The following commands may be used to force a particular direction manually
\dotsUp
,
\dotsDown
,
\dotsBoth
.
This manual: Tuplets
Program reference: Dots, and DotColumn.
Whenever a note is found, a Stem object is created automatically. For whole notes and rests, they are also created but made invisible.
\stemUp
,
\stemDown
,
\stemBoth
.
A tie connects two adjacent note heads of the same pitch. The tie in
effect extends the length of a note. Ties should not be confused with
slurs, which indicate articulation, or phrasing slurs, which indicate
musical phrasing. A tie is entered using the tilde symbol `~
'
e' ~ e' <c' e' g'> ~ <c' e' g'>
When a tie is applied to a chord, all note heads whose pitches match are connected. When no note heads match, no ties will be created.
In its meaning a tie is just a way of extending a note duration, similar to the augmentation dot; in the following example there are two ways of notating exactly the same concept
If you need to tie a lot of notes over bars, it may be easier to use automatic note splitting (see Automatic note splitting).
\tieUp
,
\tieDown
,
\tieBoth
,
\tieDotted
,
\tieSolid
.
In this manual: Automatic note splitting.
Program reference: TieEvent, Tie.
For tying only a subset of the note heads of a pair of chords, see input/regression/tie-chord-partial.ly.
Switching staves when a tie is active will not produce a slanted tie.
Formatting of ties is a difficult subject. The results are often not optimal.
Tuplets are made out of a music expression by multiplying all durations with a fraction
\times fraction musicexpr
The duration of musicexpr will be multiplied by the fraction. The fraction's denominator will be printed over the notes, optionally with a bracket. The most common tuplet is the triplet in which 3 notes have the length of 2, so the notes are 2/3 of their written length
g'4 \times 2/3 {c'4 c' c'} d'4 d'4
The property tupletSpannerDuration
specifies how long each
bracket should last. With this, you can make lots of tuplets while
typing \times
only once, saving lots of typing. In the next
example, there are two triplets shown, while \times
was only
used once
\set tupletSpannerDuration = #(ly:make-moment 1 4) \times 2/3 { c'8 c c c c c }
The format of the number is determined by the property
tupletNumberFormatFunction
. The default prints only the
denominator, but if it is set to the Scheme function
fraction-tuplet-formatter
, num:den will be printed
instead.
\tupletUp
,
\tupletDown
,
\tupletBoth
.
Program reference: TupletBracket, and TimeScaledMusic.
Examples: input/regression/tuplet-nest.ly.
Nested tuplets are not formatted automatically. In this case, outer tuplet brackets should be moved manually, which is demonstrated in input/regression/tuplet-nest.ly.
This section deals with tricks and features of the input language that were added solely to help entering music, finding and correcting mistakes. There are also external tools that make debugging easier. See Point and click for more information.
It is also possible to enter and edit music using other programs. For example, GUI interfaces, or MIDI sequencers. Refer to the LilyPond website for more information.
Octaves are specified by adding '
and ,
to pitch names.
When you copy existing music, it is easy to accidentally put a pitch
in the wrong octave and hard to find such an error. The relative
octave mode prevents these errors: a single error puts the rest of the
piece off by one octave
\relative startpitch musicexpr
The octave of notes that appear in musicexpr are calculated as
follows: If no octave changing marks are used, the basic interval
between this and the last note is always taken to be a fourth or
less. This distance is determined without regarding alterations; a
fisis
following a ceses
will be put above the
ceses
.
The octave changing marks '
and ,
can be added to raise
or lower the pitch by an extra octave. Upon entering relative mode,
an absolute starting pitch must be specified that will act as the
predecessor of the first note of musicexpr.
Here is the relative mode shown in action
\relative c'' { b c d c b c bes a }
Octave changing marks are used for intervals greater than a fourth
\relative c'' { c g c f, c' a, e'' }
If the preceding item is a chord, the first note of the chord is used to determine the first note of the next chord
\relative c' { c <c e g> <c' e g> <c, e' g> }
The pitch after the \relative
contains a note name. To parse
the note name as a pitch, it must surrounded by \notes
The relative conversion will not affect \transpose
,
\chords
or \relative
sections in its argument. If you
want to use relative within transposed music, you must place an
additional \relative
inside the \transpose
.
Octave checks make octave errors easier to correct: a note may be
followed by =
quotes which indicates what its absolute
octave should be. In the following example,
\relative c'' { c='' b=' d,='' }
the d will generate a warning, because a d” is expected, but a d' is found. In the output, the octave is corrected for this and the following notes.
There is also a syntax that is separate from the notes.
\octave pitch
This checks that pitch (without octave) yields pitch (with octave) in \relative mode. If not, a warning is printed, and the octave is corrected, for example, the first check is passed successfully. The second check fails with an error message. The octave is adjusted so the following notes are in the correct octave once again.
\relative c' { e \octave a' \octave b' }
The octave of a note following an octave check is determined with
respect to the note preceding it. In the next fragment, the last note
is a a'
, above middle C. Hence, the \octave
check may
be deleted without changing the meaning of the piece.
\relative c' { e \octave b a }
Bar checks help detect errors in the durations. A bar check is
entered using the bar symbol, `|
'. Whenever it is encountered
during interpretation, it should fall on a measure boundary. If it
does not, a warning is printed. In the next example, the second bar
check will signal an error
\time 3/4 c2 e4 | g2 |
Bar checks can also be used in lyrics, for example
\lyrics { \time 2/4 Twin -- kle | Twin -- kle }
Failed bar checks are caused by entering incorrect
durations. Incorrect durations often completely garble up the score,
especially if it is polyphonic, so you should start correcting the
score by scanning for failed bar checks and incorrect durations. To
speed up this process, you can use skipTypesetting
, described
in the next section.
The property Score.skipTypesetting
can be used to switch on and
off typesetting completely during the interpretation phase. When
typesetting is switched off, the music is processed much more quickly.
This can be used to skip over the parts of a score that have already
been checked for errors
\relative c'' { c8 d \set Score.skipTypesetting = ##t e f g a g c, f e d \set Score.skipTypesetting = ##f c d b bes a g c2 }
Long notes can be converted automatically to tied notes. This is done by replacing the Note_heads_engraver by the Completion_heads_engraver. In the following examples, notes crossing the bar line are split and tied.
\new Voice \with { \remove "Note_heads_engraver" \consists "Completion_heads_engraver" } { c2. c8 d4 e f g a b c8 c2 b4 a g16 f4 e d c8. c2 }
This engraver splits all running notes at the bar line, and inserts ties. One of its uses is to debug complex scores: if the measures are not entirely filled, then the ties exactly show how much each measure is off.
Not all durations (especially those containing tuplets) can be represented exactly; the engraver will not insert tuplets.
Examples: input/regression/completion-heads.ly.
Program reference: Completion_heads_engraver.
This section describes music notation that occurs on staff level, such as keys, clefs and time signatures.
Notes, dynamic signs, etc. are grouped with a set of horizontal lines, into a staff (plural `staves'). In our system, these lines are drawn using a separate layout object called staff symbol.
Program reference: StaffSymbol.
Examples: input/test/staff-lines.ly, input/test/staff-size.ly.
If a staff is ended halfway a piece, the staff symbol may not end exactly on the bar line.
The key signature indicates the scale in which a piece is played. It is denoted by a set of alterations (flats or sharps) at the start of the staff.
Setting or changing the key signature is done with the \key
command
\key
pitch type
Here, type should be \major
or \minor
to get
pitch-major or pitch-minor, respectively.
The standard mode names \ionian
,
\locrian
, \aeolian
, \mixolydian
, \lydian
,
\phrygian
, and \dorian
are also defined.
This command sets the context property
Staff.keySignature
. Non-standard key signatures
can be specified by setting this property directly.
Accidentals and key signatures often confuse new users, because unaltered notes get natural signs depending on the key signature. For more information, see More about pitches.
The ordering of a key cancellation is wrong when it is combined with repeat bar lines. The cancellation is also printed after a line break.
Program reference: KeyChangeEvent, and KeySignature.
The clef indicates which lines of the staff correspond to which pitches.
The clef can be set or changed with the \clef
command
\key f\major c''2 \clef alto g'2
treble, violin, G, G2
alto, C
tenor
bass, F
french
soprano
mezzosoprano
baritone
varbaritone
subbass
percussion
tab
By adding _8
or ^8
to the clef name, the clef is
transposed one octave down or up, respectively, and _15
and
^15
transposes by two octaves. The argument clefname
must be enclosed in quotes when it contains underscores or digits. For
example,
\clef "G_8" c4
This command is equivalent to setting clefGlyph
,
clefPosition
(which controls the Y position of the clef),
centralCPosition
and clefOctavation
. A clef is printed
when any of these properties are changed.
Program reference: the object for this symbol is Clef.
“Ottava” brackets introduce an extra transposition of an octave for
the staff. They are created by invoking the function
set-octavation
\relative c''' { a2 b #(set-octavation 1) a b #(set-octavation 0) a b }
The set-octavation
function also takes -1 (for 8va bassa) and 2
(for 15ma) as arguments. Internally the function sets the properties
ottavation
(e.g. to "8va"
) and
centralCPosition
. For overriding the text of the bracket, set
ottavation
after invoking set-octavation
, i.e.,
#(set-octavation 1) \set Staff.ottavation = #"8"
Program reference: OttavaBracket.
Examples: input/regression/ottava.ly, input/regression/ottava-broken.ly.
set-octavation
will get confused when clef changes happen
during an octavation bracket.
Time signature indicates the metrum of a piece: a regular pattern of strong and weak beats. It is denoted by a fraction at the start of the staff.
The time signature is set or changed by the \time
command
\time 2/4 c'2 \time 3/4 c'2.
The symbol that is printed can be customized with the style
property. Setting it to #'()
uses fraction style for 4/4 and
2/2 time. There are many more options for its layout. See
input/test/time.ly for more examples.
This command sets the property timeSignatureFraction
,
beatLength
and measureLength
in the Timing
context, which is normally aliased to Score. The
property measureLength
determines where bar lines should be
inserted, and how automatic beams should be generated. Changing the
value of timeSignatureFraction
also causes the symbol to be
printed.
More options are available through the Scheme function
set-time-signature
. In combination with the
Measure_grouping_engraver, it will create
MeasureGrouping signs. Such signs ease reading
rhythmically complex modern music. In the following example, the 9/8
measure is subdivided in 2, 2, 2 and 3. This is passed to
set-time-signature
as the third argument (2 2 2 3)
\score { \notes \relative c'' { #(set-time-signature 9 8 '(2 2 2 3)) g8[ g] d[ d] g[ g] a8[( bes g]) | #(set-time-signature 5 8 '(3 2)) a4. g4 } \paper { \context { \StaffContext \consists "Measure_grouping_engraver" } } }
Program reference: TimeSignature, and Timing_engraver.
Automatic beaming does not use the measure grouping specified with
set-time-signature
.
Partial measures, for example in upsteps, are entered using the
\partial
command
\partial 16*5 c16 cis d dis e | a2. c,4 | b2
The syntax for this command is
\partial duration
This is internally translated into
\set Timing.measurePosition = -length of duration
The property measurePosition
contains a rational number
indicating how much of the measure has passed at this point.
Bar lines and bar numbers are calculated automatically. For unmetered
music (e.g. cadenzas), this is not desirable. By setting
Score.timing
to false, this automatic timing can be switched
off. Empty bar lines,
\bar ""
indicate where line breaks can occur.
Bar lines delimit measures, but are also used to indicate repeats. Normally, they are inserted automatically. Line breaks may only happen on bar lines.
Special types of bar lines can be forced with the \bar
command
c4 \bar "|:" c4
The following bar types are available
c4 \bar "|" c \bar "" c \bar "|:" c \bar "||" c \bar ":|" c \bar ".|" c \bar ".|." c \bar ":|:" c \bar "|." c \bar ":" c
For allowing line breaks, there is a special command,
\bar "empty"
This will insert an invisible bar line, and allow line breaks at this point.
In scores with many staves, a \bar
command in one staff is
automatically applied to all staves. The resulting bar lines are
connected between different staves of a StaffGroup
<< \context StaffGroup << \new Staff { e'4 d' \bar "||" f' e' } \new Staff { \clef bass c4 g e g } >> \new Staff { \clef bass c2 c2 } >>
A bar line is created whenever the whichBar
property is set.
At the start of a measure it is set to the contents of
defaultBarType
. The contents of repeatCommands
are used
to override default measure bars.
The command \bar
bartype is a short cut for doing
\set Timing.whichBar =
bartype. Whenever whichBar
is set to a string, a bar line of that type is created.
You are encouraged to use \repeat
for repetitions. See
Repeats.
In this manual: Repeats.
Program reference: the bar line objects that are created at Staff level are called BarLine, the bar lines that span staves are SpanBar objects.
The bar lines at the start of each system are
SystemStartBar, SystemStartBrace, and
SystemStartBracket. Only one of these types is created
in every context, and that type is determined by the property
systemStartDelimiter
.
Examples: input/test/bar-lines.ly,
The easiest way to enter fragments with more than one voice on a staff
is to split chords using the separator \\
. You can use it for
small, short-lived voices or for single chords
\context Staff \relative c'' { c4 << { f d e } \\ { b c2 } >> c4 << g' \\ b, \\ f' \\ d >> }
The separator causes Voice contexts9
to be instantiated. They bear the names "1"
, "2"
, etc. In
each of these contexts, vertical direction of slurs, stems, etc. is set
appropriately.
This can also be done by instantiating Voice contexts
by hand, and using \voiceOne
, up to \voiceFour
to assign
a stem directions and horizontal shift for each part
\relative c'' \context Staff << \new Voice { \voiceOne cis2 b } \new Voice { \voiceThree b4 ais ~ ais4 gis4 } \new Voice { \voiceTwo fis4~ fis4 f ~ f } >>
The command \oneVoice
will revert back to the normal setting.
Normally, note heads with a different number of dots are not merged, but
when the object property merge-differently-dotted
is set in
the NoteCollision object, they are merged
\context Voice << { g8 g8 \override Staff.NoteCollision #'merge-differently-dotted = ##t g8 g8 } \\ { g8.[ f16] g8.[ f16] } >>
Similarly, you can merge half note heads with eighth notes, by setting
merge-differently-headed
\context Voice << { c8 c4. \override Staff.NoteCollision #'merge-differently-headed = ##t c8 c4. } \\ { c2 c2 } >>
LilyPond also vertically shifts rests that are opposite of a stem
\context Voice << c''4 \\ r4 >>
\oneVoice
,
\voiceOne
,
\voiceTwo
,
\voiceThree
,
\voiceFour
.
The following commands specify in what chords of the current voice
should be shifted: the outer voice has \shiftOff
, and the inner
voices have \shiftOn
, \shiftOnn
, etc.
\shiftOn
,
\shiftOnn
,
\shiftOnnn
,
\shiftOff
.
Program reference: the objects responsible for resolving collisions are NoteCollision and RestCollision.
Examples: See also example files input/regression/collision-dots.ly, input/regression/collision-head-chords.ly, input/regression/collision-heads.ly, input/regression/collision-mesh.ly, and input/regression/collisions.ly.
Resolving collisions is a intricate subject, and only a few situations
are handled. When LilyPond cannot cope, the force-hshift
property of the NoteColumn object and pitched rests can
be used to override typesetting decisions.
When using merge-differently-headed
with an upstem eighth or a
shorter note, and a downstem half note, the eighth note gets the wrong
offset.
There is no support for clusters where the same note occurs with different accidentals in the same chord. In this case, it is recommended to use enharmonic transcription, or to use special cluster notation (see Clusters).
Beams are used to group short notes into chunks that are aligned with the metrum. They are inserted automatically
\time 2/4 c8 c c c \time 6/8 c c c c8. c16 c8
When these automatic decisions are not good enough, beaming can be entered explicitly. It is also possible to define beaming patterns that differ from the defaults.
Individual notes may be marked with \noBeam
, to prevent them
from being beamed
\time 2/4 c8 c\noBeam c c
Program reference: Beam.
In some cases it may be necessary to override the automatic beaming
algorithm. For example, the autobeamer will not put beams over rests
or bar lines. Such beams are specified by manually: the begin and end
point are marked with [
and ]
\context Staff { r4 r8[ g' a r8] r8 g[ | a] r8 }
Normally, beaming patterns within a beam are determined automatically.
If necessary, the properties stemLeftBeamCount
and
stemRightBeamCount
can be used to override the defaults. If
either property is set, its value will be used only once, and then it
is erased
\context Staff { f8[ r16 f g a] f8[ r16 \set stemLeftBeamCount = #1 f g a] }
The property subdivideBeams
can be set in order to subdivide
all 16th or shorter beams at beat positions, as defined by the
beatLength
property.
c16[ c c c c c c c] \set subdivideBeams = ##t c16[ c c c c c c c] \set Score.beatLength = #(ly:make-moment 1 8) c16[ c c c c c c c]
Kneed beams are inserted automatically, when a large gap is detected
between the note heads. This behavior can be tuned through the object
property auto-knee-gap
.
Normally, line breaks are forbidden when beams cross bar lines. This
behavior can be changed by setting allowBeamBreak
.
Automatically kneed cross-staff beams cannot be used together with hidden staves.
In normal time signatures, automatic beams can start on any note but can
only end in a few positions within the measure: beams can end on a beat,
or at durations specified by the properties in
autoBeamSettings
. The defaults for autoBeamSettings
are defined in scm/auto-beam.scm.
The value of autoBeamSettings
is changed with two functions,
#(override-auto-beam-setting '(be p q n m) a b [context]) #(revert-auto-beam-setting '(be p q n m))
Here, be is the symbol begin
or end
, and
context is an optional context (default: 'Voice
). It
determines whether the rule applies to begin or end-points. The
quantity p/q refers to the length of the beamed notes (and
`* *
' designates notes of any length), n/M refers
to a time signature (wildcards `* *
' may be entered to
designate all time signatures), a/b is a duration. By
default, this command changes settings for the current voice. It is
also possible to adjust settings at higher contexts, by adding a
context argument.
For example, if automatic beams should end on every quarter note, use the following
#(override-auto-beam-setting '(end * * * *) 1 4 'Staff)
Since the duration of a quarter note is 1/4 of a whole note, it is
entered as (ly:make-moment 1 4)
.
The same syntax can be used to specify beam starting points. In this example, automatic beams can only end on a dotted quarter note
#(override-auto-beam-setting '(end * * * *) 3 8)
In 4/4 time signature, this means that automatic beams could end only on 3/8 and on the fourth beat of the measure (after 3/4, that is 2 times 3/8, has passed within the measure).
Rules can also be restricted to specific time signatures. A rule that should only be applied in N/M time signature is formed by replacing the second asterisks by N and M. For example, a rule for 6/8 time exclusively looks like
#(override-auto-beam-setting '(begin * * 6 8) ...)
If a rule should be to applied only to certain types of beams, use the
first pair of asterisks. Beams are classified according to the
shortest note they contain. For a beam ending rule that only applies
to beams with 32nd notes (and no shorter notes), use (end 1 32 *
*)
.
If beams are used to indicate melismata in songs, then automatic
beaming should be switched off. This is done by setting
autoBeaming
to #f
.
If a score ends while an automatic beam has not been ended and is
still accepting notes, this last beam will not be typeset at all. The
same holds polyphonic voices, entered with << ... \\ ...
>>
. If a polyphonic voice ends while an automatic beam is still
accepting notes, it is not typeset.
The rules for ending a beam depend on the shortest note in a beam. So, while it is possible to have different ending rules for eight beams and sixteenth beams, a beam that contains both eight and sixteenth notes will use the rules for the sixteenth beam.
In the example below, the autobeamer makes eight beams and sixteenth end at 3 eights; the third beam can only be corrected by specifying manual beaming.
It is not possible to specify beaming parameters that act differently in
different parts of a measure. This means that it is not possible to use
automatic beaming in irregular meters such as 5/8
.
This section describes how to change the way that accidentals are inserted automatically before the running notes.
Common rules for typesetting accidentals have been canned in a function. This function is called as follows
#(set-accidental-style 'modern 'Voice)
The function takes two arguments: a symbol that denotes the style (in
the example, modern
), and another symbol that denotes the
context name (in this example, Voice
). If no context name is
supplied, Staff
is the default.
The following styles are supported
default
voice
code
.
This leads to some weird and often unwanted results because accidentals from one voice do not get canceled in other voices
\context Staff << #(set-accidental-style 'voice) << { es g } \\ { c, e } >> >>
Hence you should only use voice
if the voices
are to be read solely by individual musicians. If the staff is to be
used by one musician (e.g. a conductor) then you use
modern
or modern-cautionary
instead.
modern
default
, but temporary
accidentals also are canceled in other octaves. Furthermore,
in the same octave, they also get canceled in the following
measure
#(set-accidental-style 'modern) cis' c'' cis'2 | c'' c'
modern-cautionary
modern
, but the
“extra” accidentals (the ones not typeset by
default
) are typeset as cautionary accidentals.
They are printed in reduced size or with parentheses
#(set-accidental-style 'modern-cautionary) cis' c'' cis'2 | c'' c'
modern-voice
modern-voice-cautionary
modern-voice
, but with the extra
accidentals (the ones not typeset by voice
) typeset
as cautionaries. Even though all accidentals typeset by
default
are typeset by this variable then
some of them are typeset as cautionaries.
piano
modern
but accidentals also get canceled
across the staves in the same GrandStaff or
PianoStaff.
piano-cautionary
#(set-accidental-style 'piano)' , str)
but with the extra accidentals
typeset as cautionaries.
no-reset
default
but with accidentals lasting
“forever” and not only until the next measure
#(set-accidental-style 'no-reset) c1 cis cis c
forget
no-reset
: Accidentals
are not remembered at all—and hence all accidentals are
typeset relative to the key signature, regardless of what was
before in the music
#(set-accidental-style 'forget) \key d\major c4 c cis cis d d dis dis
Program reference: Accidental_engraver, Accidental, and AccidentalPlacement.
Simultaneous notes are considered to be entered in sequential mode. This means that in a chord the accidentals are typeset as if the notes in the chord happened once at a time - in the order in which they appear in the input file.
This is only a problem when accidentals in a chord depend on each
other. This problem can be solved by manually inserting !
and
?
for the problematic notes.
In the default scheme, accidentals only depend on other accidentals with the same pitch on the same staff, so no conflicts are possible.
A slur indicates that notes are to be played bound or legato.
They are entered using parentheses
f( g)( a) a8 b( a4 g2 f4) <c e>2( <b d>2)
Slurs avoid crossing stems, and are generally attached to note heads.
However, in some situations with beams, slurs may be attached to stem
ends. If you want to override this layout you can do this through the
object property attachment
of Slur. Its value
is a pair of symbols, specifying the attachment type of the left and
right end points
\slurUp \override Stem #'length = #5.5 g'8(g g4) \override Slur #'attachment = #'(stem . stem) g8( g g4)
If a slur would strike through a stem or beam, the slur will be moved away upward or downward. If this happens, attaching the slur to the stems might look better
\stemUp \slurUp d32( d'4 d8..) \override Slur #'attachment = #'(stem . stem) d,32( d'4 d8..)
\slurUp
,
\slurDown
,
\slurBoth
,
\slurDotted
,
\slurSolid
.
Program reference: Slur, and SlurEvent.
Producing nice slurs is a difficult problem, and LilyPond uses a simple, empiric method to produce slurs. In some cases, its results are ugly.
A phrasing slur (or phrasing mark) connects chords and is used to
indicate a musical sentence. It is started using \(
and \)
respectively
\time 6/4 c'\( d( e) f( e) d\)
Typographically, the phrasing slur behaves almost exactly like a
normal slur. However, they are treated as different objects. A
\slurUp
will have no effect on a phrasing slur; instead, you
should use \phrasingSlurUp
, \phrasingSlurDown
, and
\phrasingSlurBoth
.
The commands \slurUp
, \slurDown
, and \slurBoth
will only affect normal slurs and not phrasing slurs.
\phrasingSlurUp
,
\phrasingSlurDown
,
\phrasingSlurBoth
.
Program reference: see also PhrasingSlur, and PhrasingSlurEvent.
Phrasing slurs have the same limitations in their formatting as normal slurs. Putting phrasing slurs over rests leads to spurious warnings.
Breath marks are entered using \breathe
c'4 \breathe d4
The glyph of the breath mark can be tuned by overriding the
text
property of the BreathingSign
layout object with
any markup text. For example,
c'4 \override BreathingSign #'text = #(make-musicglyph-markup "scripts-rvarcomma") \breathe d4
Program reference: BreathingSign, BreathingSignEvent.
Examples: input/regression/breathing-sign.ly.
Metronome settings can be entered as follows
\tempo duration = per-minute
In the MIDI output, they are interpreted as a tempo change, and in the paper output, a metronome marking is printed
\tempo 8.=120 c''1
Program reference: MetronomeChangeEvent.
Some performance indications, e.g. rallentando or accelerando,
are written as texts, and extended over many measures with dotted
lines. You can create such texts using text spanners: attach
\startTextSpan
and \stopTextSpan
to the
start and ending note of the spanner.
The string to be printed, as well as the style, is set through object properties
\relative c' { c1 \override TextSpanner #'direction = #-1 \override TextSpanner #'edge-text = #'("rall " . "") c2\startTextSpan b c\stopTextSpan a }
Internals TextSpanEvent, TextSpanner.
Examples: input/regression/text-spanner.ly.
Brackets are used in musical analysis to indicate structure in musical
pieces. LilyPond supports a simple form of nested horizontal brackets.
To use this, add the Horizontal_bracket_engraver to
Staff context. A bracket is started with
\startGroup
and closed with \stopGroup
\score { \notes \relative c'' { c4\startGroup\startGroup c4\stopGroup c4\startGroup c4\stopGroup\stopGroup } \paper { \context { \StaffContext \consists "Horizontal_bracket_engraver" }}}
Program reference: HorizontalBracket, NoteGroupingEvent.
Examples: input/regression/note-group-bracket.ly.
A variety of symbols can appear above and below notes to indicate different characteristics of the performance. They are added to a note by adding a dash and the character signifying the articulation. They are demonstrated here
The meanings of these shorthands can be changed. See ly/script-init.ly for examples.
The script is automatically placed, but if you need to force
directions, you can use _
to force them down, or ^
to
put them up
c''4^^ c''4_^
Other symbols can be added using the syntax
note\
name, e.g. c4\fermata
. Again, they
can be forced up or down using ^
and _
,
e.g.
c\fermata c^\fermata c_\fermata
\scriptUp
,
\scriptDown
,
\scriptBoth
.
Program reference: ScriptEvent, and Script.
These note ornaments appear in the printed output but have no effect on the MIDI rendering of the music.
Fingering instructions can be entered using
note-digit
For finger changes, use markup texts
c'4-1 c'4-2 c'4-3 c'4-4 c'^\markup { \finger "2-3" }
You can use the thumb-script to indicate that a note should be played with the thumb (e.g. in cello music)
<a' a''-3>8_\thumb <b' b''-3>_\thumb
Fingerings for chords can also be added to individual notes of the chord by adding them after the pitches
< c-1 e-2 g-3 b-5 >4
iIn this case, setting fingeringOrientations
will put fingerings next
to note heads
\set fingeringOrientations = #'(left down) <c-1 es-2 g-4 bes-5 > 4 \set fingeringOrientations = #'(up right down) <c-1 es-2 g-4 bes-5 > 4 \set fingeringOrientations = #'(right) <es-2>4
The last note demonstrates how fingering instructions can be put close to note heads in monophonic music, using this feature.
Program reference: FingerEvent, and Fingering.
Examples: input/regression/finger-chords.ly.
It is possible to place arbitrary strings of text or markup text (see
Text markup) above or below notes by using a string
c^"text"
. By default, these indications do not influence the
note spacing, but by using the command \fatText
, the widths
will be taken into account
\relative c' { c4^"longtext" \fatText c4_"longlongtext" c4 }
It is possible to use TeX commands in the strings, but this should be avoided because the exact dimensions of the string can then no longer be computed.
In this manual: Text markup.
Program reference: TextScriptEvent, TextScript.
Grace notes are ornaments that are written out. The most common ones
are acciaccatura, which should be played as very short. It is denoted
by a slurred small note with a slashed stem. The appoggiatura is a
grace note that takes a fixed fraction of the main note, is and
denoted as a slurred note in small print without a slash.
They are entered with the commands \acciaccatura
and
\appoggiatura
, as demonstrated in the following example
b4 \acciaccatura d8 c4 \appoggiatura e8 d4 \acciaccatura { g16[ f] } e4
Both are special forms of the \grace
command. By prefixing this
keyword to a music expression, a new one is formed, which will be
printed in a smaller font and takes up no logical time in a measure.
c4 \grace c16 c4 \grace { c16[ d16] } c2 c4
Unlike \acciaccatura
and \appoggiatura
, the
\grace
command does not start a slur.
Internally, timing for grace notes is done using a second, `grace' time. Every point in time consists of two rational numbers: one denotes the logical time, one denotes the grace timing. The above example is shown here with timing tuples
The placement of grace notes is synchronized between different staves. In the following example, there are two sixteenth graces notes for every eighth grace note
<< \new Staff { e4 \grace { c16[ d e f] } e4 } \new Staff { c'4 \grace { g8[ b] } c4 } >>
If you want to end a note with a grace, the standard trick is to put the grace notes after a “space note”
\context Voice { << { d1^\trill ( } { s2 \grace { c16[ d] } } >> c4) }
By adjusting the duration of the skip note (here it is a half-note), the space between the main-note and the grace is adjusted.
A \grace
section will introduce special typesetting settings,
for example, to produce smaller type, and set directions. Hence, when
introducing layout tweaks, they should be inside the grace section,
for example,
\new Voice { \acciaccatura { \override Stem #'direction = #-1 f16-> \revert Stem #'direction } g4 }
The overrides should also be reverted inside the grace section.
If the layout of grace sections must be changed throughout the music,
then this can be accomplished through the function
add-grace-property
. The following example undefines the Stem
direction for this grace, so stems do not always point up.
\new Staff { #(add-grace-property "Voice" Stem direction '()) ... }
Another option is to change the variables startGraceMusic
,
stopGraceMusic
, startAccacciaturaMusic
,
stopAccacciaturaMusic
, startAppoggiaturaMusic
,
stopAppoggiaturaMusic
. More information is in the file
ly/grace-init.ly.
Program reference: GraceMusic.
A score that starts with an \grace
section needs an explicit
\context Voice
declaration, otherwise the main note and grace
note end up on different staves.
Grace note synchronization can also lead to surprises. Staff notation, such as key signatures, bar lines, etc. are also synchronized. Take care when you mix staves with grace notes and staves without, for example,
<< \new Staff { e4 \bar "|:" \grace c16 d4 } \new Staff { c4 \bar "|:" d4 } >>
This can be remedied by inserting grace skips, for the above example
\new Staff { c4 \bar "|:" \grace s16 d4 } >>
Grace sections should only be used within sequential music expressions. Nesting or juxtaposing grace sections is not supported, and might produce crashes or other errors.
A glissando is a smooth change in pitch. It is denoted by a line or a wavy line between two notes.
A glissando line can be requested by attaching a \glissando
to
a note
c'\glissando c'
Program reference: Glissando, and GlissandoEvent.
Example files: input/regression,glissando.ly
Printing text over the line (such as gliss.) is not supported.
Absolute dynamic marks are specified using a command after a note
c4\ff
. The available dynamic marks are \ppp
,
\pp
, \p
, \mp
, \mf
, \f
, \ff
,
\fff
, \fff
, \fp
, \sf
, \sff
,
\sp
, \spp
, \sfz
, and \rfz
c'\ppp c\pp c \p c\mp c\mf c\f c\ff c\fff c2\sf c\rfz
A crescendo mark is started with \<
and terminated with
\!
. A decrescendo is started with \>
and also terminated
with \!
. Because these marks are bound to notes, if you must
use spacer notes if multiple marks during one note are needed
c''\< c''\! d''\> e''\! << f''1 { s4 s4\< s4\! \> s4\! } >>
This may give rise to very short hairpins. Use minimum-length
in Voice.Hairpin to lengthen them, for
example
\override Staff.Hairpin #'minimum-length = #5
You can also use a text saying cresc. instead of hairpins. Here is an example how to do it
\setTextCresc c \< d e f\! \setHairpinCresc e\> d c b\!
You can also supply your own texts
\context Voice { \set crescendoText = \markup { \italic "cresc. poco" } \set crescendoSpanner = #'dashed-line a'2\< a a a\!\mf }
\dynamicUp
,
\dynamicDown
,
\dynamicBoth
.
Program reference: CrescendoEvent, DecrescendoEvent, and AbsoluteDynamicEvent.
Dynamics DynamicText and Hairpin objects. Vertical positioning of these symbols is handled by the DynamicLineSpanner object.
Repetition is a central concept in music, and multiple notations exist for repetitions. In LilyPond, most of these notations can be captured in a uniform syntax. One of the advantages is that they can be rendered in MIDI accurately.
The following types of repetition are supported
unfold
volta
tremolo
percent
LilyPond has one syntactic construct for specifying different types of repeats. The syntax is
\repeat variant repeatcount repeatbody
If you have alternative endings, you may add
\alternative{
alternative1 alternative2 alternative3 ...}
where each alternative is a music expression. If you do not give enough alternatives for all of the repeats, the first alternative is assumed to be played more than once.
Normal notation repeats are used like this
c1 \repeat volta 2 { c4 d e f } \repeat volta 2 { f e d c }
With alternative endings
c1 \repeat volta 2 {c4 d e f} \alternative { {d2 d} {f f,} }
\context Staff { \partial 4 \repeat volta 4 { e | c2 d2 | e2 f2 | } \alternative { { g4 g g } { a | a a a a | b2. } } }
A nested repeat like
\repeat ... \repeat ... \alternative
is ambiguous, since it is is not clear to which \repeat
the
\alternative
belongs. This ambiguity is resolved by always
having the \alternative
belong to the inner \repeat
.
For clarity, it is advisable to use braces in such situations.
For instructions on how to expand repeats for MIDI output, see the example file input/test/unfold-all-repeats.ly.
Timing information is not remembered at the start of an alternative,
so after a repeat timing information must be reset by hand, for
example by setting Score.measurePosition
or entering
\partial
. Similarly, slurs or ties are also not repeated.
The property repeatCommands
can be used to control the layout of
repeats. Its value is a Scheme list of repeat commands, where each repeat
command can be
start-repeat
,|:
bar line,
end-repeat
,:|
bar line,
(volta
text)
,(volta #f)
, whichc4 \set Score.repeatCommands = #'((volta "93") end-repeat) c4 c4 \set Score.repeatCommands = #'((volta #f)) c4 c4
Program reference: VoltaBracket, RepeatedMusic, VoltaRepeatedMusic, UnfoldedRepeatedMusic, and FoldedRepeatedMusic.
To place tremolo marks between notes, use \repeat
with tremolo
style
\score { \context Voice \notes\relative c' { \repeat "tremolo" 8 { c16 d16 } \repeat "tremolo" 4 { c16 d16 } \repeat "tremolo" 2 { c16 d16 } } }
Tremolo marks can also be put on a single note. In this case, the note should not be surrounded by braces.
\repeat "tremolo" 4 c'16
A similar mechanism is the tremolo subdivision, described in Tremolo subdivisions.
In this manual: Tremolo subdivisions, Repeats.
Program reference: tremolo beams are Beam objects. Single stem tremolos are StemTremolo objects. The music expression is TremoloEvent.
Example files: input/regression/chord-tremolo.ly, input/regression/stem-tremolo.ly.
Tremolo marks can be printed on a single note by adding
`:
[length]' after the note. The length must be at least
8. A length value of 8 gives one line across the note stem. If
the length is omitted, the last value (stored in tremoloFlags
)
is used
c'2:8 c':32 | c': c': |
Tremolos entered in this way do not carry over into the MIDI output.
In this manual: Tremolo repeats.
Elsewhere: StemTremolo, TremoloEvent.
In the percent
style, a note pattern can be repeated. It is
printed once, and then the pattern is replaced with a special sign.
Patterns of a one and two measures are replaced by percent-like signs,
patterns that divide the measure length are replaced by slashes
\context Voice { \repeat "percent" 4 { c'4 } \repeat "percent" 2 { c'2 es'2 f'4 fis'4 g'4 c''4 } }
Program reference: RepeatSlash, PercentRepeat, PercentRepeatedMusic, and DoublePercentRepeat.
Sometimes you might want to show only the rhythm of a melody. This can be done with the rhythmic staff. All pitches of notes on such a staff are squashed, and the staff itself has a single line
\context RhythmicStaff { \time 4/4 c4 e8 f g2 | r4 g r2 | g1:32 | r1 | }
Program reference: RhythmicStaff.
Examples: input/regression/rhythmic-staff.ly.
Percussion notes may be entered in \drums
mode, which is
similar to notes
. Each piece of percussion has a full name and
an abbreviated name, and both be used in input files
hihat hh bassdrum bd
The complete list of drum names is in the init file ly/drumpitch-init.ly.
Program reference: DrumNoteEvent.
A percussion part for more than one instrument typically uses a multiline staff where each position in the staff refers to one piece of percussion.
To typeset the music, the notes must be interpreted in a DrumStaff and DrumVoice contexts
up = \drums { crashcymbal4 hihat8 halfopenhihat hh hh hh openhihat } down = \drums { bassdrum4 snare8 bd r bd sn4 } \score { \new DrumStaff << \new DrumVoice { \voiceOne \up } \new DrumVoice { \voiceTwo \down } >> }
The above example shows verbose polyphonic notation. The short polyphonic notation, described in Polyphony, can also be used if the DrumVoices are instantiated by hand first. For example,
\drums \new DrumStaff << \context DrumVoice = "1" { s1 *2 } \context DrumVoice = "2" { s1 *2 } { bd4 sn4 bd4 sn4 << { \repeat unfold 16 hh16 } \\ { bd4 sn4 bd4 sn4 } >> } >>
There are also other layout possibilities. To use these, set the
property drumStyleTable
in context DrumVoice.
The following variables have been predefined
drums-style
The drum scheme supports six different toms. When there fewer toms, simply
select the toms that produce the desired result, i.e. to get toms on
the three middle lines you use tommh
, tomml
and
tomfh
.
timbales-style
congas-style
bongos-style
percussion-style
If you do not like any of the predefined lists you can define your own list at the top of your file
#(define mydrums '( (bassdrum default #f -1) (snare default #f 0) (hihat cross #f 1) (pedalhihat xcircle "stopped" 2) (lowtom diamond #f 3))) up = \drums { hh8 hh hh hh hhp4 hhp } down = \drums { bd4 sn bd toml8 toml } \score { \new DrumStaff << \set DrumStaff.drumStyleTable = #(alist->hash-table mydrums) \new DrumVoice { \voiceOne \up } \new DrumVoice { \voiceTwo \down } >> }
Init files: ly/drumpitch-init.ly.
Program reference: DrumStaff, DrumVoice.
Because general MIDI does not contain rim shots, the sidestick is used for this purpose instead.
Piano staves are two normal staves coupled with a brace. The staves are largely independent, but sometimes voices can cross between the two staves. The same notation is also used for harps and other key instruments. The PianoStaff is especially built to handle this cross-staffing behavior. In this section we discuss the PianoStaff and some other pianistic peculiarities.
There is no support for putting chords across staves. You can get this result by increasing the length of the stem in the lower stave so it reaches the stem in the upper stave, or vice versa. An example is included with the distribution as input/test/stem-cross-staff.ly.
Dynamics are not centered, but kludges do exist. See input/template/piano-dynamics.ly.
The distance between the two staves is normally fixed across the entire score. It is possible to tune this per system, but it does require arcane command incantations. See input/test/piano-staff-distance.ly.
Voices can switch automatically between the top and the bottom staff. The syntax for this is
\autochange \context Voice { ...music... }
The two staves of the piano staff must be named up
and
down
.
A \relative
section that is outside of \autochange
has
no effect on the pitches of music, so, if necessary, put
\relative
inside \autochange
like
\autochange \relative ... \new Voice ...
The autochanger switches on basis of pitch (middle C is the turning point), and it looks ahead skipping over rests to switch in advance. Here is a practical example
\score { \notes \context PianoStaff << \context Staff = "up" { \autochange \new Voice \relative c' { g4 a b c d r4 a g } } \context Staff = "down" { \clef bass s1*2 } >> }
In this example, spacer rests are used to prevent the bottom staff from terminating too soon.
In this manual: Manual staff switches.
Program reference: AutoChangeMusic.
The staff switches often do not end up in optimal places. For high quality output, staff switches should be specified manually.
\autochange
cannot be inside \times
.
Internally, the \partcombine
interprets both arguments as
Voice
s named one
and two
, and then decides when
the parts can be combined. Consequently, if the arguments switch to
differently named Voice contexts, the events in those
will be ignored.
Voices can be switched between staves manually, using the following command
\change Staff = staffname music
The string staffname is the name of the staff. It switches the
current voice from its current staff to the Staff called
staffname. Typically staffname is "up"
or
"down"
. The Staff
referred to must already exist, so
usually the setup for a score will start with a setup of the staves,
<< \context Staff = up { \skip 1 * 10 % keep staff alive } \context Staff = down { \skip 1 * 10 %idem } >>
and the Voice
is inserted afterwards
\context Staff = down \new Voice { ... \change Staff = up ... }
Pianos have pedals that alter the way sound are produced. Generally, a piano has three pedals, sustain, una corda, and sostenuto.
Piano pedal instruction can be expressed by attaching
\sustainDown
, \sustainUp
, \unaCorda
,
\treCorde
, \sostenutoDown
and \sostenutoUp
to a
note or chord
c'4\sustainDown c'4\sustainUp
What is printed can be modified by setting pedal
XStrings
,
where X is one of the pedal types: Sustain
,
Sostenuto
or UnaCorda
. Refer to
SustainPedal in the program reference for more
information.
Pedals can also be indicated by a sequence of brackets, by setting the
pedalSustainStyle
property to bracket
objects
\set Staff.pedalSustainStyle = #'bracket c\sustainDown d e b\sustainUp\sustainDown b g \sustainUp a \sustainDown \bar "|."
A third style of pedal notation is a mixture of text and brackets,
obtained by setting the pedalSustainStyle
style property to
mixed
\set Staff.pedalSustainStyle = #'mixed c\sustainDown d e b\sustainUp\sustainDown b g \sustainUp a \sustainDown \bar "|."
The default `*Ped.' style for sustain and damper pedals corresponds to
style #'text
. The sostenuto pedal uses mixed
style by
default.
c\sostenutoDown d e c, f g a\sostenutoUp
For fine-tuning of the appearance of a pedal bracket, the properties
edge-width
, edge-height
, and shorten-pair
of
PianoPedalBracket
objects (see
PianoPedalBracket in the Program reference) can be modified. For example, the
bracket may be extended to the end of the note head
\override Staff.PianoPedalBracket #'shorten-pair = #'(0 . -1.0) c\sostenutoDown d e c, f g a\sostenutoUp
You can specify an arpeggio sign on a chord by attaching an
\arpeggio
to a chord
<c e g c>\arpeggio
When an arpeggio crosses staves, you attach an arpeggio to the chords
in both staves, and set
PianoStaff.connectArpeggios
\context PianoStaff << \set PianoStaff.connectArpeggios = ##t \new Staff { <c' e g c>\arpeggio } \new Staff { \clef bass <c,, e g>\arpeggio } >>
The direction of the arpeggio is sometimes denoted by adding an arrowhead to the wiggly line
\context Voice { \arpeggioUp <c e g c>\arpeggio \arpeggioDown <c e g c>\arpeggio }
A square bracket on the left indicates that the player should not arpeggiate the chord
\arpeggioBracket <c' e g c>\arpeggio
\arpeggio
,
\arpeggioUp
,
\arpeggioUp
,
\arpeggioBoth
,
\arpeggioBracket
.
Program reference: ArpeggioEvent music expressions lead to Arpeggio objects. Cross staff arpeggios are PianoStaff.Arpeggio.
It is not possible to mix connected arpeggios and unconnected arpeggios in one PianoStaff at the same time.
Whenever a voice switches to another staff a line connecting the notes
can be printed automatically. This is enabled if the property
PianoStaff.followVoice
is set to true
\context PianoStaff << \set PianoStaff.followVoice = ##t \context Staff \context Voice { c1 \change Staff=two b2 a } \context Staff=two { \clef bass \skip 1*2 } >>
The associated object is VoiceFollower.
\showStaffSwitch
,
\hideStaffSwitch
.
This section discusses how to enter and print lyrics.
Lyrics are entered in a special input mode. This mode is is introduced
by the keyword \lyrics
. In this mode you can enter lyrics, with
punctuation and accents without any hassle. Syllables are entered like
notes, but with pitches replaced by text. For example,
\lyrics { Twin-4 kle4 twin- kle litt- le star2 }
A word in Lyrics mode begins with: an alphabetic character, _
,
?
, !
, :
, '
, the control characters ^A
through ^F
, ^Q
through ^W
, ^Y
, ^^
,
any 8-bit character with ASCII code over 127, or a two-character
combination of a backslash followed by one of `
, '
,
"
, or ^
.
Subsequent characters of a word can be any character that is not a digit
and not white space. One important consequence of this is that a word
can end with }
. The following example is usually a bug. The
syllable includes a }
, and hence the opening brace is not balanced
\lyrics { twinkle}
Similarly, a period following a alphabetic sequence, is included in the resulting string. As a consequence, spaces must be inserted around property commands
\override Score . LyricText #'font-shape = #'italic
Any _
character which appears in an unquoted word is converted
to a space. This provides a mechanism for introducing spaces into words
without using quotes. Quoted words can also be used in Lyrics mode to
specify words that cannot be written with the above rules
\lyrics { He said: "\"Let" my peo ple "go\"" }
However, at least for english texts, you should use
\lyrics { He said: ``Let my peo ple go'' }
to get the correct shape of the starting and ending quote.
Centered hyphens are entered as `-
-
' between syllables.
The hyphen will have variable length depending on the space between
the syllables and it will be centered between the syllables.
When a lyric is sung over many notes (this is called a melisma), this is
indicated with a horizontal line centered between a syllable and the
next one. Such a line is called an extender line, and it is entered as
__
.
Program reference: events LyricEvent, HyphenEvent, and ExtenderEvent. Objects LyricHyphen, LyricExtender and LyricText.
Examples: input/test/lyric-hyphen-retain.ly.
The definition of lyrics mode is too complex.
Lyrics are printed by interpreting them in a Lyrics context
\context Lyrics \lyrics ...
This will place the lyrics according to the durations that were
entered. The lyrics can also be aligned under a given melody
automatically. In this case, it is no longer necessary to enter the
correct duration for each syllable. This is achieved by combining the
melody and the lyrics with the \lyricsto
expression
\lyricsto name \new Lyrics ...
This aligns the lyrics to the
notes of the Voice context called name, which has
to exist. Therefore, normally the Voice
is specified first, and
then the lyrics are specified with \lyricsto
.
For different or more complex orderings, the best way is to setup the hierarchy of staves and lyrics first, e.g.
\context ChoirStaff \notes << \context Lyrics = sopranoLyrics { s1 } \context Voice = soprano { music } \context Lyrics = tenorLyrics { s1 } \context Voice = tenor { music } >>
and then combine the appropriate melodies and lyric lines
\lyricsto "soprano" \context Lyrics = sopranoLyrics the lyrics
The final input would resemble
<< \context ChoirStaff \notes << setup the music >> \lyricsto "soprano" etc \lyricsto "alto" etc etc >>
The \lyricsto
command detects melismata: it only puts one
syllable under a tied or slurred group of notes. If you want to force
an unslurred group of notes to be a melisma, insert \melisma
after the first note of the group, and \melismaEnd
after the
last one, e.g.
<< \context Voice = "lala" { \time 3/4 f4 g8 \melisma f e f \melismaEnd e2 } \lyricsto "lala" \new Lyrics \lyrics { la di __ daah } >>
In addition, notes are considered a melisma if they are manually
beamed, and automatic beaming (see Setting automatic beam behavior) is switched off. The criteria for deciding melismata can
be tuned with the property melismaBusyProperties
. See
Melisma_translator in the program reference for more
information.
When multiple stanzas are put on the same melody, it can happen that
two stanzas have melismata in different locations. This can be
remedied by switching off melismata for one
Lyrics. This is achieved by setting
the ignoreMelismata
property to #t
. An example is shown
in input/regression/lyric-combine-new.ly.
A complete example of a SATB score setup is in the file input/template/satb.ly.
Program reference: Music expressions: LyricCombineMusic, Contexts: Lyrics, Melisma_translator.
Examples: input/template/satb.ly, input/regression/lyric-combine-new.ly.
Melismata are not detected automatically, and extender lines must be inserted by hand.
For proper processing of extender lines, the
Lyrics and Voice should be
linked. This can be achieved either by using \lyricsto
or by
setting corresponding names for both contexts. The latter is explained
in More stanzas.
The lyrics should be aligned with the note heads of the melody. To
achieve this, each line of lyrics should be marked to correspond with
the melodic line. This is done automatically when \lyricsto
,
but it can also be done manually.
To this end, give the Voice context an identity
\context Voice = duet { \time 3/4 g2 e4 a2 f4 g2. }
Then set the Lyrics contexts to names starting with
that identity followed by a dash. In the preceding example, the
Voice identity is duet
, so the identities of the
Lyricss are marked duet-1
and duet-2
\context Lyrics = "duet-1" { Hi, my name is Bert. } \context Lyrics = "duet-2" { Ooooo, ch\'e -- ri, je t'aime. }
The complete example is shown here
\score { << \notes \relative c'' \context Voice = duet { \time 3/4 g2 e4 a2 f4 g2. } \lyrics << \lyricsto "duet" \new Lyrics { \set vocalName = "Bert" Hi, my name is Bert. } \lyricsto "duet" \new Lyrics { \set vocalName = "Ernie" Ooooo, ch\'e -- ri, je t'aime. } >> >> }
Stanza numbers can be added by setting stanza
, e.g.
<< \context Voice = duet { \time 3/4 g2 e4 a2 f4 g2. } \lyrics \lyricsto "duet" \new Lyrics { \set stanza = "1. " Hi, my name is Bert. } >>
This example also demonstrates how names of the singers can be added
using vocalName
analogous to instrument annotations for staves.
A short version may be entered as vocNam
.
To make empty spaces in lyrics, use \skip
.
Program reference: Layout objects LyricText and VocalName. Music expressions LyricEvent.
Input for lyrics introduces a syntactical ambiguity
foo = bar
is interpreted as assigning a string identifier \foo
such that
it contains "bar"
. However, it could also be interpreted as
making or a music identifier \foo
containing the syllable
`bar'. The force the latter interpretation, use
foo = \lyrics bar4
The term ambitus denotes a range of pitches for a given voice in a part of music. It also may denote the pitch range that a musical instrument is capable of playing. Ambituses are printed on vocal parts, so singers can easily determine if it meets his or her capabilities.
It denoted at the beginning of a piece near the initial clef. The range is graphically specified by two note heads, that represent the minimum and maximum pitch. To print such ambituses, add the Ambitus_engraver to the Voice context, for example,
\paper { \context { \VoiceContext \consists Ambitus_engraver } }
This results in the following output
If you have multiple voices in a single staff, and you want a single ambitus per staff rather than per each voice, add the Ambitus_engraver to the Staff context rather than to the Voice context.
It is possible to tune individual ambituses for multiple voices on a single staff, for example by erasing or shifting them horizontally. An example is in input/test/ambitus-mixed.ly.
Program reference: Ambitus.
Examples: input/regression/ambitus.ly, input/test/ambitus-mixed.ly.
There is no collision handling in the case of multiple per-voice ambitus.
Tablature notation is used for notating music for plucked string instruments. It notates pitches not by using note heads, but by indicating on which string and fret a note must be played. LilyPond offers limited support for tablature.
The string number associated to a note is given as a backslash
followed by a number, e.g. c4\3
for a C quarter on the third
string. By default, string 1 is the highest one, and the tuning
defaults to the standard guitar tuning (with 6 strings). The notes
are printed as tablature, by using TabStaff and
TabVoice contexts
\notes \context TabStaff { a,4\5 c'\2 a\3 e'\1 e\4 c'\2 a\3 e'\1 }
When no string is specified, the first string that does not give a
fret number less than minimumFret
is selected. The default
value for minimumFret
is 0
e16 fis gis a b4 \set TabStaff.minimumFret = #8 e16 fis gis a b4
Program reference: TabStaff, TabVoice, and StringNumberEvent.
Chords are not handled in a special way, and hence the automatic string selector may easily select the same string to two notes in a chord.
You can change the number of strings, by setting the number of lines in the TabStaff.
You can change the tuning of the strings. A string tuning is given as
a Scheme list with one integer number for each string, the number
being the pitch (measured in semitones relative to middle C) of an
open string. The numbers specified for stringTuning
are the
numbers of semitones to subtract or add, starting the specified pitch
by default middle C, in string order. Thus, the notes are e, a, d, and
g
\context TabStaff << \set TabStaff.stringTunings = #'(-5 -10 -15 -20) \notes { a,4 c' a e' e c' a e' } >>
No guitar special effects have been implemented.
Program reference: Tab_note_heads_engraver.
LilyPond has support for both printing chord names. Chords may be
entered in musical chord notation, i.e. < .. >
, but they can
also be entered by name. Internally, the chords are represented as a
set of pitches, so they can be transposed
twoWays = \notes \transpose c c' { \chords { c1 f:sus4 bes/f } <c e g> <f bes c'> <f bes d'> } \score { << \context ChordNames \twoWays \context Voice \twoWays >> }
This example also shows that the chord printing routines do not try to
be intelligent. The last chord (f bes d
) is not interpreted as
an inversion.
Chord mode is a mode where you can input sets of pitches using common
names. It is introduced by the keyword \chords
.
In chords mode, a chord is entered by the root, which is entered
like a common pitch
\chords { es4. d8 c2 }
Other chords may be entered by suffixing a colon, and introducing a modifier, and optionally, a number
\chords { e1:m e1:7 e1:m7 }
The first number following the root is taken to be the `type' of the chord, thirds are added to the root until it reaches the specified number
\chords { c:3 c:5 c:6 c:7 c:8 c:9 c:10 c:11 }
More complex chords may also be constructed adding separate steps to a chord. Additions are added after the number following the colon, and are separated by dots
\chords { c:5.6 c:3.7.8 c:3.6.13 }
Chord steps can be altered by suffixing a -
or +
sign
to the number
\chords { c:7+ c:5+.3- c:3-.5-.7- }
Removals are specified similarly, and are introduced by a caret. They must come after the additions
\chords { c^3 c:7^5 c:9^3.5 }
Modifiers can be used to change pitches. The following modifiers are supported
m
dim
aug
maj
sus
2
or 4
to add the 2nd or 4th step to
the chord.
\chords { c:sus4 c:7sus4 c:dim7 c:m6 }
Since an unaltered 11 does not sound good when combined with an unaltered 13, the 11 is removed in this case (unless it is added explicitly)
\chords { c:13 c:13.11 c:m13 }
An inversion (putting one pitch of the chord on the bottom), as well
as bass notes, can be specified by appending
/
pitch to the chord
\chords { c1 c/g c/f }
A bass note can be added instead of transposed out of the chord,
by using /+
pitch.
\chords { c1 c/+g c/+f }
Chords is a mode similar to \lyrics
, \notes
etc. Most
of the commands continue to work, for example, r
and
\skip
can be used to insert rests and spaces, and property
commands may be used to change various settings.
Each step can only be present in a chord once. The following
simply produces the augmented chord, since 5+
is interpreted
last
\chords { c:5.5-.5+ }
For displaying printed chord names, use the ChordNames context.
The chords may be entered either using the notation
described above, or directly using <
and >
scheme = \notes { \chords {a1 b c} <d' f' a'> <e' g' b'> } \score { \notes << \context ChordNames \scheme \context Staff \scheme >> }
You can make the chord changes stand out by setting
ChordNames.chordChanges
to true. This will only
display chord names when there is a change in the chords scheme and at
the start of a new line
scheme = \chords { c1:m c:m \break c:m c:m d } \score { \notes << \context ChordNames { \set chordChanges = ##t \scheme } \context Staff \transpose c c' \scheme >> }
The default chord name layout is a system for Jazz music, proposed by Klaus Ignatzek (see Literature list). It can be tuned through the following properties
chordNameExceptions
majorSevenSymbol
whiteTriangleMarkup
and
blackTriangleMarkup
. See
input/regression/chord-name-major7.ly for an example.
chordNameSeparator
chordNameSeparator
, you can specify other
separators, e.g.
\context ChordNames \chords { c:7sus4 \set chordNameSeparator = \markup { \typewriter "|" } c:7sus4 }
chordRootNamer
The predefined variables \germanChords
,
\semiGermanChords
set these variables.
chordNoteNamer
chordRootNamer
. The chordNoteNamer
property can be set
to a specialized function to change this behavior. For example, the
base can be printed in lower case.
There are also two other chord name schemes implemented: an alternate Jazz chord notation, and a systematic scheme called Banter chords. The alternate jazz notation is also shown on the chart in Chord name chart. Turning on these styles is described in the input file input/test/chord-names-jazz.ly.
\germanChords
,
\semiGermanChords
.
Examples: input/regression/chord-name-major7.ly, input/regression/chord-name-exceptions.ly, input/test/chord-names-jazz.ly, input/test/chord-names-german.ly.
Init files: scm/chords-ignatzek.scm, and scm/chord-entry.scm.
Chord names are determined solely from the list of pitches. Chord
inversions are not identified, and neither are added bass notes. This
may result in strange chord names when chords are entered with the
< .. >
syntax.
Orchestral music involves some special notation, both in the full score and the individual parts. This section explains how to tackle some common problems in orchestral music.
Polyphonic scores consist of many staves. These staves can be constructed in three different ways
To print a rehearsal mark, use the \mark
command
\relative c'' { c1 \mark \default c1 \mark \default c1 \mark #8 c1 \mark \default c1 \mark \default }
(The letter I is skipped in accordance with engraving traditions.)
The mark is incremented automatically if you use \mark
\default
, but you can also use an integer argument to set the mark
manually. The value to use is stored in the property
rehearsalMark
.
The style is defined by the property markFormatter
. It is a
function taking the current mark (an integer) and the current context
as argument. It should return a markup object. In the following
example, markFormatter
is set to a canned procedure. After a
few measures, it is set to function that produces a boxed number.
\set Score.markFormatter = #format-mark-numbers c1 \mark \default c1 \mark \default \set Score.markFormatter = #(lambda (mark context) (make-bold-markup (make-box-markup (number->string mark)))) c1 \mark \default c1 \mark \default
The file scm/translation-functions.scm contains the definitions
of format-mark-numbers
(the default format) and
format-mark-letters
. They can be used as inspiration for other
formatting functions.
The \mark
command can also be used to put signs like coda,
segno and fermatas on a bar line. Use \markup
to
to access the appropriate symbol
c1 \mark \markup { \musicglyph #"scripts-ufermata" } c1
In the case of a line break, marks must also be printed at the end of the line, and not at the beginning. Use the following to force that behavior
\override Score.RehearsalMark #'break-visibility = #begin-of-line-invisible
Program reference: MarkEvent, RehearsalMark.
Init files: scm/translation-functions.scm contains the
definition of format-mark-numbers
and
format-mark-letters
. They can be used as inspiration for other
formatting functions.
Examples: input/regression/rehearsal-mark-letter.ly, input/regression/rehearsal-mark-number.ly.
Bar numbers are printed by default at the start of the line. The
number itself is stored in the
currentBarNumber
property,
which is normally updated automatically for every measure.
Bar numbers can be typeset at regular intervals instead of at the beginning of each line. This is illustrated in the following example, whose source is available as input/test/bar-number-regular-interval.ly
Program reference: BarNumber.
Examples: input/test/bar-number-every-five-reset.ly, and input/test/bar-number-regular-interval.ly.
Bar numbers can collide with the StaffGroup bracket, if
there is one at the top. To solve this, the
padding
property of BarNumber can be
used to position the number correctly.
In an orchestral score, instrument names are printed left side of the staves.
This can be achieved by setting Staff.instrument
and Staff.instr
. This will print a string before
the start of the staff. For the first start, instrument
is
used, for the next ones instr
is used.
\set Staff.instrument = "Ploink " \set Staff.instr = "Plk " c1 \break c''
You can also use markup texts to construct more complicated instrument names, for example
\notes { \set Staff.instrument = \markup { \column < "Clarinetti" { "in B" \smaller \flat } > } { c''1 } }
Program reference: InstrumentName.
When you put a name on a grand staff or piano staff the width of the brace is not taken into account. You must add extra spaces to the end of the name to avoid a collision.
A music expression can be transposed with \transpose
. The
syntax is
\transpose from to musicexpr
This means that musicexpr is transposed by the interval between
the pitches from and to: any note with pitch from
is changed to to
.
For example, consider a piece written in the key of D major. If this piece is a little too low for its performer, it can be transposed up to E major with
\transpose d e ...
Consider a part written for violin (a C instrument). If this part is to be played on the A clarinet, the following transposition will produce the appropriate part
\transpose a c ...
Since from and to are pitches, so \transpose
must be
inside a \notes
section. \transpose
distinguishes
between enharmonic pitches: both \transpose c cis
or
\transpose c des
will transpose up half a tone. The first
version will print sharps and the second version will print flats
mus =\notes { \key d \major cis d fis g } \score { \notes \context Staff { \clef "F" \mus \clef "G" \transpose c g' \mus \transpose c f' \mus }}
Program reference: TransposedMusic, and UntransposableMusic.
If you want to use both \transpose
and \relative
,
you must put \transpose
outside of \relative
, since
\relative
will have no effect music that appears inside a
\transpose
.
The key of a transposing instrument can also be specified. This applies to many wind instruments, for example, clarinets (B-flat, A and E-flat), horn (F) and trumpet (B-flat, C, D and E-flat).
The transposition is entered after the keyword \transposition
\transposition bes %% B-flat clarinet
This command sets the property instrumentTransposition
. The value of
this property is used for MIDI output and quotations. It does not
affect how notes are printed in the current staff.
Multi measure rests are entered using `R
'. It is specifically
meant for full bar rests and for entering parts: the rest can expand
to fill a score with rests, or it can be printed as a single
multimeasure rest. This expansion is controlled by the property
Score.skipBars
. If this is set to true, empty measures will not
be expanded, and the appropriate number is added automatically
\time 4/4 r1 | R1 | R1*2 \set Score.skipBars = ##t R1*17 R1*4
The 1
in R1
is similar to the duration notation used for
notes. Hence, for time signatures other than 4/4, you must enter other
durations. This can be done with augmentation dots or fractions
\set Score.skipBars = ##t \time 3/4 R2. | R2.*2 \time 13/8 R1*13/8 R1*13/8*12
An R
spanning a single measure is printed as either a whole rest
or a breve, centered in the measure regardless of the time signature.
Texts can be added to multi-measure rests by using the
note-markup
syntax (see Text markup). In this case, the number is
replaced. If you need both texts and the number, you must add the
number by hand. A variable (\fermataMarkup
) is provided for
adding fermatas
\time 3/4 R2._\markup { "Ad lib" } R2.^\fermataMarkup
If you want to have a text on the left end of a multi-measure rest, attach the text to a zero-length skip note, i.e.
s1*0^"Allegro" R1*4
Program reference: MultiMeasureRestEvent, MultiMeasureTextEvent, MultiMeasureRestMusicGroup, and MultiMeasureRest.
The layout object MultiMeasureRestNumber is for the default number, and MultiMeasureRestText for user specified texts.
It is not possible to use fingerings (e.g. R1-4
) to put numbers
over multi-measure rests.
There is no way to automatically condense multiple rests into a single multimeasure rest. Multi measure rests do not take part in rest collisions.
Be careful when entering multimeasure rests followed by whole notes. The following will enter two notes lasting four measures each
R1*4 cis cis
When skipBars
is set, the result will look OK, but the bar
numbering will be off.
Automatic part combining is used to merge two parts of music onto a staff. It is aimed at typesetting orchestral scores. When the two parts are identical for a period of time, only one is shown. In places where the two parts differ, they are typeset as separate voices, and stem directions are set automatically. Also, solo and a due parts are identified and can be marked.
The syntax for part combining is
\partcombine musicexpr1 musicexpr2
The music expressions will be interpreted as Voice
contexts. If using relative octaves, \relative
should be
specified for both music expressions, i.e.
\partcombine \relative ... musicexpr1 \relative ... musicexpr2
A \relative
section that is outside of \partcombine
has
no effect on the pitches of musicexpr1 and musicexpr2.
The following example demonstrates the basic functionality of the part combiner: putting parts on one staff, and setting stem directions and polyphony
\new Staff \partcombine \relative g' { g g a( b) c c r r } \relative g' { g g r4 r e e g g }
The first g
appears only once, although it was
specified twice (once in each part). Stem, slur and tie directions are
set automatically, depending whether there is a solo or unisono. The
first part (with context called one
) always gets up stems, and
`solo', while the second (called two
) always gets down stems and
`Solo II'.
If you just want the merging parts, and not the textual markings, you
may set the property soloADue
to false
\new Staff << \set Staff.soloADue = ##f \partcombine \relative g' { g a( b) r } \relative g' { g r4 r f } >>
Program reference: PartCombineMusic, SoloOneEvent, and SoloTwoEvent, and UnisonoEvent.
In soloADue
mode, when the two voices play the same notes on and
off, the part combiner may typeset a2
more than once in a
measure.
\partcombine
cannot be inside \times
.
\partcombine
cannot be inside \relative
.
Internally, the \partcombine
interprets both arguments as
Voice
s named one
and two
, and then decides when
the parts can be combined. Consequently, if the arguments switch to
differently named Voice contexts, the events in those
will be ignored.
In orchestral scores, staff lines that only have rests are usually removed. This saves some space. This style is called `French Score'. For Lyrics, ChordNames and FiguredBass, this is switched on by default. When these line of these contexts turn out empty after the line-breaking process, they are removed.
For normal staves, a specialized Staff context is
available, which does the same: staves containing nothing (or only
multi measure rests) are removed. The context definition is stored in
\RemoveEmptyStaffContext
variable. Observe how the second staff
in this example disappears in the second line
\score { \notes \relative c' << \new Staff { e4 f g a \break c1 } \new Staff { c4 d e f \break R1 } >> \paper { linewidth = 6.\cm \context { \RemoveEmptyStaffContext } } }
The first page shows all staves in full. If empty staves should be
removed from the first page too, set remove-first
to false in
RemoveEmptyVerticalGroup.
Another application is making ossia sections, i.e. alternative melodies on a separate piece of staff, with help of a Frenched staff. See input/test/ossia.ly for an example.
The \tag
command marks music expressions with a name. These
tagged expressions can be filtered out later. With this mechanism it
is possible to make different versions of the same music source.
In the following example, we see two versions of a piece of music, one for the full score, and one with cue notes for the instrumental part
c1 \relative c' << \tag #'part << R1 \\ { \set fontSize = #-1 c4_"cue" f2 g4 } >> \tag #'score R1 >> c1
The same can be applied to articulations, texts, etc.: they are made by prepending
-\tag #your-tag
to an articulation, for example,
c1-\tag #'part ^4
This defines a note with a conditional fingering indication.
By applying the remove-tag
function, tagged expressions can be
filtered. For example,
\simultaneous { the music \apply #(remove-tag 'score) the music \apply #(remove-tag 'part) the music }
would yield
The argument of the \tag
command should be a symbol, or a list
of symbols, for example,
\tag #'(original-part transposed-part) ...
Examples: input/regression/tag-filter.ly.
With quotations, fragments of other parts can be inserted into a part
directly. Before a part can be quoted, it must be marked especially as
quotable. This is done with code \addquote
command. The
quotation may then be done with \quote
\addquote name music \quote name duration
Here, name is an identifying string. The music is any kind
of music. This is an example of \addquote
\addquote clarinet \notes\relative c' { f4 fis g gis }
During a part, a piece of music can be quoted with the \quote
command.
\quote clarinet 2.
This would cite 3 quarter notes (a dotted half note) of the previously added clarinet voice.
Quotations take into account the transposition both source and target
instruments, if they are specified using the \transposition
command.
\addquote clarinet \notes\relative c' { \transposition bes f4 fis g gis } \score { \notes { e'8 f'8 \quote clarinet 2 } }
Only the contents of the first Voice occurring in an
\addquote
command will be considered for quotation, so
music can not contain \new
and \context Voice
statements that would switch to a different Voice.
In this manual: Instrument transpositions.
Examples: input/regression/quote.ly input/regression/quote-transposition.ly
Program reference: QuoteMusic.
Support for ancient notation includes features for mensural notation and Gregorian Chant notation. There is also limited support for figured bass notation.
Many graphical objects provide a style
property, see
Ancient note heads, Ancient accidentals, Ancient rests, Ancient clefs, Ancient flags and Ancient time signatures. By manipulating such a grob property, the typographical
appearance of the affected graphical objects can be accommodated for a
specific notation flavor without need for introducing any new
notational concept.
Other aspects of ancient notation can not that easily be expressed as in terms of just changing a style property of a graphical object. Therefore, some notational concepts are introduced specifically for ancient notation, see Custodes, Divisiones, Ligatures, and Figured bass.
If this all is way too much of documentation for you, and you just want to dive into typesetting without worrying too much about the details on how to customize a context, you may have a look at the predefined contexts (see Vaticana style contexts). Use them to set up predefined style-specific voice and staff contexts, and directly go ahead with the note entry.
Ligatures need special spacing that has not yet been implemented. As a result, there is too much space between ligatures most of the time, and line breaking often is unsatisfactory. Also, lyrics do not correctly align with ligatures.
Accidentals must not be printed within a ligature, but instead need to be collected and printed in front of it.
Augmentum dots within ligatures are not handled correctly.
For ancient notation, a note head style other than the default
style may be chosen. This is accomplished by setting the style
property of the NoteHead object to the desired value (baroque
,
neo_mensural
or mensural
). The baroque
style
differs from the default
style only in using a square shape for
\breve
note heads. The neo_mensural
style differs from
the baroque
style in that it uses rhomboidal heads for whole
notes and all smaller durations. Stems are centered on the note
heads. This style is in particular useful when transcribing mensural
music, e.g. for the incipit. The mensural
style finally
produces note heads that mimic the look of note heads in historic
printings of the 16th century.
The following example demonstrates the neo_mensural
style
\override NoteHead #'style = #'neo_mensural a'\longa a'\breve a'1 a'2 a'4 a'8 a'16
When typesetting a piece in Gregorian Chant notation, a Gregorian
ligature engraver will automatically select the proper note heads,
such there is no need to explicitly set the note head style. Still,
the note head style can be set e.g. to vaticana_punctum
to
produce punctum neumes. Similarly, a mensural ligature engraver is
used to automatically assemble mensural ligatures. See
Ligatures for how ligature engravers work.
In this manual Percussion staves use note head styles of their own that are frequently used in contemporary music notation.
Examples: input/regression/note-head-style.ly gives an overview over all available note head styles.
Use the style
property of grob Accidental to
select ancient accidentals. Supported styles are
mensural
, vaticana
, hufnagel
and medicaea
.
As shown, not all accidentals are supported by each style. When trying to access an unsupported accidental, LilyPond will switch to a different style, as demonstrated in input/test/ancient-accidentals.ly.
Similarly to local accidentals, the style of the key signature can be
controlled by the style
property of the
KeySignature grob.
In this manual: Pitches, Chromatic alterations and Accidentals give a general introduction into the use of accidentals. Key signature gives a general introduction into the use of key signatures.
Program reference: KeySignature.
Examples: input/test/ancient-accidentals.ly.
Use the style
property of grob Rest to select
ancient accidentals. Supported styles are classical
,
neo_mensural
and mensural
. classical
differs
from the default
style only in that the quarter rest looks like
a horizontally mirrored 8th rest. The neo_mensural
style suits
well for e.g. the incipit of a transcribed mensural piece of music.
The mensural
style finally mimics the appearance of rests as
in historic prints of the 16th century.
The following example demonstrates the neo_mensural
style
\override Rest #'style = #'neo_mensural r\longa r\breve r1 r2 r4 r8 r16
There are no 32th and 64th rests specifically for the mensural or neo-mensural style. Instead, the rests from the default style will be taken. See input/test/rests.ly for a chart of all rests.
There are no rests in Gregorian Chant notation; instead, it uses Divisiones.
In this manual: Rests gives a general introduction into the use of rests.
LilyPond supports a variety of clefs, many of them ancient.
The following table shows all ancient clefs that are supported via the
\clef
command. Some of the clefs use the same glyph, but
differ only with respect to the line they are printed on. In such
cases, a trailing number in the name is used to enumerate these clefs.
Still, you can manually force a clef glyph to be typeset on an
arbitrary line, as described in Clef. The note printed to the
right side of each clef in the example column denotes the c'
with respect to that clef.
Glyph Name | Description | Supported Clefs |
Example
|
clefs-neo_mensural_c | modern style mensural C clef |
neo_mensural_c1 , neo_mensural_c2 ,
neo_mensural_c3 , neo_mensural_c4 |
|
clefs-petrucci_c1
clefs-petrucci_c2
clefs-petrucci_c3
clefs-petrucci_c4
clefs-petrucci_c5
| petrucci style mensural C clefs, for use on different staff lines (the examples shows the 2nd staff line C clef). |
petrucci_c1
petrucci_c2
petrucci_c3
petrucci_c4
petrucci_c5
|
|
clefs-petrucci_f | petrucci style mensural F clef |
petrucci_f |
|
clefs-petrucci_g | petrucci style mensural G clef |
petrucci_g |
|
clefs-mensural_c | historic style mensural C clef |
mensural_c1 , mensural_c2 , mensural_c3 ,
mensural_c4 |
|
clefs-mensural_f | historic style mensural F clef |
mensural_f |
|
clefs-mensural_g | historic style mensural G clef |
mensural_g |
|
clefs-vaticana_do | Editio Vaticana style do clef |
vaticana_do1 , vaticana_do2 , vaticana_do3 |
|
clefs-vaticana_fa | Editio Vaticana style fa clef |
vaticana_fa1 , vaticana_fa2 |
|
clefs-medicaea_do | Editio Medicaea style do clef |
medicaea_do1 , medicaea_do2 , medicaea_do3 |
|
clefs-medicaea_fa | Editio Medicaea style fa clef |
medicaea_fa1 , medicaea_fa2 |
|
clefs-hufnagel_do | historic style hufnagel do clef |
hufnagel_do1 , hufnagel_do2 , hufnagel_do3 |
|
clefs-hufnagel_fa | historic style hufnagel fa clef |
hufnagel_fa1 , hufnagel_fa2 |
|
clefs-hufnagel_do_fa | historic style hufnagel combined do/fa clef |
hufnagel_do_fa |
|
Modern style means “as is typeset in contemporary editions of transcribed mensural music”.
Petrucci style means “inspired by printings published by the famous engraver Petrucci (1466-1539)”.
Historic style means “as was typeset or written in historic editions (other than those of Petrucci)”.
Editio XXX style means “as is/was printed in Editio XXX”.
Petrucci used C clefs with differently balanced left-side vertical beams, depending on which staff line it is printed.
In this manual: see Clef.
The mensural g clef is mapped to the Petrucci g clef, until a new mensural g clef is implemented.
Use the flag-style
property of grob Stem to
select ancient flags. Besides the default
flag style,
only mensural
style is supported
\override Stem #'flag-style = #'mensural \override Stem #'thickness = #1.0 \override NoteHead #'style = #'mensural \autoBeamOff c'8 d'8 e'8 f'8 c'16 d'16 e'16 f'16 c'32 d'32 e'32 f'32 s8 c''8 d''8 e''8 f''8 c''16 d''16 e''16 f''16 c''32 d''32 e''32 f''32
Note that the innermost flare of each mensural flag always is
vertically aligned with a staff line. If you do not like this
behavior, you can set the adjust-if-on-staffline
property of
grob Stem to ##f
. Then, the vertical position
of the end of each flare is different between notes on staff lines and
notes between staff lines
There is no particular flag style for neo-mensural notation. Hence, when typesetting e.g. the incipit of a transcribed piece of mensural music, the default flag style should be used. There are no flags in Gregorian Chant notation.
There is limited support for mensural time signatures. The
glyphs are hard-wired to particular time fractions. In other words,
to get a particular mensural signature glyph with the \time n/m
command, n
and m
have to be chosen according to the
following table
Use the style
property of grob TimeSignature to
select ancient time signatures. Supported styles are
neo_mensural
and mensural
. The above table uses the
neo_mensural
style. This style is appropriate e.g. for the
incipit of transcriptions of mensural pieces. The mensural
style mimics the look of historical printings of the 16th century.
input/test/time.ly gives an overview over all available ancient and modern styles.
Program reference: Time signature gives a general introduction into the use of time signatures.
Mensural signature glyphs are mapped to time fractions in a hard-wired
way. This mapping is sensible, but still arbitrary: given a mensural
time signature, the time fraction represents a modern meter that
usually will be a good choice when transcribing a mensural piece of
music. For a particular piece of mensural music, however, the mapping
may be unsatisfactory. In particular, the mapping assumes a fixed
transcription of durations (e.g. brevis = half note in 2/2, i.e. 4:1).
Some glyphs (such as the alternate glyph for 6/8 meter) are not at all
accessible through the \time
command.
Mensural time signatures are supported typographically, but not yet musically. The internal representation of durations is based on a purely binary system; a ternary division such as 1 brevis = 3 semibrevis (tempus perfectum) or 1 semibrevis = 3 minima (cum prolatione maiori) is not correctly handled: event times in ternary modes will be badly computed, resulting e.g. in horizontally misaligned note heads, and bar checks are likely to erroneously fail.
The syntax and semantics of the \time
command for mensural
music is subject to change.
A custos (plural: custodes; Latin word for `guard') is a symbol that appears at the end of a staff. It anticipates the pitch of the first note(s) of the following line and thus helps the player or singer to manage line breaks during performance, thus enhancing readability of a score.
Custodes were frequently used in music notation until the 17th century. Nowadays, they have survived only in a few particular forms of musical notation such as contemporary editions of Gregorian chant like the editio vaticana. There are different custos glyphs used in different flavors of notational style.
For typesetting custodes, just put a Custos_engraver into the
Staff context when declaring the \paper
block,
as shown in the following example
\paper { \context { \StaffContext \consists Custos_engraver Custos \override #'style = #'mensural } }
The result looks like this
The custos glyph is selected by the style
property. The styles
supported are vaticana
, medicaea
, hufnagel
and
mensural
. They are demonstrated in the following fragment
Program reference: Custos.
Examples: input/regression/custos.ly.
A divisio (plural: divisiones; Latin word for `division') is a staff context symbol that is used to structure Gregorian music into phrases and sections. The musical meaning of divisio minima, divisio maior and divisio maxima can be characterized as short, medium and long pause, somewhat like Breath marks. The finalis sign not only marks the end of a chant, but is also frequently used within a single antiphonal/responsorial chant to mark the end of each section.
To use divisiones, include the file gregorian-init.ly
. It
contains definitions that you can apply by just inserting
\divisioMinima
, \divisioMaior
, \divisioMaxima
,
and \finalis
at proper places in the input. Some editions use
virgula or caesura instead of divisio minima.
Therefore, gregorian-init.ly
also defines \virgula
and
\caesura
\virgula
,
\caesura
,
\divisioMinima
,
\divisioMaior
,
\divisioMaxima
,
\finalis
.
In this manual: Breath marks.
Program reference: BreathingSign, BreathingSignEvent.
Examples: input/test/divisiones.ly.
A ligature is a coherent graphical symbol that represents at least two distinct notes. Ligatures originally appeared in the manuscripts of Gregorian chant notation roughly since the 9th century to denote ascending or descending sequences of notes.
Ligatures are entered by enclosing them in \[
and \]
.
Some ligature styles may need additional input syntax specific for
this particular type of ligature. By default, the
LigatureBracket engraver just puts a square bracket
above the ligature
\score { \notes \transpose c c' { \[ g c a f d' \] a g f \[ e f a g \] } }
To select a specific style of ligatures, a proper ligature engraver has to be added to the Voice context, as explained in the following subsections. Only white mensural ligatures are supported with certain limitations.
There is limited support for white mensural ligatures.
To engrave white mensural ligatures, in the paper block the Mensural_ligature_engraver has to be put into the Voice context, and remove the Ligature_bracket_engraver
\paper { \context { \VoiceContext \remove Ligature_bracket_engraver \consists Mensural_ligature_engraver } }
There is no additional input language to describe the shape of a white mensural ligature. The shape is rather determined solely from the pitch and duration of the enclosed notes. While this approach may take a new user a while to get accustomed, it has the great advantage that the full musical information of the ligature is known internally. This is not only required for correct MIDI output, but also allows for automatic transcription of the ligatures.
For example,
\set Score.timing = ##f \set Score.defaultBarType = "empty" \override NoteHead #'style = #'neo_mensural \override Staff.TimeSignature #'style = #'neo_mensural \clef "petrucci_g" \[ g\longa c\breve a\breve f\breve d'\longa \] s4 \[ e1 f1 a\breve g\longa \]
Without replacing Ligature_bracket_engraver with Mensural_ligature_engraver, the same music transcribes to the following
The implementation is experimental; it may output strange warnings or even crash in some cases or produce weird results on more complex ligatures.
Gregorian square neumes notation (following the style of the Editio Vaticana) is under heavy development, but not yet really usable for production purposes. Core ligatures can already be typeset, but essential issues for serious typesetting are still under development, such as (among others) horizontal alignment of multiple ligatures, lyrics alignment and proper accidentals handling. Still, this section gives a sneak preview of what Gregorian chant may look like once it will work.
The following table contains the extended neumes table of the 2nd volume of the Antiphonale Romanum (Liber Hymnarius), published 1983 by the monks of Solesmes.
Neuma aut Neumarum Elementa |
Figurae Rectae |
Figurae Liquescentes Auctae |
Figurae Liquescentes Deminutae |
1. Punctum
|
|
|
|
2. Virga
|
|
| |
3. Apostropha vel Stropha
|
|
|
|
4. Oriscus
|
|
| |
5. Clivis vel Flexa
|
|
|
|
6. Podatus vel Pes
|
|
|
|
7. Pes Quassus
|
|
|
|
8. Quilisma Pes
|
|
|
|
9. Podatus Initio Debilis
|
|
|
|
10. Torculus
|
|
|
|
11. Torculus Initio Debilis
|
|
|
|
12. Porrectus
|
|
|
|
13. Climacus
|
|
|
|
14. Scandicus
|
|
|
|
15. Salicus
|
|
|
|
16. Trigonus
|
|
|
Unlike most other neumes notation systems, the input language for
neumes does not necessarily reflect directly the typographical
appearance, but is designed to solely focuse on musical meaning. For
example, \[ a \pes b \flexa g \]
produces a Torculus consisting
of three Punctum heads, while \[ a \flexa g \pes b \]
produces
a Porrectus with a curved flexa shape and only a single Punctum head.
There is no command to explicitly typeset the curved flexa shape; the
decision of when to typeset a curved flexa shape is purely taken from
the musical input. The idea of this approach is to separate the
musical aspects of the input from the notation style of the output.
This way, the same input can be reused to typeset the same music in a
different style of Gregorian chant notation.
The following table shows the code fragments that produce the
ligatures in the above neumes table. The letter in the first column
in each line of the below table indicates to which ligature in the
above table it refers. The second column gives the name of the
ligature. The third column shows the code fragment that produces this
ligature, using g
, a
and b
as example pitches.
# | Name |
Input Language
|
a | Punctum |
\[ b \]
|
b | Punctum Inclinatum |
\[ \inclinatum b \]
|
c | Punctum Auctum Ascendens |
\[ \auctum \ascendens b \]
|
d | Punctum Auctum Descendens |
\[ \auctum \descendens b \]
|
e | Punctum Inclinatum Auctum |
\[ \inclinatum \auctum b \]
|
f | Punctum Inclinatum Parvum |
\[ \inclinatum \deminutum b \]
|
g | Virga |
\[ \virga b \]
|
h | Stropha |
\[ \stropha b \]
|
i | Stropha Aucta |
\[ \stropha \auctum b \]
|
j | Oriscus |
\[ \oriscus b \]
|
k | Clivis vel Flexa |
\[ b \flexa g \]
|
l | Clivis Aucta Descendens |
\[ b \flexa \auctum \descendens g \]
|
m | Clivis Aucta Ascendens |
\[ b \flexa \auctum \ascendens g \]
|
n | Cephalicus |
\[ b \flexa \deminutum g \]
|
o | Podatus vel Pes |
\[ g \pes b \]
|
p | Pes Auctus Descendens |
\[ g \pes \auctum \descendens b \]
|
q | Pes Auctus Ascendens |
\[ g \pes \auctum \ascendens b \]
|
r | Epiphonus |
\[ g \pes \deminutum b \]
|
s | Pes Quassus |
\[ \oriscus g \pes \virga b \]
|
t | Pes Quassus Auctus Descendens |
\[ \oriscus g \pes \auctum \descendens b \]
|
u | Quilisma Pes |
\[ \quilisma g \pes b \]
|
v | Quilisma Pes Auctus Descendens |
\[ \quilisma g \pes \auctum \descendens b \]
|
w | Pes Initio Debilis |
\[ \deminutum g \pes b \]
|
x | Pes Auctus Descendens Initio Debilis |
\[ \deminutum g \pes \auctum \descendens b \]
|
y | Torculus |
\[ a \pes b \flexa g \]
|
z | Torculus Auctus Descendens |
\[ a \pes b \flexa \auctum \descendens g \]
|
A | Torculus Deminutus |
\[ a \pes b \flexa \deminutum g \]
|
B | Torculus Initio Debilis |
\[ \deminutum a \pes b \flexa g \]
|
C | Torculus Auctus Descendens Initio Debilis |
\[ \deminutum a \pes b \flexa \auctum \descendens g \]
|
D | Torculus Deminutus Initio Debilis |
\[ \deminutum a \pes b \flexa \deminutum g \]
|
E | Porrectus |
\[ a \flexa g \pes b \]
|
F | Porrectus Auctus Descendens |
\[ a \flexa g \pes \auctum \descendens b \]
|
G | Porrectus Deminutus |
\[ a \flexa g \pes \deminutum b \]
|
H | Climacus |
\[ \virga b \inclinatum a \inclinatum g \]
|
I | Climacus Auctus |
\[ \virga b \inclinatum a \inclinatum \auctum g \]
|
J | Climacus Deminutus |
\[ \virga b \inclinatum a \inclinatum \deminutum g \]
|
K | Scandicus |
\[ g \pes a \virga b \]
|
L | Scandicus Auctus Descendens |
\[ g \pes a \pes \auctum \descendens b \]
|
M | Scandicus Deminutus |
\[ g \pes a \pes \deminutum b \]
|
N | Salicus |
\[ g \oriscus a \pes \virga b \]
|
O | Salicus Auctus Descendens |
\[ g \oriscus a \pes \auctum \descendens b \]
|
P | Trigonus |
\[ \stropha b \stropha b \stropha a \]
|
The following head prefixes are supported
\virga
,
\stropha
,
\inclinatum
,
\auctum
,
\descendens
,
\ascendens
,
\oriscus
,
\quilisma
,
\deminutum
.
Head prefixes can be accumulated, though restrictions apply. For
example, either \descendens
or \ascendens
can be applied
to a head, but not both to the same head.
Two adjacent heads can be tied together with the \pes
and
\flexa
infix commands for a rising and falling line of melody,
respectively.
The predefined VaticanaVoiceContext
and
VaticanaStaffContext
can be used to easily engrave a piece of
Gregorian Chant in the style of the Editio Vaticana. These contexts
initialize all relevant context properties and grob properties to
proper values. With these contexts, you can immediately go ahead
entering the chant, as the following short excerpt demonstrates
\include "gregorian-init.ly" \score { << \context VaticanaVoice = "cantus" { \override Score.BarNumber #'transparent = ##t \notes { \[ c'\melisma c' \flexa a \] \[ a \flexa \deminutum g\melismaEnd \] f \divisioMinima \[ f\melisma \pes a c' c' \pes d'\melismaEnd \] c' \divisioMinima \break \[ c'\melisma c' \flexa a \] \[ a \flexa \deminutum g\melismaEnd \] f \divisioMinima } } \lyricsto "cantus" \new Lyrics \lyrics { San- ctus, San- ctus, San- ctus } >> }
LilyPond has limited support for figured bass
<< \context Voice \notes { \clef bass dis4 c d ais } \context FiguredBass \figures { < 6 >4 < 7 >8 < 6+ [_!] > < 6 >4 <6 5 [3+] > } >>
The support for figured bass consists of two parts: there is an input
mode, introduced by \figures
, where you can enter bass figures
as numbers, and there is a context called FiguredBass that
takes care of making BassFigure objects.
In figures input mode, a group of bass figures is delimited by
<
and >
. The duration is entered after the >>
<4 6>
Accidentals are added when you append -
, !
and +
to the numbers
<4- 6+ 7!>
Spaces or dashes may be inserted by using _
. Brackets are
introduced with [
and ]
< [4 6] 8 [_! 12]>
Although the support for figured bass may superficially resemble chord
support, it works much simpler. The \figures
mode simply
stores the numbers , and FiguredBass context prints
them as entered. There is no conversion to pitches, and no
realizations of the bass are played in the MIDI file.
Internally, the code produces markup texts. You can use any of the
markup text properties to override formatting. For example, the
vertical spacing of the figures may be set with baseline-skip
.
Program reference: BassFigureEvent music, BassFigure object, and FiguredBass context.
Slash notation for alterations is not supported.
In the 20th century, composers have greatly expanded the musical vocabulary. With this expansion, many innovations in musical notation have been tried. The book by Stone (1980) gives a comprehensive overview (see Literature list). In general, the use of new, innovative notation makes a piece harder to understand and perform and its use should therefore be avoided if possible. For this reason, support for contemporary notation in LilyPond is limited.
A cluster indicates a continuous range of pitches to be played. They
can be denoted as the envelope of a set of notes. They are entered by
applying the function notes-to-clusters
to a sequence of
chords, e.g.
\apply #notes-to-clusters { <c e > <b f'> }
The following example (from input/regression/cluster.ly) shows what the result looks like
Ordinary notes and clusters can be put together in the same staff, even simultaneously. In such a case no attempt is made to automatically avoid collisions between ordinary notes and clusters.
Program reference: ClusterSpanner, ClusterSpannerBeacon, Cluster_spanner_engraver, and ClusterNoteEvent.
Examples: input/regression/cluster.ly.
Music expressions like << { g8 e8 } a4 >>
are not printed
accurately. Use <g a>8 <e a>8
instead.
Contemporary music notation frequently uses special fermata symbols to indicate fermatas of differing lengths. The following fermatas are supported
See Articulations for general instructions how to apply scripts
such as fermatas to a \notes{}
block.
Elements of notation can be marked and named with the help of a square balloon. The primary purpose of this feature is to explain notation.
The following example demonstrates its use.
\context Voice \applyoutput #(add-balloon-text 'NoteHead "heads, or tails?" '(1 . -3)) c8
The function add-balloon-text
takes the name of a grob, the
label to print and where to put the label relative to the object. In
the above example, the text “heads or tails?” ends 3 spaces below
the `balloon.'
Program reference: text-balloon-interface.
Examples: input/regression/balloon.ly.
The `easy play' note head includes a name inside the head. It is used in music for beginners
\setEasyHeads c'2 e'4 f' | g'1
The command \setEasyHeads
overrides settings for the
NoteHead object. To make the letters readable, it has
to be printed in a large font size. To print with a larger font, see
Setting global staff size.
If you view the result with Xdvi, staff lines may show through the letters. Printing the PostScript file obtained does produce the correct result.
Entered music can also be converted to MIDI output. The performance is intended for proof-hearing the music for errors.
Ties, dynamics and tempo changes are interpreted. Dynamic marks,
crescendi and decrescendi translate into MIDI volume levels. Dynamic
marks translate to a fixed fraction of the available MIDI volume
range, crescendi and decrescendi make the volume vary linearly between
their two extremities. The fractions can be adjusted by
dynamicAbsoluteVolumeFunction
in Voice context.
For each type of MIDI instrument, a volume range can be defined. This
gives a basic equalizer control, which can enhance the quality of
the MIDI output remarkably. The equalizer can be controlled by
setting instrumentEqualizer
.
Many musically interesting effects, such as swing, articulation, slurring, etc., are not translated to MIDI.
The MIDI output allocates a channel for each Staff, and one for global settings. Hence, the MIDI file should not have more than 15 staves (or 14 if you do not use drums). Other staves will remain silent.
The MIDI block is analogous to the paper block, but it is somewhat
simpler. The \midi
block can contain
\tempo
definition, and
A number followed by a period is interpreted as a real number, so for setting the tempo for dotted notes, an extra space should be inserted, for example
\midi { \tempo 4 . = 120 }
Context definitions follow precisely the same syntax as within the \paper block. Translation modules for sound are called performers. The contexts for MIDI output are defined in ly/performer-init.ly.
The MIDI instrument name is set by the Staff.midiInstrument
property. The instrument name should be chosen from the list in
MIDI instruments.
If the selected string does not exactly match, the default is used, which is the Grand Piano.
The purpose of LilyPond's design is to provide the finest output quality as a default. Nevertheless, it may happen that you need to change this default layout. The layout is controlled through a large number of proverbial “knobs and switches.” This chapter does not list each and every knob. Rather, it outlines what groups of controls are available and explains how to lookup which knob to use for a certain effect.
The controls available for tuning are described in a separate document, the Program reference manual. This manual lists all different variables, functions and options available in LilyPond. It is written as a HTML document, which is available on-line, but is also included with the LilyPond documentation package.
There are three areas where the default settings may be changed:
Then, there are separate systems for typesetting text (like ritardando) and selecting different fonts. This chapter also discusses these.
Internally, LilyPond uses Scheme (a LISP dialect) to provide infrastructure. Overriding layout decisions in effect accesses the program internals, so it is necessary to learn a (very small) subset of Scheme. That is why this chapter starts with a short tutorial on entering numbers, lists, strings and symbols in Scheme.
LilyPond uses the Scheme programming language, both as part of the input syntax, and as internal mechanism to glue together modules of the program. This section is a very brief overview of entering data in Scheme.10
The most basic thing of a language is data: numbers, character strings, lists, etc. Here is a list of data types that are relevant to LilyPond input.
#t
and False is #f
.
1
is the (integer) number one, while -1.5
is a
floating point number (a non-integer number).
"this is a string"
Strings may span several lines
"this is a string"
Quotation marks and newlines can also be added with so-called escape
sequences. The string a said "b"
is entered as
"a said \"b\""
Newlines and backslashes are escaped with \n
and \\
respectively.
In a music file, snippets of Scheme code are introduced with the hash
mark #
. So, the previous examples translated in LilyPond are
##t ##f #1 #-1.5 #"this is a string" #"this is a string"
For the rest of this section, we will assume that the data is entered
in a music file, so we add #
s everywhere.
Scheme can be used to do calculations. It uses prefix
syntax. Adding 1 and 2 is written as (+ 1 2)
rather than the
traditional 1+2.
#(+ 1 2) => #3
The arrow => shows that the result of evaluating (+ 1 2)
is 3
. Calculations may be nested; the result of a function may
be used for another calculation.
#(+ 1 (* 3 4)) => #(+ 1 12) => #13
These calculations are examples of evaluations; an expression like
(* 3 4)
is replaced by its value 12
. A similar thing
happens with variables. After defining a variable
twelve = #12
variables can also be used in expressions, here
twentyFour = #(* 2 twelve)
the number 24 is stored in the variable twentyFour
.
The name of a variable is also an expression, similar to a number or a string. It is entered as
#'twentyFour
The quote mark '
prevents Scheme interpreter from substituting
24
for the twentyFour
. Instead, we get the name
twentyFour
.
This syntax will be used very frequently, since many of the layout tweaks involve assigning (Scheme) values to internal variables, for example
\override Stem #'thickness = #2.6
This instruction adjusts the appearance of stems. The value 2.6
is put into a the thickness
variable of a Stem
object. This makes stems almost twice as thick as their normal size.
To distinguish between variables defined in input files (like
twentyFour
in the example above), and internal variables, we
will call the latter “properties.” So, the stem object has a
thickness
property.
Two-dimensional offsets (X and Y coordinates) as well as object sizes
(intervals with a left and right point) are entered as pairs
. A
pair11 is entered
as (first . second)
and, like symbols, they must be quoted,
\override TextScript #'extra-offset = #'(1 . 2)
This assigns the pair (1, 2) to extra-offset
variable of the
TextScript object. This moves the object 1 staff space to the right,
and 2 spaces up.
The two elements of a pair may be arbitrary values, for example
#'(1 . 2) #'(#t . #f) #'("blah-blah" . 3.14159265)
A list is entered by enclosing its elements in parentheses, and adding a quote. For example,
#'(1 2 3) #'(1 2 "string" #f)
We have been using lists all along. A calculation, like (+ 1
2)
is also a list (containing the symbol +
and the numbers 1
and 2). Normally lists are interpreted as calculations, and the Scheme
interpreter substitutes the outcome of the calculation. To enter a
list, we stop evaluation. This is done by quoting the list with a
quote '
symbol. For calculations, do not use a quote.
Inside a quoted list or pair, there is no need to quote anymore. The following is a pair of symbols, a list of symbols and a list of lists respectively,
#'(stem . head) #'(staff clef key-signature) #'((1) (2))
When music is printed, a lot of notation elements must be added to the input, which is often bare bones. For example, compare the input and output of the following example:
cis4 cis2. g4
The input is rather sparse, but in the output, bar lines, accidentals, clef, and time signature are added. LilyPond interprets the input. During this step, the musical information is inspected in time order, similar to reading a score from left to right. While reading, the program remembers where measure boundaries are, and what pitches need explicit accidentals. This information can be presented on several levels. For example, the effect of an accidental is limited to a single stave, while a bar line must be synchronized across the entire score.
Within LilyPond, these rules and bits of information are grouped in
so-called Contexts. Examples of context are Voice
,
Staff
, and Score
. They are hierarchical, for
example, a Staff
can contain many Voice
s, and a
Score
can contain many Staff
contexts.
Each context has the responsibility for enforcing some notation rules,
creating some notation objects and maintaining the associated
properties. So, the synchronization of bar lines is handled at
Score
context. The Voice
may introduce an
accidentals and then the Staff
context maintains the rule to
show or suppress the accidental for the remainder of the measure.
For simple scores, contexts are created implicitly, and you need not be aware of them. For larger pieces, such as piano music, they must be created explicitly to make sure that you get as many staves as you need, and that they are in the correct order. For typesetting pieces with specialized notation, it can be useful to modify existing or define new contexts.
Full description of all available contexts is in the program reference, see Contexts.
For scores with only one voice and one staff, correct contexts are created automatically. For more complex scores, it is necessary to create them by hand. There are three commands which do this.
The easiest command is \new
, and it also the quickest to type.
It is prepended to a music expression, for example
\new type music expression
where type is a context name (like Staff
or
Voice
). This command creates a new context, and starts
interpreting music expression with that.
A practical application of \new
is a score with many
staves. Each part that should be on its own staff, is preceded with
\new Staff
.
<< \new Staff { c4 c } \new Staff { d4 d } >>
Like \new
, the \context
command also directs a music
expression to a context object, but gives the context an extra name. The
syntax is
\context type = id music
This form will search for an existing context of type type called id. If that context does not exist yet, it is created. This is useful if the context is referred to later on. For example, when setting lyrics the melody is in a named context
\context Voice = "tenor" music
so the texts can be properly aligned to its notes,
\new Lyrics \lyricsto "tenor" lyrics
Another possibility is funneling two different music expressions into one context. In the following example, articulations and notes are entered separately,
music = \notes { c4 c4 } arts = \notes { s4-. s4-> }
They are combined by sending both to the same Voice
context,
<< \new Staff \context Voice = "A" \music \context Voice = "A" \arts >>
The third command for creating contexts is
\context type music
This is similar to \context
with =
id, but matches
any context of type type, regardless of its given name.
This variant is used with music expressions that can be interpreted at
several levels. For example, the \applyoutput
command (see
Running a function on all layout objects). Without an explicit
\context
, it is usually is applied to Voice
\applyoutput #function % apply to Voice
To have it interpreted at the Score
or Staff
level use
these forms
\context Score \applyoutput #function \context Staff \applyoutput #function
Each context can have different properties, variables contained
in that context. They can be changed during the interpretation step.
This is achieved by inserting the \set
command in the music,
\set
context.
prop= #
value
For example,
R1*2 \set Score.skipBars = ##t R1*2
This command skips measures that have no notes. The result is that
multi rests are condensed. The value assigned is a Scheme object. In
this case, it is #t
, the boolean True value.
If the context argument is left out, then the current bottom-most
context (typically ChordNames
, Voice
, or
Lyrics
) is used. In this example,
c8 c c c \set autoBeaming = ##f c8 c c c
the context argument to \set
is left out, and the current
Voice is used.
Contexts are hierarchical, so if a bigger context was specified, for
example Staff
, then the change would also apply to all
Voice
s in the current stave. The change is applied
`on-the-fly', during the music, so that the setting only affects the
second group of eighth notes.
There is also an \unset
command,
\set
context.
prop
which removes the definition of prop. This command removes the definition only if it is set in context. In
\set Staff.autoBeaming = ##f \unset Voice.autoBeaming
the current Voice
does not have the property, and the
definition at Staff
level remains intact. Like \set
,
the context argument does not have to be specified for a bottom
context.
Settings that should only apply to a single time-step can be entered
easily with \once
, for example in
c4 \once \set fontSize = #4.7 c4 c4
the property fontSize
is unset automatically after the second
note.
A full description of all available context properties is in the program reference, see Tunable-context-properties.
Notation contexts (like Score and Staff) not only store properties,
they also contain plug-ins, called “engravers” that create notation
elements. For example, the Voice context contains a
Note_head_engraver
and the Staff context contains a
Key_signature_engraver
.
For a full a description of each plug-in, see Engravers. Every context described in Contexts lists the engravers used for that context.
It can be useful to shuffle around these plug-ins. This is done by
starting a new context, with \new
or \context
, and
modifying it like this,
\new context \with { \consists ... \consists ... \remove ... \remove ... etc. } ..music..
where the ... should be the name of an engraver. Here is a simple
example which removes Time_signature_engraver
and
Clef_engraver
from a Staff
context,
<< \new Staff { f2 g } \new Staff \with { \remove "Time_signature_engraver" \remove "Clef_engraver" } { f2 g2 } >>
In the second stave there are no time signature or clef symbols. This is a rather crude method of making objects disappear since it will affect the entire staff. The spacing will be adversely influenced too. A more sophisticated methods of blanking objects is shown in Common tweaks.
The next example shows a practical application. Bar lines and time
signatures are normally synchronized across the score. This is done
by the Timing_engraver
. This plug-in keeps an administration of
time signature, location within the measure, etc. By moving the
Timing_engraver
engraver from Score to Staff context, we can
have a score where each staff has its own time signature.
\new Score \with { \remove "Timing_engraver" } << \new Staff \with { \consists "Timing_engraver" } { \time 3/4 c4 c c c c c } \new Staff \with { \consists "Timing_engraver" } { \time 2/4 c4 c c c c c } >>
Each context is responsible for creating certain types of graphical objects. The settings used for printing these objects are also stored by context. By changing these settings, the appearance of objects can be altered.
The syntax for this is
\override context.name #'
property = #value
Here name is the name of a graphical object, like Stem
or
NoteHead
, and property is an internal variable of the
formatting system (`grob property' or `layout property'). The latter is a
symbol, so it must be quoted. The subsection Constructing a tweak explains what to fill in for name, property, and
value. Here we only discuss functionality of this command.
The command
\override Staff.Stem #'thickness = #4.0
makes stems thicker (the default is 1.3, with staff line thickness as a
unit). Since the command specifies Staff
as context, it only
applies to the current staff. Other staves will keep their normal
appearance. Here we see the command in action:
c4 \override Staff.Stem #'thickness = #4.0 c4 c4 c4
The \override
command is executed during the interpreting phase,
and changes the definition of the Stem
within
Staff
. After the command all stems are thickened.
Analogous to \set
, the context argument may be left out,
causing it to default to Voice
, and adding \once
applies
the change during one timestep only
c4 \once \override Stem #'thickness = #4.0 c4 c4
The \override
must be done before the object is
started. Therefore, when altering Spanner objects, like slurs or
beams, the \override
command must be executed at the moment when
the object is created. In this example,
\override Slur #'thickness = #3.0 c8[( c \override Beam #'thickness = #0.6 c8 c])
the slur is fatter and the beam is not. This is because the command for
Beam
comes after the Beam is started. Therefore it has no effect.
Analogous to \unset
, the \revert
command for a context
undoes a \override
command; like with \unset
, it only
affects settings that were made in the same context. In other words, the
\revert
in the next example does not do anything.
\override Voice.Stem #'thickness = #4.0 \revert Staff.Stem #'thickness
Internals: OverrideProperty, RevertProperty, PropertySet, All-backend-properties, and All-layout-objects.
The back-end is not very strict in type-checking object properties. Cyclic references in Scheme values for properties can cause hangs or crashes, or both.
The adjustments of the previous chapters can also be entered separate
from the music, in the \paper
block,
\paper { ... \context { \StaffContext \set fontSize = #-2 \override Stem #'thickness \remove "Time_signature_engraver" } }
Here
\StaffContext
takes the existing definition Staff
from the identifier
StaffContext
. This works analogously to other contexts, so that
the existing definition of Voice
is in \VoiceContext
.
The statements
\set fontSize = #-2 \override Stem #'thickness \remove "Time_signature_engraver"
affect all staves in the score.
The \set
keyword is optional within the \paper
block, so
fontSize = #-2
will also work.
It is not possible to collect changes in a variable, and apply them to
one \context
definition by referring to that variable.
Specific contexts, like Staff
and Voice
, are made of
simple building blocks, and it is possible to compose engraver
plug-ins in different combinations, thereby creating new types of
contexts.
The next example shows how to build a different type of
Voice
context from scratch. It will be similar to
Voice
, but print centered slash noteheads only. It can be used
to indicate improvisation in Jazz pieces,
These settings are again done within a \context
block inside a
\paper
block,
\paper { \context { ... } }
In the following discussion, the example input shown should go on the ... in the previous fragment.
First, name the context gets a name. Instead of Voice
it
will be called ImproVoice
,
\name ImproVoice
Since it is similar to the Voice
, we want commands that work
on (existing) Voice
s to remain working. This is achieved by
giving the new context an alias Voice
,
\alias Voice
The context will print notes, and instructive texts
\consists Note_heads_engraver \consists Text_engraver
but only on the center line,
\consists Pitch_squash_engraver squashedPosition = #0
The Pitch_squash_engraver modifies note heads (created
by Note_heads_engraver) and sets their vertical
position to the value of squashedPosition
, in this case
0
, the center line.
The notes look like a slash, without a stem,
\override NoteHead #'style = #'slash \override Stem #'transparent = ##t
All these plug-ins have to cooperate, and this is achieved with a
special plug-in, which must be marked with the keyword \type
.
This should always be Engraver_group_engraver,
\type "Engraver_group_engraver"
Putting together, we get
\context { \name ImproVoice \type "Engraver_group_engraver" \consists "Note_heads_engraver" \consists "Text_script_engraver" \consists Pitch_squash_engraver squashedPosition = #0 \override NoteHead #'style = #'slash \override Stem #'transparent = ##t \alias Voice }
Contexts form hierarchies. We want to hang the ImproVoice
under Staff
, just like normal Voice
s. Therefore, we
modify the Staff
definition with the \accepts
command,12
\context { \StaffContext \accepts ImproVoice }
Putting both into a \paper
block, like
\paper { \context { \name ImproVoice ... } \context { \StaffContext \accepts "ImproVoice" } }
Then the output at the start of this subsection can be entered as
\score { \notes \relative c'' { a4 d8 bes8 \new ImproVoice { c4^"ad lib" c c4 c^"undress" c c_"while playing :)" } a1 } }
There are many different properties. Not all of them are listed in this manual. However, the program reference lists them all in the section Tunable-context-properties, and most properties are demonstrated in one of the tips-and-tricks examples.
In the previous section, we have already touched on a command that
changes layout details, the \override
command. In this section,
we will look at in more detail how to use the command in practice.
First, we will give a a few versatile commands, which are sufficient
for many situations. The next section will discuss general use of
\override
.
Some overrides are so common that predefined commands are provided as
a short-cut, for example, \slurUp
and \stemDown
. These
commands are described in
the
Notation manual, under the sections for slurs and stems
respectively.
The exact tuning possibilities for each type of layout object are documented in the program reference of the respective object. However, many layout objects share properties, which can be used to apply generic tweaks. We mention a few of these:
extra-offset
property, which
has a pair of numbers as value, moves around objects in the printout.
The first number controls left-right movement; a positive number will
move the object to the right. The second number controls up-down
movement; a positive number will move it higher. The units of these
offsets are staff-spaces. The extra-offset
property is a
low-level feature: the formatting engine is completely oblivious to
these offsets.
In the following example, the second fingering is moved a little to the left, and 1.8 staff space downwards:
\stemUp f-5 \once \override Fingering #'extra-offset = #'(-0.3 . -1.8) f-5
transparent
property will cause an object to be printed
in `invisible ink': the object is not printed, but all its other
behavior is retained. The object still takes up space, it takes part in
collisions, and slurs, and ties and beams can be attached to it.
The following example demonstrates how to connect different voices using ties. Normally, ties only connect two notes in the same voice. By introducing a tie in a different voice,
and blanking a stem in that voice, the tie appears to cross voices:
<< { \once \override Stem #'transparent = ##t b8~ b8\noBeam } \\ { b[ g8] } >>
padding
property for objects with
side-position-interface
can be set to increase distance between
symbols that are printed above or below notes. We only give an
example; a more elaborate explanation is in Constructing a tweak:
c2\fermata \override Script #'padding = #3 b2\fermata
More specific overrides are also possible. The next section discusses in depth how to figure out these statements for yourself.
The general procedure of changing output, that is, entering a command like
\override Voice.Stem #'thickness = #3.0
means that we have to determine these bits of information:
Voice
.
Stem
.
thickness
3.0
We demonstrate how to glean this information from the notation manual and the program reference.
The program reference is a set of HTML pages, which is part of the documentation package. On Unix systems, it is typically in /usr/share/doc/lilypond. If you have them, it is best to bookmark them in your webbrowser, because you will need them. They are also available on the web: go to the LilyPond website, click “Documentation”, select the correct version, and then click “Program reference.”
If you have them, use the local HTML files. They will load faster, and they are exactly matched to LilyPond version installed.
Suppose we want to move the fingering indication in the fragment below:
c-2 \stemUp f
If you visit the documentation of Fingering
(in Fingering instructions), you will notice that there is written:
See also
Program reference: FingerEvent and Fingering.
This fragments points to two parts of the program reference: a page
on FingerEvent
and on Fingering
.
The page on FingerEvent
describes the properties of the music
expression for the input -2
. The page contains many links
forward. For example, it says
Accepted by: Fingering_engraver,
That link brings us to the documentation for the Engraver, the plug-in, which says
This engraver creates the following layout objects: Fingering.
In other words, once the FingerEvent
s are interpreted, the
Fingering_engraver
plug-in will process them.
The Fingering_engraver
is also listed to create
Fingering objects,
Lo and behold, that is also the second bit of information listed under See also in the Notation manual. By clicking around in the program reference, we can follow the flow of information within the program, either forward (like we did here), or backwards, following links like this:
fingering-event
is in Music objects of type
FingerEvent
This path goes against the flow of information in the program: it starts from the output, and ends at the input event.
The program reference can also be browsed like a normal document. It contains a chapter on Music-definitions, on Translation, and the Backend. Every chapter lists all the definitions used, and all properties that may be tuned.
Fingering is a layout object. Such an object is a symbol within the score. It has properties, which store numbers (like thicknesses and directions), but also pointers to related objects. A layout object is also called grob, which is short for Graphical Object.
The page for Fingering
lists the definitions for the
Fingering
object. For example, the page says
padding
(dimension, in staff space):
0.6
which means that the number will be kept at a distance of at least 0.6 of the note head.
Each layout object may have several functions as a notational or typographical element. For example, the Fingering object has the following aspects
Each of these aspects is captured in a so-called interface, which are listed on the Fingering page at the bottom
This object supports the following interfaces: item-interface, self-alignment-interface, side-position-interface, text-interface, text-script-interface, font-interface, finger-interface, and grob-interface.
Clicking any of the links will take you to the page of the respective object interface. Each interface has a number of properties. Some of them are not user-serviceable (“Internal properties”), but others are.
We have been talking of `the' Fingering
object, but actually it
does not amount to much. The initialization file
scm/define-grobs.scm shows the soul of the `object',
(Fingering . ( (print-function . ,Text_item::print) (padding . 0.6) (staff-padding . 0.6) (self-alignment-X . 0) (self-alignment-Y . 0) (script-priority . 100) (font-encoding . number) (font-size . -5) (meta . ((interfaces . (finger-interface font-interface text-script-interface text-interface side-position-interface self-alignment-interface item-interface)))) ))
as you can see, Fingering
is nothing more than a bunch of
variable settings, and the webpage is directly generated from this
definition.
Recall that we wanted to change the position of the 2 in
c-2 \stemUp f
Since the 2 is vertically positioned next to its note, we have to
meddle with the interface associated with this positioning. This is
done using side-position-interface
. The page for this interface
says
side-position-interface
Position a victim object (this one) next to other objects (the support). The property
direction
signifies where to put the victim object relative to the support (left or right, up or down?)
below this description, the variable padding
is described as
padding
- (dimension, in staff space)
add this much extra space between objects that are next to each other.
By increasing the value of padding
, we can move away the
fingering. The following command inserts 3 staff spaces of white
between the note and the fingering:
\once \override Fingering #'padding = #3
Inserting this command before the Fingering object is created,
i.e. before c2
, yields the following result:
\once \override Fingering #'padding = #3 c-2 \stemUp f
In this case, the context for this tweak is Voice
, which
does not have to be specified for \override
. This fact can
also be deduced from the program reference, for the page for the
Fingering_engraver plug-in says
Fingering_engraver is part of contexts: ... Voice
The most common thing to change about the appearance of fonts is their
size. The font size of any context can be easily changed by setting
the fontSize
property for that context. Its value is a number:
negative numbers make the font smaller, positive numbers larger. An
example is given below:
c4 c4 \set fontSize = #-3 f4 g4
This command will set font-size
(see below) in all layout
objects in the current context. It does not change the size of
variable symbols, such as beams or slurs.
The font size is set by modifying the font-size
property. Its
value is a number indicating the size relative to the standard size.
Each step up is an increase of approximately 12% of the font size. Six
steps is exactly a factor two. The Scheme function magstep
converts a font-size
number to a scaling factor.
LilyPond has fonts in different design sizes: the music fonts for smaller sizes are chubbier, while the text fonts are relatively wider. Font size changes are achieved by scaling the design size that is closest to the desired size.
The font-size
mechanism does not work for fonts selected
through font-name
. These may be scaled with
font-magnification
.
One of the uses of fontSize
is to get smaller symbols for cue
notes. An elaborate example of those is in
input/test/cue-notes.ly.
The following commands set fontSize
for the current voice:
Font selection for the standard fonts, TeX's Computer Modern fonts,
can also be adjusted with a more fine-grained mechanism. By setting
the object properties described below, you can select a different font;
all three mechanisms work for every object that supports
font-interface
:
font-encoding
is a symbol that sets layout of the glyphs. Choices include
text
for normal text, braces
(for piano staff braces),
music
(the standard music font, including ancient glyphs),
dynamic
(for dynamic signs) and number
for the number
font.
font-family
is a symbol indicating the general class of the typeface. Supported are
roman
(Computer Modern), sans
, and typewriter
.
font-shape
is a symbol indicating the shape of the font, there are typically
several font shapes available for each font family. Choices are
italic
, caps
, and upright
.
font-series
is a symbol indicating the series of the font. There are typically several
font series for each font family and shape. Choices are medium
and bold
.
Fonts selected in the way sketched above come from a predefined style sheet.
The font used for printing a object can be selected by setting
font-name
, e.g.
\override Staff.TimeSignature #'font-name = #"cmr17"
Any font can be used, as long as it is available to TeX. Possible
fonts include foreign fonts or fonts that do not belong to the
Computer Modern font family. The size of fonts selected in this way
can be changed with the font-magnification
property. For
example, 2.0
blows up all letters by a factor 2 in both
directions.
Init files: ly/declarations-init.ly contains hints how new fonts may be added to LilyPond.
No style sheet is provided for other fonts besides the TeX Computer Modern family.
LilyPond has an internal mechanism to typeset texts. You can access it
with the keyword \markup
. Within markup mode, you can enter texts
similar to lyrics: simply enter them, surrounded by spaces:
c1^\markup { hello } c1_\markup { hi there } c1^\markup { hi \bold there, is \italic anyone home? }
The markup in the example demonstrates font switching commands. The
command \bold
and \italic
apply to the first following
word only; enclose a set of texts with braces to apply a command
to more words:
\markup { \bold { hi there } }
For clarity, you can also do this for single arguments, e.g.
\markup { is \italic { anyone } home }
In markup mode you can compose expressions, similar to mathematical
expressions, XML documents, and music expressions. The braces group
notes into horizontal lines. Other types of lists also exist: you can
stack expressions grouped with <
and >
vertically with
the command \column
. Similarly, \center-align
aligns
texts by their center lines:
c1^\markup { \column < a bbbb c > } c1^\markup { \center-align < a bbbb c > } c1^\markup { \line < a b c > }
Markups can be stored in variables, and these variables may be attached to notes, like
allegro = \markup { \bold \large { Allegro } } \notes { a^\allegro b c d }
Some objects have alignment procedures of their own, which cancel out
any effects of alignments applied to their markup arguments as a
whole. For example, the RehearsalMark is horizontally
centered, so using \mark \markup { \left-align .. }
has no
effect.
Similarly, for moving whole texts over notes with
\raise
, use the following trick:
"" \raise #0.5 raised
The text raised
is now raised relative to the empty string
""
which is not visible. Alternatively, complete objects can
be moved with layout properties such as padding
and
extra-offset
.
Init files: scm/new-markup.scm.
Text layout is ultimately done by TeX, which does kerning of letters. LilyPond does not account for kerning, so texts will be spaced slightly too wide.
Syntax errors for markup mode are confusing.
Markup texts cannot be used in the titling of the \header
field. Titles are made by LaTeX, so LaTeX commands should be used
for formatting.
\bigger
arg (markup)\bold
arg (markup)\box
arg (markup)\bracket
arg (markup)\bracketed-y-column
indices (list) args (list of markups)\caps
arg (markup)caps
.
\center-align
args (list of markups)args
in a centered column.
\char
num (integer)\char #65
produces the
letter 'A'.
\column
args (list of markups)\combine
m1 (markup) m2 (markup)\dir-column
args (list of markups)#'direction
layout property.
\doubleflat
\doublesharp
\dynamic
arg (markup)\fill-line
markups (list of markups)\finger
arg (markup)\flat
\fontsize
mag (number) arg (markup)A \fontsize #2 { B C } D
This will enlarge the B and the C by two steps.
\fraction
arg1 (markup) arg2 (markup)\general-align
axis (integer) dir (number) arg (markup)\halign
dir (number) arg (markup)\hbracket
arg (markup)\hspace
amount (number)\markup { A \hspace #2.0 B }
will put extra space between A and B, on top of the space that is
normally inserted before elements on a line.
\huge
arg (markup)\italic
arg (markup)font-shape
for arg.
\large
arg (markup)\latin-i
arg (markup)\left-align
arg (markup)\line
args (list of markups)word-space
determines the space between each markup in args.
\lookup
glyph-name (string)\magnify
sz (number) arg (markup)A \magnify #1.1 { A } A
Note: magnification only works if a font-name is explicitly selected.
Use \fontsize
otherwise.
\markletter
num (integer)\musicglyph
glyph-name (string)\musicglyph
#"accidentals-0"
will select the natural sign from the music font.
See The Feta font for a complete listing of the possible glyphs.
\natural
\normal-size-sub
arg (markup)\normal-size-super
arg (markup)\normalsize
arg (markup)\note-by-number
log (number) dot-count (number) dir (number)\note
duration (string) dir (number)\note #"4." #-0.75
creates a dotted quarter note, with
a shortened down stem.
\number
arg (markup)number
, which yields the font used for
time signatures and fingerings. This font only contains numbers and
some punctuation. It doesn't have any letters.
\override
new-prop (pair) arg (markup)\override #'(font-family . married) "bla"
\raise
amount (number) arg (markup)c1^\markup { C \small \raise #1.0 \bold { "9/7+" }}
The argument to \raise
is the vertical displacement amount,
measured in (global) staff spaces. \raise
and \super
raise objects in relation to their surrounding markups.
If the text object itself is positioned above or below the staff, then
\raise
cannot be used to move it, since the mechanism that
positions it next to the staff cancels any shift made with
\raise
. For vertical positioning, use the padding
and/or extra-offset
properties.
\right-align
arg (markup)\roman
arg (markup)roman
.
\sans
arg (markup)\semiflat
\semisharp
\sesquiflat
\sesquisharp
\sharp
\simple
str (string)\markup { foo }
is equivalent with
\markup { \simple #"foo" }
.
\small
arg (markup)\smaller
arg (markup)\strut
FIXME: is this working?
\sub
arg (markup)\super
arg (markup)Raising and lowering texts can be done with \super
and
\sub
:
c1^\markup { E "=" mc \super "2" }
\teeny
arg (markup)\tiny
arg (markup)\translate
offset (pair of numbers) arg (markup)A \translate #(cons 2 -3) { B C } D
This moves `B C' 2 spaces to the right, and 3 down, relative to its
surroundings. This command cannot be used to move isolated scripts
vertically, for the same reason that \raise
cannot be used for
that.
.
\typewriter
arg (markup)font-family
typewriter for arg.
\upright
arg (markup)upright
.
\vcenter
arg (markup)arg
to its center.
\word
str (string)The global layout determined by three factors: the page layout, the line breaks, and the spacing. These all influence each other. The choice of spacing determines how densely each system of music is set, which influences where line breaks are chosen, and thus ultimately how many pages a piece of music takes. This section explains how to tune the algorithm for spacing.
Globally spoken, this procedure happens in three steps: first, flexible distances (“springs”) are chosen, based on durations. All possible line breaking combination are tried, and the one with the best results — a layout that has uniform density and requires as little stretching or cramping as possible — is chosen. When the score is processed by TeX, each page is filled with systems, and page breaks are chosen whenever the page gets full.
The Feta font provides musical symbols at eight different sizes. Each font is tuned for a different staff size: at a smaller size the font becomes heavier, to match the relatively heavier staff lines. The recommended font sizes are listed in the following table:
font name | staff height (pt) | staff height (mm) | use
|
feta11 | 11.22 | 3.9 | pocket scores
|
feta13 | 12.60 | 4.4 |
|
feta14 | 14.14 | 5.0 |
|
feta16 | 15.87 | 5.6 |
|
feta18 | 17.82 | 6.3 | song books
|
feta20 | 17.82 | 7.0 | standard parts
|
feta23 | 22.45 | 7.9 |
|
feta26 | 25.2 | 8.9 |
|
These fonts are available in any sizes. The context property
fontSize
and the layout property staff-space
(in
StaffSymbol) can be used to tune size for individual
staves. The size of individual staves are relative to the global size,
which can be set in the following manner:
#(set-global-staff-size 14)
This sets the global default size to 14pt staff height, and scales all fonts accordingly.
This manual: Selecting font sizes.
The height of each system is determined automatically by LilyPond, to keep systems from bumping into each other, some minimum distances are set. By changing these, you can put staves closer together, and thus put more systems onto one page.
Normally staves are stacked vertically. To make
staves maintain a distance, their vertical size is padded. This is
done with the property minimumVerticalExtent
. It takes a pair
of numbers, so if you want to make it smaller from its, then you could
set
\set Staff.minimumVerticalExtent = #'(-4 . 4)
This sets the vertical size of the current staff to 4 staff spaces on
either side of the center staff line. The argument of
minimumVerticalExtent
is interpreted as an interval, where the
center line is the 0, so the first number is generally negative. The
staff can be made larger at the bottom by setting it to (-6
. 4)
.
The piano staves are handled a little differently: to make cross-staff
beaming work correctly, it is necessary that the distance between staves
is fixed beforehand. This is also done with a
VerticalAlignment object, created in
PianoStaff. In this object the distance between the
staves is fixed by setting forced-distance
. If you want to
override this, use a \context
block as follows:
\paper { \context { \PianoStaffContext \override VerticalAlignment #'forced-distance = #9 } ... }
This would bring the staves together at a distance of 9 staff spaces, measured from the center line of each staff.
Internals: Vertical alignment of staves is handled by the VerticalAlignment object.
The spacing engine translates differences in durations into
stretchable distances (“springs”) of differing lengths. Longer
durations get more space, shorter durations get less. The shortest
durations get a fixed amount of space (which is controlled by
shortest-duration-space
in the SpacingSpanner object).
The longer the duration, the more space it gets: doubling a
duration adds a fixed amount (this amount is controlled by
spacing-increment
) of space to the note.
For example, the following piece contains lots of half, quarter, and 8th notes, the eighth note is followed by 1 note head width (NHW). The quarter note is followed by 2 NHW, the half by 3 NHW, etc.
c2 c4. c8 c4. c8 c4. c8 c8 c8 c4 c4 c4
Normally, spacing-increment
is set to 1.2, which is the
width of a note head, and shortest-duration-space
is set to
2.0, meaning that the shortest note gets 2 NHW
of space. For normal notes, this space
is always counted from the left edge of the symbol, so the shortest
notes are generally followed by one NHW of space.
If one would follow the above procedure exactly, then adding a single 32th note to a score that uses 8th and 16th notes, would widen up the entire score a lot. The shortest note is no longer a 16th, but a 32nd, thus adding 1 NHW to every note. To prevent this, the shortest duration for spacing is not the shortest note in the score, but the most commonly found shortest note. Notes that are even shorter this are followed by a space that is proportional to their duration relative to the common shortest note. So if we were to add only a few 16th notes to the example above, they would be followed by half a NHW:
c2 c4. c8 c4. c16[ c] c4. c8 c8 c8 c4 c4 c4
The most common shortest duration is determined as follows: in every
measure, the shortest duration is determined. The most common short
duration, is taken as the basis for the spacing, with the stipulation
that this shortest duration should always be equal to or shorter than
1/8th note. The shortest duration is printed when you run lilypond
with --verbose
. These durations may also be customized. If you
set the common-shortest-duration
in
SpacingSpanner, then this sets the base duration for
spacing. The maximum duration for this base (normally 1/8th), is set
through base-shortest-duration
.
In the Introduction it was explained that stem directions influence
spacing. This is controlled with stem-spacing-correction
property in NoteSpacing, which are generated for every
Voice context. The StaffSpacing
object
(generated at Staff context) contains the same property
for controlling the stem/bar line spacing. The following example
shows these corrections, once with default settings, and once with
exaggerated corrections:
Properties of the SpacingSpanner must be overridden
from the \paper
block, since the SpacingSpanner is
created before any property commands are interpreted.
\paper { \context { \ScoreContext \override SpacingSpanner #'spacing-increment = #3.0 } }
Internals: SpacingSpanner, NoteSpacing, StaffSpacing, SeparationItem, and SeparatingGroupSpanner.
Spacing is determined on a score wide basis. If you have a score that changes its character (measured in durations) halfway during the score, the part containing the longer durations will be spaced too widely.
There is no convenient mechanism to manually override spacing.
Line breaks are normally computed automatically. They are chosen such that lines look neither cramped nor loose, and that consecutive lines have similar density.
Occasionally you might want to override the automatic breaks; you can
do this by specifying \break
. This will force a line break at
this point. Line breaks can only occur at places where there are bar
lines. If you want to have a line break where there is no bar line,
you can force an invisible bar line by entering \bar
""
. Similarly, \noBreak
forbids a line break at a
point.
For line breaks at regular intervals use \break
separated by
skips and repeated with \repeat
:
<< \repeat unfold 7 { s1 \noBreak s1 \noBreak s1 \noBreak s1 \break } the real music >>
This makes the following 28 measures (assuming 4/4 time) be broken every 4 measures, and only there.
Internals: BreakEvent.
The most basic settings influencing the spacing are indent
and
linewidth
. They are set in the \paper
block. They
control the indentation of the first line of music, and the lengths of
the lines.
If raggedright
is set to true in the \paper
block, then the lines are justified at their natural length. This
useful for short fragments, and for checking how tight the natural
spacing is.
The option raggedlast
is similar to raggedright
, but
only affects the last line of the piece. No restrictions are put on
that line. The result is similar to formatting paragraphs. In a
paragraph, the last line simply takes its natural length.
The page layout process happens outside the LilyPond formatting
engine: variables controlling page layout are passed to the output,
and are further interpreted by lilypond
wrapper program. It
responds to the following variables in the \paper
block. The
spacing between systems is controlled with interscoreline
, its
default is 16pt. The distance between the score lines will stretch in
order to fill the full page interscorelinefill
is set to a
positive number. In that case interscoreline
specifies the
minimum spacing.
If the variable lastpagefill
is defined,
systems are evenly distributed vertically on the last page. This
might produce ugly results in case there are not enough systems on the
last page. The lilypond-book command ignores
lastpagefill
. See lilypond-book manual for more
information.
Page breaks are normally computed by TeX, so they are not under
direct control of LilyPond. However, you can insert commands into
the .tex output to instruct TeX where to break pages. This
is done by setting the between-systems-strings
on the
NonMusicalPaperColumn where the system is broken.
An example is shown in input/regression/between-systems.ly.
The predefined command \newpage
also does this.
To change the paper size, there are two commands,
#(set-default-paper-size "a4") \paper{ #(set-paper-size "a4") }
The second one sets the size of the \paper
block that it's in.
In this manual: Invoking lilypond.
Examples: input/regression/between-systems.ly.
Internals: NonMusicalPaperColumn.
LilyPond has no concept of page layout, which makes it difficult to reliably choose page breaks in longer pieces.
The default output format is LaTeX, which should be run through LaTeX. Using the option -f (or --format) other output formats can be selected also, but none of them work reliably.
Now the music is output system by system (a `system' is a single line
from the score, consisting of staves belonging together). From
TeX's point of view, a system is an \hbox
which contains a
lowered \vbox
so that it is centered vertically on the baseline
of the text. Between systems, \interscoreline
is inserted
vertically to have stretchable space. The horizontal dimension of the
\hbox
is given by the linewidth
parameter from
LilyPond's \paper
block.
After the last system LilyPond emits a stronger variant of
\interscoreline
only if the macro
\lilypondpaperlastpagefill
is not defined (flushing the systems
to the top of the page). You can avoid that by setting the variable
lastpagefill
in LilyPond's \paper
block.
It is possible to fine-tune the vertical offset further by defining the
macro \lilypondscoreshift
:
\def\lilypondscoreshift{0.25\baselineskip}
where \baselineskip
is the distance from one text line to the next.
Here an example how to embed a small LilyPond file foo.ly
into
running LaTeX text without using the lilypond-book
script
(see lilypond-book manual):
\documentclass{article} \def\lilypondpaperlastpagefill{} \lineskip 5pt \def\lilypondscoreshift{0.25\baselineskip} \begin{document} This is running text which includes an example music file \input{foo.tex} right here. \end{document}
The file foo.tex has been simply produced with
lilypond-bin foo.ly
The call to \lineskip
assures that there is enough vertical space
between the LilyPond box and the surrounding text lines.
This chapter details the technicalities of running LilyPond.
Nicely titled output is created through a separate program:
lilypond
is a script that uses the LilyPond formatting
engine (which is in a separate program) and LaTeX to create a
nicely titled piece of sheet music, in PDF (Portable Document Format)
format.
lilypond
[option]... file...
To have lilypond
read from stdin, use a dash -
for
file. The program supports the following options.
-k,--keep
lilypond.dir
.
-d,--dependencies
Makefile
dependencies for every input file.
-h,--help
-I,--include=
dir-m,--no-paper
--no-lily
lilypond
.
-o,--output=
file--no-pdf
--png
--psgz
--html
--preview
-s,--set=
key=
vallanguage
, latexheaders
,
latexpackages
, latexoptions
, papersize
,
pagenumber
, linewidth
, orientation
,
textheight
.
-v,--version
-V,--verbose
--debug
-w,--warranty
lilypond
extracts the following header fields from the LY files
to generate titling; an example demonstrating all these fields is in
input/test/lilypond-testpage.ly:
title
subtitle
poet
composer
meter
opus
arranger
instrument
dedication
piece
head
header
, because \header
is a reserved word in LilyPond.
copyright
footer
tagline
The lilypond
program responds to several parameters specified
in a \paper
section of the input file. They can be overridden
by supplying a --set
command line option.
language
babel
package will be
included. Default: unset.
Read from the \header
block.
latexheaders
Normally read from the \header
block. Default value: empty.
latexpackages
-s=latexpackages
options.
Normally read from the \header
block. Default value:
geometry
.
latexoptions
\documentclass
. You can put any valid value here. This was
designed to allow lilypond
to produce output for double-sided
paper, with balanced margins and page numbers on alternating sides. To
achieve this specify twoside
.
orientation
portrait
or landscape
. Is
read from the \paper
block, if set.
textheight
linewidth
\paper
block.
papersize
a4
). It is normally read from
the \paper
block.
pagenumber
no
, no page numbers will be printed. If set to a
positive integer, start with this value as the first page number.
fontenc
font-encoding
property in the score.
The formatting system consists of two parts: a binary executable
(lilypond-bin), which is responsible for the formatting
functionality, and support scripts, which post-process the resulting
output. Normally, the support scripts are called, which in turn invoke
the lilypond-bin
binary. However, lilypond-bin
may be
called directly as follows.
lilypond-bin [option]... file...
When invoked with a filename that has no extension, the .ly
extension is tried first. To read input from stdin, use a
dash -
for file.
When filename.ly is processed it will produce
filename.tex as output (or filename.ps for PostScript
output). If filename.ly contains more than one \score
block, then the rest of the scores will be output in numbered files,
starting with filename-1.tex. Several files can be specified;
they will each be processed independently. 13
We strongly advise against making LilyPond formatting available through a web server. That is, processing input from untrusted users, and returning the resulting PDF file. LilyPond is a big and complex program. It was not written with security in mind. Making it available to the outside world is a huge risk; consider the security implications of
#(system "rm -rf /") \score { c4^#(ly:export (ly:gulp-file "/etc/passwd")) }
The following options are supported:
-e,--evaluate=
expr-e
options may be given, they will be evaluated
sequentially. The function ly:set-option
allows for access to
some internal variables. Use -e '(ly:option-usage)'
for more
information.
-f,--format=
formattex
(for TeX
output, to be processed with plain TeX, or through lilypond
),
pdftex
for PDFTeX input, ps
(for PostScript),
scm
(for a Scheme dump), sk
(for Sketch) and as
(for ASCII-art).
This option is only for developers. Only the TeX output of these is usable for real work.
-h,--help
--include, -I=
directory-i,--init=
file-m,--no-paper
\midi
definition MIDI output
will be generated.
-M,--dependencies
-o,--output=
FILE-v,--version
-V,--verbose
-w,--warranty
For processing both the TeX and the PostScript output, the appropriate environment variables must be set. The following scripts do this:
They should normally be sourced as part of the login process. If these scripts are not run from the system wide login process, then you must run it yourself.
If you use sh, bash, or a similar shell, then add the following to your .profile:
. /the/path/to/lilypond-profile
If you use csh, tcsh or a similar shell, then add the following to your ~/.login:
source /the/path/to/lilypond-login
Of course, in both cases, you should substitute the proper location of either script.
These scripts set the following variables:
TEXMF
TEXMF
to point to the lilypond data
file tree. A typical setting would be
{/usr/share/lilypond/1.6.0,{!!/usr/share/texmf}}
GS_LIB
-f ps
) with Ghostscript you have to set GS_LIB
to
point to the directory containing library PS files.
GS_FONTPATH
-f ps
) with Ghostscript you have to set GS_FONTPATH
to
point to the directory containing PFA files.
When you print direct PS output, remember to send the PFA files to the printer as well.
The binary itself recognizes the following environment variables:
LILYPONDPREFIX
LANG
Different error messages can appear while compiling a file:
-V
or
--verbose
) then a call trace is printed of the offending
function call.
If warnings and errors can be linked to some part of the input file, then error messages have the following form
filename:lineno:columnno: message offending input line
A line-break is inserted in offending line to indicate the column where the error was found. For example,
test.ly:2:19: error: not a duration: 5: \notes { c'4 e'5 g' }
If you have input that results in a crash or an erroneous output, then that is a bug. We try respond to bug-reports promptly, and fix them as soon as possible. For this, we need to reproduce and isolate the problem. Help us by sending a defective input file, so we can reproduce the problem. Make it small, so we can easily debug the problem. Don't forget to tell which version you use, and on which platform you run it. Send the report to bug-lilypond@gnu.org.
There is support from different editors for LilyPond.
For both editors, there is also a facility to jump in the input file
to the source of errors in the graphical output. See Point and click.
Point and click lets you find notes in the input by clicking on them in the Xdvi window. This makes it easier to find input that causes some error in the sheet music.
To use it, you need the following software:
Most TeX distributions ship with xdvik, which is always a few
versions behind the official Xdvi. To find out which Xdvi you are
running, try xdvi -version
or xdvi.bin -version
.
Apparently, KDVI does not process PostScript specials correctly. Beams and slurs will not be visible in KDVI.
Xdvi must be configured to find the TeX fonts and music fonts. Refer to the Xdvi documentation for more information.
To use point-and-click, add one of these lines to the top of your .ly file:
#(ly:set-point-and-click 'line)
When viewing, Control-Mousebutton 1 will take you to the originating spot in the .ly file. Control-Mousebutton 2 will show all clickable boxes.
If you correct large files with point-and-click, be sure to start correcting at the end of the file. When you start at the top, and insert one line, all following locations will be off by a line.
For using point-and-click with Emacs, add the following In your Emacs startup file (usually ~/.emacs):
(server-start)
Make sure that the environment variable XEDITOR is set to
emacsclient --no-wait +%l %f
If you use XEmacs instead of Emacs, you use (gnuserve-start)
in
your .emacs, and set XEDITOR
to gnuclient -q +%l %f
.
For using Vim, set XEDITOR
to gvim --remote +%l %f
, or
use this argument with Xdvi's -editor
option.
For using NEdit, set XEDITOR
to nc -noask +%l %f
, or
use this argument with Xdvi's -editor
option.
If can also make your editor jump to the exact location of the note
you clicked. This is only supported on Emacs and VIM. Users of Emacs version
20 must apply the patch emacsclient.patch. Users of version 21
must apply server.el.patch (version 21.2 and earlier). At the
top of the ly
file, replace the set-point-and-click
line
with the following line:
#(ly:set-point-and-click 'line-column)
and set XEDITOR
to emacsclient --no-wait +%l:%c %f
. Vim
users can set XEDITOR to gvim --remote +:%l:norm%c| %f
.
If you want to add pictures of music to a document, you can simply do it the way you would do with other types of pictures. The pictures are created separately, yielding PostScript pictures or PNG images, and those are included into a LaTeX or HTML document.
lilypond-book provides a way to automate this process: this program extracts snippets of music from your document, runs LilyPond on them, and outputs the document with pictures substituted for the music. The line width and font size definitions for the music are adjusted to match the layout of your document.
This procedure may be applied to LaTeX, html
or Texinfo
documents. A tutorial on using lilypond-book is in Integrating text and music. For more information about LaTeX
The not so Short Introduction to LaTeX provides a introduction to using LaTeX.
Music is specified like this:
@lilypond[options,go,here] YOUR LILYPOND CODE @end lilypond @lilypond[options,go,here]{ YOUR LILYPOND CODE } @lilypondfile[options,go,here]{filename}
When lilypond-book is run on it, this results in a texinfo file. We show two simple examples here. First a complete block:
@lilypond[staffsize=26] c' d' e' f' g'2 g' @end lilypond
produces
Then the short version:
@lilypond[staffsize=11]{<c' e' g'>}
produces
When producing texinfo, lilypond-book also generates bitmaps of the music, so you can make a HTML document with embedded music.
For LaTeX, music is entered using
\begin[options,go,here]{lilypond} YOUR LILYPOND CODE \end{lilypond}
\lilypondfile[options,go,here]{filename}
or
\lilypond{ YOUR LILYPOND CODE }
Running lilypond-book yields a file that can be processed with LaTeX.
We show some examples here:
\begin[staffsize=26]{lilypond} c' d' e' f' g'2 g'2 \end{lilypond}
produces
Then the short version:
\lilypond[staffsize=11]{<c' e' g'>}
produces
The linewidth of the music will be adjust by examining the commands in
the document preamble, the part of the document before
\begin{document}
: lilypond-book sends these to
LaTeX to find out how wide the text is. The line width variable for
the music fragments are adjusted to the text width.
After \begin{document}
, the column changing commands
\onecolumn
, \twocolumn
commands
are also interpreted.
The titling from the \header
section of the fragments can be
imported by adding the following to the top of the LaTeX file:
\input titledefs.tex \def\preLilyPondExample{\def\mustmakelilypondtitle{}}
The music will be surrounded by \preLilyPondExample
and
\postLilyPondExample
, which are defined to be empty by default.
For printing the LaTeX document, you will need to use dvips. For producing PostScript with scalable fonts, add the following options to the dvips command line:
-Ppdf -u +lilypond.map
PDF can then be produced with ps2pdf
.
LilyPond does not use the LaTeX font handling scheme for lyrics and text
markups, so if you use characters in your lilypond-book
documents that are not included in the standard US-ASCII character set,
include \usepackage[latin1]{inputenc}
in the file
header but do not include \usepackage[[T1]{fontenc}
. Character
sets other than latin1 are not supported directly but may be handled by
explicitly specifying the font-name
property in LilyPond and
using the corresponding LaTeX packages. Please consult the mailing list
for more details.
Music is entered using
<lilypond relative=1 verbatim> \key c \minor r8 c16 b c8 g as c16 b c8 d | g,4 </lilypond>
of which lilypond-book will produce a HTML with appropriate image tags for the music fragments:
<lilypond relative=2 verbatim> \key c \minor r8 c16 b c8 g as c16 b c8 d | g,4 </lilypond>
For inline pictures, use <lilypond ... />
syntax, e.g.
Some music in <lilypond a b c/> a line of text.
A special feature not (yet) available in other output formats, is the
<lilypondfile>
tag, for example,
<lilypondfile>trip.ly</lilypondfile>
This runs trip.ly through lilypond
(see also
Invoking lilypond), and substitutes a preview image in the
output. The image links to a separate HTML file, so clicking it will
take the viewer to a menu, with links to images, midi and printouts.
The commands for lilypond-book have room to specify one or more of the following options:
verbatim
intertext
option; then
the actual music is displayed. This option does not work with
the short version of the music blocks:
@lilypond{ CONTENTS }
and \lilypond{ CONTENTS }
filename=
filenameprintfilename
option. The argument
should be unquoted.
staffsize=
htraggedright
raggedright = ##t
); this
works well for small music fragments.
linewidth=
size\
unitnotime
fragment
nofragment
indent=
size\
unitFor example
\begin[indent=5\cm,raggedright]{lilypond} ... \end{lilypond}
noindent
quote
texidoc
texidoc
field, if defined in the file. This is
only for Texinfo output.
In Texinfo, the music fragment is normally preceded by the
texidoc
field from the \header
. The LilyPond test
documents are composed from small .ly files in this way:
\header { texidoc = "this file demonstrates a single note" } \score { \notes { c'4 } }
relative, relative=
Nrelative, relative=
N1
is middle C.
Running lilypond-book generates lots of small files that LilyPond will process. To avoid all that garbage in the source directory use the --output command line option, and change to that directory before running LaTeX or makeinfo:
lilypond-book --output=out yourfile.lytex cd out && latex yourfile.tex
lilypond-book accepts the following command line options:
,
--format=formathtml
, latex
or
texi
(the default). lilypond-book figures this
out automatically.
The texi
document type produces a texinfo file with music
fragments in the DVI output only. For getting images in the HTML
version, the format
texi-html
must be used.
,
--filter=filterFor example:
lilypond-book --filter='convert-ly --from=2.0.0' my-book.tely
,
--include=dir,
--output=dir,
--process=COMMANDFor LaTeX input, the file to give to LaTeX has extension .latex. Texinfo input will be written to a file with extension .texi.
The LaTeX \includeonly{...}
command is ignored.
The Texinfo command pagesize
is not interpreted. Almost all
LaTeX commands that change margins and line widths are ignored.
Only the first \score
of a LilyPond block is processed.
The size of a music block is limited to 1.5 KB, due to technical
problems with the Python regular expression engine. For longer files,
use \lilypondfile
.
Music can be entered also by importing it from other formats. This chapter documents the tools included in the distribution to do so. There are other tools that produce LilyPond input, for example GUI sequencers and XML converters. Refer to the website for more details.
Convert-ly sequentially applies different conversions to upgrade a
LilyPond input file. It uses \version
statements in the file to
detect the old version number. For example, to upgrade all LilyPond
files in the current directory and its subdirectories, use
convert-ly -e --to=1.3.150 `find . -name '*.ly' -print`
The program is invoked as follows:
convert-ly [option]... file...
The following options can be given:
-e,--edit
--output
.
-f,--from=
from-patchlevel\version
strings in the file.
-o,--output=
file-n,--no-version
\version
indicator
to the output. Specifying this option suppresses this.
-s, --show-rules
--to=
to-patchlevel-h, --help
Not all language changes are handled. Only one output option can be specified.
Midi2ly translates a MIDI input file to a LilyPond source file.
MIDI (Music Instrument Digital Interface) is a standard for digital instruments: it specifies cabling, a serial protocol and a file format. The MIDI file format is a de facto standard format for exporting music from other programs, so this capability may come in useful when you want to import files from a program that has no converter for its native format.
Midi2ly will convert tracks into Staff and channels into Voice contexts. Relative mode is used for pitches, durations are only written when necessary.
It is possible to record a MIDI file using a digital keyboard, and then convert it to .ly. However, human players are not rhythmically exact enough to make a MIDI to LY conversion trivial. midi2ly tries to compensate for these timing errors, but is not very good at this. It is therefore not recommended to use midi2ly for human-generated midi files.
Hackers who know about signal processing are invited to write a more robust midi2ly. midi2ly is written in Python, using a module written in C to parse the MIDI files.
It is invoked as follows:
midi2ly [option]... midi-file
The following options are supported by midi2ly:
-a, --absolute-pitches
-d, --duration-quant=
DUR-e, --explicit-durations
-h,--help
-k, --key=
acc[:
minor]
-o, --output=
file-s, --start-quant=
DUR-t, --allow-tuplet=
DUR*
NUM/
DEN-V, --verbose
-v, --version
-w, --warranty
-x, --text-lyrics
ETF (Enigma Transport Format) is a format used by Coda Music Technology's Finale product. etf2ly will convert part of an ETF file to a ready-to-use LilyPond file.
It is invoked as follows:
etf2ly [option]... etf-file
The following options are supported by etf2ly:
-h,--help
-o,--output=FILE
-v,--version
The list of articulation scripts is incomplete. Empty measures confuse etf2ly. Sequences of grace notes are ended improperly sometimes.
ABC is a fairly simple ASCII based format. It is described at the ABC site:
http://www.gre.ac.uk/~c.walshaw/abc2mtex/abc.txt.abc2ly translates from ABC to LilyPond. It is invoked as follows:
abc2ly [option]... abc-file
The following options are supported by abc2ly:
-h,--help
-o,--output=
file-v,--version
There is a rudimentary facility for adding LilyPond code to the ABC source file. If you say:
%%LY voices \set autoBeaming = ##f
This will cause the text following the keyword “voices” to be inserted into the current voice of the LilyPond output file.
Similarly,
%%LY slyrics more words
will cause the text following the “slyrics” keyword to be inserted into the current line of lyrics.
The ABC standard is not very “standard”. For extended features (e.g. polyphonic music) different conventions exist.
Multiple tunes in one file cannot be converted.
ABC synchronizes words and notes at the beginning of a line; abc2ly does not.
abc2ly ignores the ABC beaming.
MuseData (see http://www.musedata.org/) is an electronic
library of classical music scores, comprising at the time of writing
about 800 composition dating from 1700 to 1825. The music is encoded
in so-called MuseData format. musedata2ly converts a set of MuseData
files to one .ly file, and will include a \header
field if a
.ref file is supplied. It is invoked as follows:
musedata2ly [option]... musedata-files
The following options are supported by musedata2ly:
-h,--help
-o,--output=
file-v,--version
-r,--ref=
reffile
musedata2ly converts only a small subset of MuseData.
Mup (Music Publisher) is a shareware music notation program by Arkkra Enterprises. Mup2ly will convert part of a Mup file to LilyPond format. It is invoked as follows:
mup2ly [option]... mup-file
The following options are supported by mup2ly:
-d,--debug
-D, --define=
name[=exp]
exp
-E,--pre-process
-h,--help
-o,--output=
file-v,--version
-w,--warranty
Only plain notes (pitches, durations), voices, and staves are converted.
#(set-accidental-style 'piano-cautionary)
: Accidentals'
: Pitches(begin * * * *)
: Setting automatic beam behavior(end * * * *)
: Setting automatic beam behavior,
: Pitches.
: Durations/
: Chords mode/+
: Chords mode?
: Chromatic alterations[
: Manual beams\"!
: Dynamics\<
: Dynamics\>
: Dynamics\aeolian
: Key signature\alternative
: Repeat syntax\arpeggio
: Arpeggio\arpeggioBoth
: Arpeggio\arpeggioBracket
: Arpeggio\arpeggioDown
: Arpeggio\arpeggioUp
: Arpeggio\ascendens
: Gregorian square neumes ligatures\auctum
: Gregorian square neumes ligatures\autoBeamOff
: Setting automatic beam behavior\autoBeamOn
: Setting automatic beam behavior\bar
: Bar lines\break
: Line breaking\cadenzaOff
: Unmetered music\cadenzaOn
: Unmetered music\caesura
: Divisiones\clef
: Clef\context
: Piano staves\deminutum
: Gregorian square neumes ligatures\descendens
: Gregorian square neumes ligatures\divisioMaior
: Divisiones\divisioMaxima
: Divisiones\divisioMinima
: Divisiones\dorian
: Key signature\dotsBoth
: Durations\dotsDown
: Durations\dotsUp
: Durations\dynamicBoth
: Dynamics\dynamicDown
: Dynamics\dynamicUp
: Dynamics\emptyText
: Text scripts\f
: Dynamics\fatText
: Text scripts\ff
: Dynamics\fff
: Dynamics\ffff
: Dynamics\finalis
: Divisiones\flexa
: Gregorian square neumes ligatures\fp
: Dynamics\germanChords
: Printing chord names\glissando
: Glissando\grace
: Grace notes\header
in LaTeX documents: Integrating LaTeX and music\hideNotes
: Pitches\hideStaffSwitch
: Staff switch lines\inclinatum
: Gregorian square neumes ligatures\ionian
: Key signature\key
: Key signature\locrian
: Key signature\lydian
: Key signature\lyrics
: Entering lyrics\lyricsto
: The Lyrics context\major
: Key signature\mark
: Rehearsal marks\melisma
: The Lyrics context\melismaEnd
: The Lyrics context\mf
: Dynamics\minor
: Key signature\mixolydian
: Key signature\mp
: Dynamics\newpage
: Page layout\noBreak
: Line breaking\normalsize
: Selecting font sizes\notes
: Relative octaves\oneVoice
: Polyphony\oriscus
: Gregorian square neumes ligatures\override
: Constructing a tweak\p
: Dynamics\partial
: Partial measures\pes
: Gregorian square neumes ligatures\phrasingSlurBoth
: Phrasing slurs\phrasingSlurDown
: Phrasing slurs\phrasingSlurUp
: Phrasing slurs\phrygian
: Key signature\pp
: Dynamics\ppp
: Dynamics\property
, in \lyrics
: Entering lyrics\quilisma
: Gregorian square neumes ligatures\relative
: Relative octaves\repeat
: Repeats\rfz
: Dynamics\scriptBoth
: Articulations\scriptDown
: Articulations\scriptUp
: Articulations\semiGermanChords
: Printing chord names\set
: Constructing a tweak\sf
: Dynamics\sff
: Dynamics\sfz
: Dynamics\shiftOff
: Polyphony\shiftOn
: Polyphony\shiftOnn
: Polyphony\shiftOnnn
: Polyphony\showStaffSwitch
: Staff switch lines\slurBoth
: Slurs\slurDotted
: Slurs\slurDown
: Slurs\slurSolid
: Slurs\slurUp
: Slurs\small
: Selecting font sizes\sp
: Dynamics\spp
: Dynamics\stemBoth
: Stems\stemDown
: Stems\stemUp
: Stems\stropha
: Gregorian square neumes ligatures\super
: Overview of text markup commands\tempo
: Metronome marks\tieBoth
: Ties\tieDotted
: Ties\tieDown
: Ties\tieSolid
: Ties\tieUp
: Ties\time
: Time signature\times
: Tuplets\tiny
: Selecting font sizes\transpose
: Transpose\tupletBoth
: Tuplets\tupletDown
: Tuplets\tupletUp
: Tuplets\unHideNotes
: Pitches\virga
: Gregorian square neumes ligatures\virgula
: Divisiones\voiceFour
: Polyphony\voiceOne
: Polyphony\voiceThree
: Polyphony\voiceTwo
: Polyphony]
: Manual beams_
: Entering lyricsallowBeamBreak
: Manual beamsaug
: Chords modeautoBeaming
: Setting automatic beam behaviorautoBeamSettings
: Setting automatic beam behaviorbarCheckSynchronize
: Bar checkbase-shortest-duration
: Horizontal spacingcommon-shortest-duration
: Horizontal spacingdim
: Chords modeextra-offset
: Common tweaksfollowVoice
: Staff switch linesfont-interface
: Font selectionfont-style
: Selecting font sizesindent
: Page layoutinterscoreline
: Page layoutinterscorelinefill
: Page layoutkeySignature
: Key signaturelastpagefill
: Page layoutlinewidth
: Page layoutm
: Chords modemaj
: Chords modemodern
style accidentals: Accidentalsmodern-cautionary
: Accidentalsmodern-voice
: Accidentalsmodern-voice-cautionary
: Accidentalsno-reset
accidental style: Accidentalspadding
: Common tweakspaper
file: Setting global staff sizepapersize
: Page layoutpiano
accidentals: AccidentalsR
: Multi measure restsr
: DurationsrepeatCommands
: Manual repeat commandss
: Durationsset-accidental-style
: Accidentalsspacing
: Horizontal spacingStaff.midiInstrument
: MIDI instrument namesstem-spacing-correction
: Horizontal spacingstemLeftBeamCount
: Manual beamsstemRightBeamCount
: Manual beamssus
: Chords modetexi
: lilypond-book manualtextheight
: Page layouttremoloFlags
: Tremolo subdivisionstupletNumberFormatFunction
: Tuplets|
: Partial measures|
: Bar check~
: Ties"acoustic grand" "contrabass" "lead 7 (fifths)" "bright acoustic" "tremolo strings" "lead 8 (bass+lead)" "electric grand" "pizzicato strings" "pad 1 (new age)" "honky-tonk" "orchestral strings" "pad 2 (warm)" "electric piano 1" "timpani" "pad 3 (polysynth)" "electric piano 2" "string ensemble 1" "pad 4 (choir)" "harpsichord" "string ensemble 2" "pad 5 (bowed)" "clav" "synthstrings 1" "pad 6 (metallic)" "celesta" "synthstrings 2" "pad 7 (halo)" "glockenspiel" "choir aahs" "pad 8 (sweep)" "music box" "voice oohs" "fx 1 (rain)" "vibraphone" "synth voice" "fx 2 (soundtrack)" "marimba" "orchestra hit" "fx 3 (crystal)" "xylophone" "trumpet" "fx 4 (atmosphere)" "tubular bells" "trombone" "fx 5 (brightness)" "dulcimer" "tuba" "fx 6 (goblins)" "drawbar organ" "muted trumpet" "fx 7 (echoes)" "percussive organ" "french horn" "fx 8 (sci-fi)" "rock organ" "brass appendixsection" "sitar" "church organ" "synthbrass 1" "banjo" "reed organ" "synthbrass 2" "shamisen" "accordion" "soprano sax" "koto" "harmonica" "alto sax" "kalimba" "concertina" "tenor sax" "bagpipe" "acoustic guitar (nylon)" "baritone sax" "fiddle" "acoustic guitar (steel)" "oboe" "shanai" "electric guitar (jazz)" "english horn" "tinkle bell" "electric guitar (clean)" "bassoon" "agogo" "electric guitar (muted)" "clarinet" "steel drums" "overdriven guitar" "piccolo" "woodblock" "distorted guitar" "flute" "taiko drum" "guitar harmonics" "recorder" "melodic tom" "acoustic bass" "pan flute" "synth drum" "electric bass (finger)" "blown bottle" "reverse cymbal" "electric bass (pick)" "shakuhachi" "guitar fret noise" "fretless bass" "whistle" "breath noise" "slap bass 1" "ocarina" "seashore" "slap bass 2" "lead 1 (square)" "bird tweet" "synth bass 1" "lead 2 (sawtooth)" "telephone ring" "synth bass 2" "lead 3 (calliope)" "helicopter" "violin" "lead 4 (chiff)" "applause" "viola" "lead 5 (charang)" "gunshot" "cello" "lead 6 (voice)"
The following symbols are available in the Feta font and may be
accessed directly using text markup such as g^\markup {
\musicglyph #"scripts-segno" }
, see Text markup.
aDueText
(string)alignBassFigureAccidentals
(boolean)allowBeamBreak
(boolean)associatedVoice
(string)Voice
that has the melody for this Lyrics
line.
autoAccidentals
(list)For determining when to print an accidental, several different rules are tried. The rule that gives the highest number of accidentals is used. Each rule consists of
-1
then the accidental is forget
immediately, and if laziness is #t
then the accidental
lasts forever.
autoBeamSettings
(list)autoBeaming
(boolean)autoCautionaries
(list)autoAccidentals
, but it controls cautionary accidentals rather than
normal ones. Both lists are tried, and the one giving the most accidentals
wins. In case of draw, a normal accidental is typeset.
automaticBars
(boolean)\bar
command. Unlike the \cadenza
keyword, measures
are still counted. Bar generation will resume according to that count
if this property is unset.
barAlways
(boolean)barCheckSynchronize
(boolean)measurePosition
when finding a barcheck.
barNumberVisibility
(procedure)bassFigureFormatFunction
(procedure)BassFigure
grob. It takes a
list of BassFigureEvent
s, a context, and the grob to format.
beatGrouping
(list)'(2
3)
.
beatLength
(moment)chordChanges
(boolean)chordNameExceptions
(list)chordNameExceptionsFull
(list)chordNameExceptionsPartial
(list)chordNameFunction
(procedure)chordNameSeparator
(markup)chordNoteNamer
(procedure)chordRootNamer
(procedure)clefGlyph
(string)clefOctavation
(integer)clefPosition
(number)connectArpeggios
(boolean)createKeyOnClefChange
(boolean)createSpacing
(boolean)crescendoSpanner
(symbol)crescendoText
(markup)currentBarNumber
(integer)decrescendoSpanner
(symbol)crescendoSpanner
.
decrescendoText
(markup)defaultBarType
(string)whichBar
for information on available bar types.
This variable is read by Timing_engraver at
Score level.
drumPitchTable
(hash table)drumStyleTable
(hash table)The layout style is a hash table, containing the drum-pitches (e.g. the
symbol hihat) as key, and a list (notehead-style
script vertical-position) as values.
explicitClefVisibility
(procedure)explicitKeySignatureVisibility
(procedure)extraNatural
(boolean)extraVerticalExtent
(pair of numbers)fingeringOrientations
(list)followVoice
(boolean)fontSize
(number)forceClef
(boolean)harmonicAccidentals
(boolean)highStringOne
(boolean)ignoreMelismata
(boolean)instr
(markup)instrument
instrument
(markup)instrument
property labels the staff in the first system, and
the instr
property labels following lines.
instrumentEqualizer
(procedure)instrumentTransposition
(pitch)\quote
s.
keyAccidentalOrder
(list)keySignature
(list)majorSevenSymbol
(markup)markFormatter
(procedure)measureLength
(moment)measurePosition
(moment)melismaBusyProperties
(list)#'(melismaBusy beamMelismaBusy)
, only manual melismata and
manual beams are considered. Possible values include
melismaBusy
, slurMelismaBusy
, tieMelismaBusy
, and
beamMelismaBusy
metronomeMarkFormatter
(procedure)middleCPosition
(number)clefPosition
and
clefGlyph
.
midiInstrument
(string)midiMaximumVolume
(number)midiMinimumVolume
.
midiMinimumVolume
(number)minimumFret
(number)minimumVerticalExtent
(pair of numbers)ottavation
(string)pedalSostenutoStrings
(list)pedalSustainStrings
.
pedalSostenutoStyle
(symbol)pedalSustainStyle
.
pedalSustainStrings
(list)pedalSustainStyle
(symbol)text
, bracket
or mixed
(both).
pedalUnaCordaStrings
(list)pedalSustainStrings
.
pedalUnaCordaStyle
(symbol)pedalSustainStyle
.
printKeyCancellation
(boolean)printOctaveNames
(boolean)recordEventSequence
(procedure)rehearsalMark
(integer)repeatCommands
(list)(volta .
x)
, where x is a string or #f
restNumberThreshold
(number)skipBars
(boolean)@lilypond[fragment,verbatim,center] r1 r1*3 R1*3 \\property Score.skipBars= ##t r1*3 R1*3 @end lilypond
skipTypesetting
(boolean)soloADue
(boolean)soloIIText
(string)soloText
(string)squashedPosition
(integer)stanza
(markup)stemLeftBeamCount
(integer)stemRightBeamCount
(integer)stemLeftBeamCount
.
stringOneTopmost
(boolean)stringTunings
(list)subdivideBeams
(boolean)systemStartDelimiter
(symbol)SystemStartBrace
,
SystemStartBracket
or SystemStartBar
.
tablatureFormat
(procedure)timeSignatureFraction
(pair of numbers)#'(4 . 4)
is a 4/4 time signature.
timing
(boolean)tonic
(pitch)tremoloFlags
(integer)tupletNumberFormatFunction
(procedure)tupletSpannerDuration
(moment)\times
expression that gave rise to it. By setting this
property, you can make brackets last shorter. Example
@lilypond[verbatim,fragment] context Voice \times 2/3 { property Voice.tupletSpannerDuration = #(ly:make-moment 1 4) c-[8 c c-] c-[ c c-] } @end lilypond
.
verticalAlignmentChildCallback
(procedure)verticalExtent
(pair of numbers)\set Staff.verticalExtent = #'(-5.0 . 5.0)
This does not work for Voice or any other context that doesn't form a
vertical group.
vocNam
(markup)vocalName
(markup)voltaOnThisStaff
(boolean)voltaSpannerDuration
(moment)\alternative
. This can be
used to shrink the length of brackets in the situation where one
alternative is very large.
whichBar
(string)Example:
\set Staff.whichBar = "|:"
This will create a start-repeat bar in this staff only. Valid values are described in bar-line-interface.
X-extent
(pair of numbers)X-extent-callback
(procedure)#f
, the object
is empty in the X direction. The procedure takes a grob and axis
argument, and returns a number-pair.
X-offset-callbacks
(list)Y-extent
(pair of numbers)X-extent
.
Y-extent-callback
(procedure)X-extent-callback
.
Y-offset-callbacks
(list)X-offset-callbacks
.
accidentals
(list)align-dir
(direction)-1
: left side,
0
: around center of width, 1
: right side.
arch-angle
(number)arch-height
(dimension, in staff space)arch-thick
(number)arch-width
(dimension, in staff space)arpeggio-direction
(direction)attachment
(pair)alongside-stem
,
stem
, head
or loose-end
.
attachment-offset
(pair)auto-knee-gap
(dimension, in staff space)avoid-note-head
(boolean)axes
(list)balloon-original-callback
(procedure)balloon-padding
(dimension, in staff space)balloon-text
(markup)balloon-text-offset
(pair of numbers)balloon-text-props
(list)bar-size
(dimension, in staff space)bar-size-procedure
(procedure)base-shortest-duration
(moment)baseline-skip
(dimension, in staff space)beam-thickness
(dimension, in staff space)beam-width
(dimension, in staff space)beamed-extreme-minimum-free-lengths
(list)beamed-lengths
(list)beamed-minimum-free-lengths
(list)beamed-stem-shorten
(list)beaming
(pair)beautiful
(number)before-line-breaking-callback
(procedure)between-cols
(pair)between-system-string
(string)bracket-flare
(pair of numbers)bracket-thick
(number)bracket-visibility
(boolean or symbol)'if-no-beam
will make it print only if there is no beam associated with this
tuplet bracket.
break-align-orders
(hash table)For example, clefs are put after key signatures by setting
\override Score.BreakAlignment #'break-align-orders = #(make-vector 3 '(span-bar breathing-sign staff-bar key clef time-signature))
break-align-symbol
(symbol)break-glyph-function
(procedure)break-visibility
(procedure)all-visible
, begin-of-line-visible
,
end-of-line-visible
, begin-of-line-invisible
,
end-of-line-invisible
, all-invisible
.
breakable
(boolean)c0-position
(integer)cautionary
(boolean)cautionary-style
(symbol)smaller
or
parentheses
.
collapse-height
(dimension, in staff space)common-shortest-duration
(moment)concaveness-gap
(dimension, in staff space)concaveness-threshold
(number)Concaveness is calculated as the sum of the vertical distances of
inner note heads that fall outside the interval of the two outer
note heads, to the vertically nearest outer note head, divided by the
square of the inner notes involved.
control-points
(list)damping
(integer)dash-fraction
(number)dash-period
(number)dashed
(number)dir-function
(procedure)beam-dir-majority
beam-dir-mean
beam-dir-median.
direction
(direction)dot-count
(integer)duration-log
(integer)edge-height
(pair)edge-text
(pair)enclose-bounds
(number)expand-limit
(integer)extra-X-extent
(pair of numbers)extra-Y-extent
(pair of numbers)extra-Y-extent
.
extra-offset
(pair of numbers)extremity-function
(procedure)extremity-offset-alist
(list)Format: alist (attachment stem-dir*dir slur-dir*dir) -> offset.
flag-count
(number)flag-style
(symbol)()
and
mensural
. Additionally, "no-flag"
switches off the
flag.
flag-width-function
(procedure)font-encoding
(symbol)music
, number
, text
,
math
, braces
, dynamic
font-family
(symbol)sans
, roman
font-magnification
(number)font-name
.
font-name
(string)font-family
, font-series
and font-shape
.
font-series
(symbol)medium
, bold
, bold-narrow
, etc.
font-shape
(symbol)upright
,
italic
, caps
.
font-size
(number)force-hshift
(number)forced-distance
(dimension, in staff space)fraction
(pair of numbers)french-beaming
(boolean)full-size-change
(boolean)gap
(dimension, in staff space)gap-count
(integer)glyph
(string)glyph-name
(string)glyph-name-procedure
(procedure)grace-space-factor
(number)spacing-increment
.
grow-direction
(direction)hair-thickness
(number)height
(dimension, in staff space)height-limit
(dimension, in staff space)horizontal-shift
(integer)kern
(dimension, in staff space)knee
(boolean)knee-spacing-correction
(number)layer
(number)ledger-line-thickness
(pair of numbers)left-padding
(dimension, in staff space)left-position
(number)length
(dimension, in staff space)lengths
(list)line-count
(integer)measure-count
(integer)measure-length
(moment)merge-differently-dotted
(boolean)merge-differently-headed
(boolean)minimum-X-extent
(pair of numbers)minimum-Y-extent
(pair of numbers)minimum-Y-extent
.
minimum-distance
(dimension, in staff space)minimum-length
(dimension, in staff space)spacing-procedure
property.
minimum-space
(dimension, in staff space)neutral-direction
(direction)neutral-position
(number)new-accidentals
(list)(
pitch
.
accidental)
pairs.
no-spacing-rods
(boolean)no-stem-extend
(boolean)non-default
(boolean)note-names
(hash table)number-visibility
(boolean or symbol)bracket-visibility
, but for the number.
old-accidentals
(list)(
pitch .
accidental)
pairs.
padding
(dimension, in staff space)penalty
(number)pitch-max
(pitch)pitch-min
(pitch)positions
(pair)(
left
.
right)
, where both left and right are in the
staff-space unit of the current staff.
print-function
(procedure)Stencil
object.
ratio
(number)height-limit
.
remove-first
(boolean)right-padding
(dimension, in staff space)right-position
(number)script-priority
(number)self-alignment-X
(number)self-alignment-Y
(number)self-alignment-X
but for
Y axis.
shorten-pair
(pair of numbers)shortest-duration-space
(dimension, in staff space)spacing-increment
as unit. See also
spacing-spanner-interface.
shortest-playing-duration
(moment)shortest-starter-duration
(moment)side-relative-direction
(direction)direction-source
with this to get the direction of this
object.
slope
(number)slope-limit
(number)space-alist
(list)(
break-align-symbol type
.
distance)
, where type can be the symbols
minimum-space
or extra-space
.
space-function
(procedure)spacing-increment
(number)spacing-procedure
(procedure)before-line-breaking-callback
.
stacking-dir
(direction)staff-padding
(dimension, in staff space)staff-position
(number)staff-space
(dimension, in staff space)staffline-clearance
(dimension, in staff space)stem-attachment-function
(procedure)stem-end-position
(number)stem-shorten
(list)stem-spacing-correction
(number)stroke-style
(string)style
(symbol)print-function
that is
reading this property.
text
(markup)thick-thickness
(number)linethickness
.
thickness
(number)linethickness
.
thin-kern
(number)threshold
(pair of numbers)transparent
(boolean)print-function
to #f
, but this retains the dimensions of
this grob, which means that grobs can be erased individually.
when
(moment)width
(dimension, in staff space)word-space
(dimension, in staff space)x-gap
(dimension, in staff space)y-free
(dimension, in staff space)y-offset
(dimension, in staff space)zigzag-length
(dimension, in staff space)zigzag-width
. A value of 1 gives 60-degree
zigzags.
zigzag-width
(dimension, in staff space)If you need to know more about music notation, here are some interesting titles to read. The source archive includes a more elaborate BibTeX bibliography of over 100 entries in Documentation/bibliography/. It is also available online from the website.
A tutorial introduction to playing Jazz on the piano. One of the first
chapters contains an overview of chords in common use for Jazz music.
A concise, alphabetically ordered list of typesetting and music
(notation) issues which covers most of the normal cases.
A standard work on music notation.
This book is about music engraving, i.e. professional typesetting.
It contains directions on stamping, use of pens and notational
conventions. The sections on reproduction technicalities and history
are also interesting.
This manual specifically focuses on preparing print for publication by
Schirmer. It discusses many details that are not in other, normal
notation books. It also gives a good idea of what is necessary to bring
printouts to publication quality.
This book describes music notation for modern serious music, but starts out with a thorough overview of existing traditional notation practices.
The input format supports the notion of variable: in the following
example, a music expression is assigned to a variable with the name
traLaLa
.
traLaLa = \notes { c'4 d'4 }
There is also a form of scoping: in the following example, the
\paper
block also contains a traLaLa
variable, which is
independent of the outer \traLaLa
.
traLaLa = \notes { c'4 d'4 } \paper { traLaLa = 1.0 }
In effect, each input file is a scope, and all \header
,
\midi
and \paper
blocks are scopes nested inside that
toplevel scope.
Both variables and scoping are implemented in the GUILE module system. An anonymous Scheme module is attached to each scope. An assignment of the form
traLaLa = \notes { c'4 d'4 }
is internally converted to a Scheme definition
(define traLaLa Scheme value of “\notes ...
”)
This means that input variables and Scheme variables may be freely
mixed. In the following example, a music fragment is stored in the
variable traLaLa
, and duplicated using Scheme. The result is
imported in a \score
by means of a second variable
twice
:
traLaLa = \notes { c'4 d'4 } #(define newLa (map ly:music-deep-copy (list traLaLa traLaLa))) #(define twice (make-sequential-music newLa)) \score { \twice }
In the above example, music expressions can be `exported' from the
input to the Scheme interpreter. The opposite is also possible. By
wrapping a Scheme value in the function ly:export
, a Scheme
value is interpreted as if it were entered in LilyPond syntax: instead
of defining \twice
, the example above could also have been
written as
... \score { #(ly:export (make-sequential-music newLa)) }
When a music expression is parsed, it is converted into a set of Scheme music objects. The defining property of a music object is that it takes up time. Time is a rational number that measures the length of a piece of music, in whole notes.
A music object has three kinds of types:
\simultaneous
leads to
a SimultaneousMusic. A list of all expressions
available is in the internals manual, under Music expressionsexpressions.
event
, but it is also a note-event
,
a rhythmic-event
and a melodic-event
.
All classes of music are listed in the internals manual, under Music classes.
Event
object, while
\grace
creates a Grace_music
object.
We expect that distinctions between different C++ types will disappear in the future.
The actual information of a music expression is stored in properties.
For example, a NoteEvent has pitch
and
duration
properties that store the pitch and duration of that
note. A list of all properties available is in the internals manual,
under Music properties.
A compound music expression is a music object that contains other
music objects in its properties. A list of objects can be stored in
the elements
property of a music object, or a single `child'
music object in the element
object. For example,
SequentialMusic has its children in elements
,
and GraceMusic has its single argument in
element
. The body of a repeat is in element
property of
RepeatedMusic, and the alternatives in elements
.
Music objects and their properties can be accessed and manipulated
directly, through the \apply
mechanism.
The syntax for \apply
is
\apply #func music
This means that the scheme function func is called with
music as its argument. The return value of func is the
result of the entire expression. func may read and write music
properties using the functions ly:music-property
and
ly:music-set-property!
.
An example is a function that reverses the order of elements in its argument:
#(define (rev-music-1 m) (ly:music-set-property! m 'elements (reverse (ly:music-property m 'elements))) m) \score { \notes \apply #rev-music-1 { c4 d4 } }
The use of such a function is very limited. The effect of this function is void when applied to an argument which is does not have multiple children. The following function application has no effect:
\apply #rev-music-1 \grace { c4 d4 }
In this case, \grace
is stored as GraceMusic, which has no
elements
, only a single element
. Every generally
applicable function for \apply
must – like music expressions
themselves – be recursive.
The following example is such a recursive function: It first extracts
the elements
of an expression, reverses them and puts them
back. Then it recurses, both on elements
and element
children.
#(define (reverse-music music) (let* ((elements (ly:music-property music 'elements)) (child (ly:music-property music 'element)) (reversed (reverse elements))) ; set children (ly:music-set-property! music 'elements reversed) ; recurse (if (ly:music? child) (reverse-music child)) (map reverse-music reversed) music))
A slightly more elaborate example is in input/test/reverse-music.ly.
Some of the input syntax is also implemented as recursive music functions. For example, the syntax for polyphony
<<a \\ b>>
is actually implemented as a recursive function that replaces the above by the internal equivalent of
<< \context Voice = "1" { \voiceOne a } \context Voice = "2" { \voiceTwo b } >>
Other applications of \apply
are writing out repeats
automatically (input/test/unfold-all-repeats.ly),
saving keystrokes (input/test/music-box.ly) and
exporting
LilyPond input to other formats (input/test/to-xml.ly)
scm/music-functions.scm, scm/music-types.scm, input/test/add-staccato.ly, input/test/unfold-all-repeats.ly, and input/test/music-box.ly.
The markup
macro builds markup expressions in Scheme while
providing a LilyPond-like syntax. For example,
(markup #:column (#:line (#:bold #:italic "hello" #:raise 0.4 "world") #:bigger #:line ("foo" "bar" "baz")))
is equivalent to:
\markup \column < { \bold \italic "hello" \raise #0.4 "world" } \bigger { foo bar baz } >
This example exposes the main translation rules between regular LilyPond markup syntax and scheme markup syntax, which are summed up is this table:
LilyPond | Scheme
|
\command | #:command
|
\variable | variable
|
{ ... } | #:line ( ... )
|
\center-align < ... > | #:center ( ... )
|
string | "string"
|
#scheme-arg | scheme-arg
|
Besides, the whole scheme language is accessible inside the
markup
macro: thus, one may use function calls inside
markup
in order to manipulate character strings for
instance. This proves useful when defining new markup commands (see
Markup command definition).
One can not feed the #:line
(resp #:center
,
#:column
) command with a variable or the result of a function
call. E.g.:
(markup #:line (fun-that-returns-markups))
is illegal. One should use the make-line-markup
(resp
make-center-markup
, make-column-markup
) function
instead:
(markup (make-line-markup (fun-that-returns-markups)))
New markup commands can be defined
with the def-markup-command
scheme macro.
(def-markup-command (command-name paper props arg1 arg2 ...) (arg1-type? arg2-type? ...) ..command body..)
The arguments signify
As a simple example, we show how to add a \smallcaps
command,
which selects TeX's small caps font. Normally, we could select the
small caps font as follows:
\markup { \override #'(font-shape . caps) Text-in-caps }
This selects the caps font by setting the font-shape
property to
#'caps
for interpreting Text-in-caps
.
To make the above available as \smallcaps
command, we have to
define a function using def-markup-command
. The command should
take a single argument, of markup type. Therefore, the start of the
definition should read
(def-markup-command (smallcaps paper props argument) (markup?)
What follows is the content of the command: we should interpret
the argument
as a markup, i.e.
(interpret-markup paper ... argument)
This interpretation should add '(font-shape . caps)
to the active
properties, so we substitute the following for the ... in the
above example:
(cons (list '(font-shape . caps) ) props)
The variable props
is a list of alists, and we prepend to it by
consing a list with the extra setting.
Suppose that we are typesetting a recitative in an opera, and
we would like to define a command that will show character names in a
custom manner. Names should be printed with small caps and translated a
bit to the left and top. We will define a \character
command
that takes into account the needed translation, and uses the newly
defined \smallcaps
command:
#(def-markup-command (character paper props name) (string?) "Print the character name in small caps, translated to the left and top. Syntax: \\character #\"name\"" (interpret-markup paper props (markup "" #:translate (cons -4 2) #:smallcaps name)))
There is one complication that needs explanation: texts above and below
the staff are moved vertically to be at a certain distance (the
padding
property) from the staff and the notes. To make sure
that this mechanism does not annihilate the vertical effect of our
#:translate
, we add an empty string (""
) before the
translated text. Now the ""
will be put above the notes, and the
name
is moved in relation to that empty string. The net effect is
that the text is moved to the upper left.
The final result is as follows:
\score { \notes { \fatText c''^\markup \character #"Cleopatra" e'^\markup \character #"Giulio Cesare" } }
We have used the caps
font shape, but suppose that our font
that does not have a small-caps variant. In that case, we have to fake
the small caps font, by setting a string in upcase, with the first
letter a little larger:
#(def-markup-command (smallcaps paper props str) (string?) "Print the string argument in small caps." (interpret-markup paper props (make-line-markup (map (lambda (s) (if (= (string-length s) 0) s (markup #:large (string-upcase (substring s 0 1)) #:translate (cons -0.6 0) #:tiny (string-upcase (substring s 1))))) (string-split str #\Space)))))
The smallcaps
command first splits its string argument into
tokens separated by spaces ((string-split str #\Space)
); for
each token, a markup is built with the first letter made large and
upcased (#:large (string-upcase (substring s 0 1))
), and a
second markup built with the following letters made tiny and upcased
(#:tiny (string-upcase (substring s 1))
). As LilyPond
introduces a space between markups on a line, the second markup is
translated to the left (#:translate (cons -0.6 0) ...
). Then,
the markups built for each token are put in a line by
(make-line-markup ...)
. Finally, the resulting markup is passed
to the interpret-markup
function, with the paper
and
props
arguments.
Contexts can be modified during interpretation with Scheme code. The syntax for this is
\applycontext function
function should be a Scheme function taking a single argument, being the context to apply it to. The following code will print the current bar number on the standard output during the compile:
\applycontext #(lambda (x) (format #t "\nWe were called in barnumber ~a.\n" (ly:context-property x 'currentBarNumber)))
The most versatile way of tuning an object is \applyoutput
. Its
syntax is
\applyoutput proc
where proc is a Scheme function, taking three arguments.
When interpreted, the function proc is called for every layout object found in the context, with the following arguments:
\applyoutput
is processed.
In addition, the cause of the layout object, i.e. the music
expression or object that was responsible for creating it, is in the
object property cause
. For example, for a note head, this is a
NoteHead event, and for a Stem object,
this is a NoteHead object.
Here is a function to use for \applyoutput
; it blanks
note-heads on the center-line:
(define (blanker grob grob-origin context) (if (and (memq (ly:grob-property grob 'interfaces) note-head-interface) (eq? (ly:grob-property grob 'staff-position) 0)) (set! (ly:grob-property grob 'transparent) #t)))
Syntax | Description | Example
|
1 2 8 16
| durations |
|
c4. c4..
| augmentation dots |
|
c d e f g a b
| scale |
|
fis bes
| alteration |
|
\clef treble \clef bass
| clefs |
|
\time 3/4 \time 4/4
| time signature |
|
r4 r8
| rest |
|
d ~ d
| tie |
|
\key es \major
| key signature |
|
note'
| raise octave |
|
note,
| lower octave |
|
c( d e)
| slur |
|
c\( c( d) e\)
| phrasing slur |
|
a8[ b]
| beam |
|
<< \new Staff ... >>
| more staves |
|
c-> c-.
| articulations |
|
c\mf c\sfz
| dynamics |
|
a\< b\!
| crescendo |
|
a\> b\!
| decrescendo |
|
< >
| chord |
|
\partial 8
| upstep |
|
\times 2/3 {f g a}
| triplets |
|
\grace
| grace notes |
|
\lyrics { twinkle }
| entering lyrics |
|
\new Lyrics
| printing lyrics |
twinkle
|
twin -- kle
| lyric hyphen |
|
\chords { c:dim f:maj7 }
| chords |
|
\context ChordNames
| printing chord names |
|
<<{e f} \\{c d}>>
| polyphony |
|
s4 s8 s16
| spacer rests |
|
Copyright © 2000 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
The purpose of this License is to make a manual, textbook, or other written document free in the sense of freedom: to assure everyone the effective freedom to copy and redistribute it, with or without modifying it, either commercially or noncommercially. Secondarily, this License preserves for the author and publisher a way to get credit for their work, while not being considered responsible for modifications made by others.
This License is a kind of “copyleft”, which means that derivative works of the document must themselves be free in the same sense. It complements the GNU General Public License, which is a copyleft license designed for free software.
We have designed this License in order to use it for manuals for free software, because free software needs free documentation: a free program should come with manuals providing the same freedoms that the software does. But this License is not limited to software manuals; it can be used for any textual work, regardless of subject matter or whether it is published as a printed book. We recommend this License principally for works whose purpose is instruction or reference.
This License applies to any manual or other work that contains a notice placed by the copyright holder saying it can be distributed under the terms of this License. The “Document”, below, refers to any such manual or work. Any member of the public is a licensee, and is addressed as “you”.
A “Modified Version” of the Document means any work containing the Document or a portion of it, either copied verbatim, or with modifications and/or translated into another language.
A “Secondary Section” is a named appendix or a front-matter section of the Document that deals exclusively with the relationship of the publishers or authors of the Document to the Document's overall subject (or to related matters) and contains nothing that could fall directly within that overall subject. (For example, if the Document is in part a textbook of mathematics, a Secondary Section may not explain any mathematics.) The relationship could be a matter of historical connection with the subject or with related matters, or of legal, commercial, philosophical, ethical or political position regarding them.
The “Invariant Sections” are certain Secondary Sections whose titles are designated, as being those of Invariant Sections, in the notice that says that the Document is released under this License.
The “Cover Texts” are certain short passages of text that are listed, as Front-Cover Texts or Back-Cover Texts, in the notice that says that the Document is released under this License.
A “Transparent” copy of the Document means a machine-readable copy, represented in a format whose specification is available to the general public, whose contents can be viewed and edited directly and straightforwardly with generic text editors or (for images composed of pixels) generic paint programs or (for drawings) some widely available drawing editor, and that is suitable for input to text formatters or for automatic translation to a variety of formats suitable for input to text formatters. A copy made in an otherwise Transparent file format whose markup has been designed to thwart or discourage subsequent modification by readers is not Transparent. A copy that is not “Transparent” is called “Opaque”.
Examples of suitable formats for Transparent copies include plain ascii without markup, Texinfo input format, LaTeX input format, SGML or XML using a publicly available DTD, and standard-conforming simple HTML designed for human modification. Opaque formats include PostScript, PDF, proprietary formats that can be read and edited only by proprietary word processors, SGML or XML for which the DTD and/or processing tools are not generally available, and the machine-generated HTML produced by some word processors for output purposes only.
The “Title Page” means, for a printed book, the title page itself, plus such following pages as are needed to hold, legibly, the material this License requires to appear in the title page. For works in formats which do not have any title page as such, “Title Page” means the text near the most prominent appearance of the work's title, preceding the beginning of the body of the text.
You may copy and distribute the Document in any medium, either commercially or noncommercially, provided that this License, the copyright notices, and the license notice saying this License applies to the Document are reproduced in all copies, and that you add no other conditions whatsoever to those of this License. You may not use technical measures to obstruct or control the reading or further copying of the copies you make or distribute. However, you may accept compensation in exchange for copies. If you distribute a large enough number of copies you must also follow the conditions in section 3.
You may also lend copies, under the same conditions stated above, and you may publicly display copies.
If you publish printed copies of the Document numbering more than 100, and the Document's license notice requires Cover Texts, you must enclose the copies in covers that carry, clearly and legibly, all these Cover Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on the back cover. Both covers must also clearly and legibly identify you as the publisher of these copies. The front cover must present the full title with all words of the title equally prominent and visible. You may add other material on the covers in addition. Copying with changes limited to the covers, as long as they preserve the title of the Document and satisfy these conditions, can be treated as verbatim copying in other respects.
If the required texts for either cover are too voluminous to fit legibly, you should put the first ones listed (as many as fit reasonably) on the actual cover, and continue the rest onto adjacent pages.
If you publish or distribute Opaque copies of the Document numbering more than 100, you must either include a machine-readable Transparent copy along with each Opaque copy, or state in or with each Opaque copy a publicly-accessible computer-network location containing a complete Transparent copy of the Document, free of added material, which the general network-using public has access to download anonymously at no charge using public-standard network protocols. If you use the latter option, you must take reasonably prudent steps, when you begin distribution of Opaque copies in quantity, to ensure that this Transparent copy will remain thus accessible at the stated location until at least one year after the last time you distribute an Opaque copy (directly or through your agents or retailers) of that edition to the public.
It is requested, but not required, that you contact the authors of the Document well before redistributing any large number of copies, to give them a chance to provide you with an updated version of the Document.
You may copy and distribute a Modified Version of the Document under the conditions of sections 2 and 3 above, provided that you release the Modified Version under precisely this License, with the Modified Version filling the role of the Document, thus licensing distribution and modification of the Modified Version to whoever possesses a copy of it. In addition, you must do these things in the Modified Version:
If the Modified Version includes new front-matter sections or appendices that qualify as Secondary Sections and contain no material copied from the Document, you may at your option designate some or all of these sections as invariant. To do this, add their titles to the list of Invariant Sections in the Modified Version's license notice. These titles must be distinct from any other section titles.
You may add a section entitled “Endorsements”, provided it contains nothing but endorsements of your Modified Version by various parties—for example, statements of peer review or that the text has been approved by an organization as the authoritative definition of a standard.
You may add a passage of up to five words as a Front-Cover Text, and a passage of up to 25 words as a Back-Cover Text, to the end of the list of Cover Texts in the Modified Version. Only one passage of Front-Cover Text and one of Back-Cover Text may be added by (or through arrangements made by) any one entity. If the Document already includes a cover text for the same cover, previously added by you or by arrangement made by the same entity you are acting on behalf of, you may not add another; but you may replace the old one, on explicit permission from the previous publisher that added the old one.
The author(s) and publisher(s) of the Document do not by this License give permission to use their names for publicity for or to assert or imply endorsement of any Modified Version.
You may combine the Document with other documents released under this License, under the terms defined in section 4 above for modified versions, provided that you include in the combination all of the Invariant Sections of all of the original documents, unmodified, and list them all as Invariant Sections of your combined work in its license notice.
The combined work need only contain one copy of this License, and multiple identical Invariant Sections may be replaced with a single copy. If there are multiple Invariant Sections with the same name but different contents, make the title of each such section unique by adding at the end of it, in parentheses, the name of the original author or publisher of that section if known, or else a unique number. Make the same adjustment to the section titles in the list of Invariant Sections in the license notice of the combined work.
In the combination, you must combine any sections entitled “History” in the various original documents, forming one section entitled “History”; likewise combine any sections entitled “Acknowledgments”, and any sections entitled “Dedications”. You must delete all sections entitled “Endorsements.”
You may make a collection consisting of the Document and other documents released under this License, and replace the individual copies of this License in the various documents with a single copy that is included in the collection, provided that you follow the rules of this License for verbatim copying of each of the documents in all other respects.
You may extract a single document from such a collection, and distribute it individually under this License, provided you insert a copy of this License into the extracted document, and follow this License in all other respects regarding verbatim copying of that document.
A compilation of the Document or its derivatives with other separate and independent documents or works, in or on a volume of a storage or distribution medium, does not as a whole count as a Modified Version of the Document, provided no compilation copyright is claimed for the compilation. Such a compilation is called an “aggregate”, and this License does not apply to the other self-contained works thus compiled with the Document, on account of their being thus compiled, if they are not themselves derivative works of the Document.
If the Cover Text requirement of section 3 is applicable to these copies of the Document, then if the Document is less than one quarter of the entire aggregate, the Document's Cover Texts may be placed on covers that surround only the Document within the aggregate. Otherwise they must appear on covers around the whole aggregate.
Translation is considered a kind of modification, so you may distribute translations of the Document under the terms of section 4. Replacing Invariant Sections with translations requires special permission from their copyright holders, but you may include translations of some or all Invariant Sections in addition to the original versions of these Invariant Sections. You may include a translation of this License provided that you also include the original English version of this License. In case of a disagreement between the translation and the original English version of this License, the original English version will prevail.
You may not copy, modify, sublicense, or distribute the Document except as expressly provided for under this License. Any other attempt to copy, modify, sublicense or distribute the Document is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.
The Free Software Foundation may publish new, revised versions of the GNU Free Documentation License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. See http://www.gnu.org/copyleft/.
Each version of the License is given a distinguishing version number. If the Document specifies that a particular numbered version of this License “or any later version” applies to it, you have the option of following the terms and conditions either of that specified version or of any later version that has been published (not as a draft) by the Free Software Foundation. If the Document does not specify a version number of this License, you may choose any version ever published (not as a draft) by the Free Software Foundation.
To use this License in a document you have written, include a copy of the License in the document and put the following copyright and license notices just after the title page:
Copyright (C) year your name. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with the Invariant Sections being list their titles, with the Front-Cover Texts being list, and with the Back-Cover Texts being list. A copy of the license is included in the section entitled ``GNU Free Documentation License''.
If you have no Invariant Sections, write “with no Invariant Sections” instead of saying which ones are invariant. If you have no Front-Cover Texts, write “no Front-Cover Texts” instead of “Front-Cover Texts being list”; likewise for Back-Cover Texts.
If your document contains nontrivial examples of program code, we recommend releasing these examples in parallel under your choice of free software license, such as the GNU General Public License, to permit their use in free software.
[1] If you are looking for something, and you cannot find it in the manual, that is considered a bug. In that case, please file a bug report.
[2] There are macro files for VIM addicts, and there
is a LilyPond-mode
for Emacs addicts. If it has not been
installed already, refer to
the file INSTALL.txt
[3] For TeX
aficionados: there is also a test.dvi file. It can be viewed
with xdvi
. The DVI uses a lot of PostScript specials, which do
not show up in the magnifying glass. The specials also mean that the
DVI file cannot be processed with dvilj
. Use dvips
for
printing.
[4] If your system does not have any tools installed, you can try http://www.cs.wisc.edu/~ghost/, a freely available package for viewing and printing PDF and PostScript files.
[5] Any simple or programmer-oriented editor will do, for example Notepad. Do not use a word processor, its formatting codes will confuse LilyPond
[6] This syntax derived from note naming conventions in Nordic and Germanic languages, like German and Dutch.
[7] Nicely printed parts are good PR for us, so please leave the tagline if you can.
[8] Notes constitute the most basic elements of LilyPond input,
but they do not form valid input on their own without a \score
block. However, for the sake of brevity and simplicity we will
generally omit \score
blocks and \paper
declarations in
this manual.
[9] Polyphonic voices are sometimes called "layers" other notation packages
[10] If you want to know more about Scheme, see http://www.schemers.org.
[11] In Scheme terminology, the pair is called cons
,
and its two elements are called car and cdr respectively.
[12] The opposite of \accepts
is \denies
,
which is sometimes when reusing existing context definitions.
[13] The status of GUILE is not reset across invocations, so be careful not to change any system defaults from within Scheme.
Read comments on this page, or
add one.
This page is for LilyPond-2.2.6 (stable-branch). |