Lily Pond
Lily Pond
Lily Pond
Table of Contents
Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.1 Engraving . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.2 Automated engraving . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.3 What symbols to engrave? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.4 Music representation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.5 Example applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.6 About this manual . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2 Tutorial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.1 First steps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.1.1 Compiling a file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.1.2 Simple notation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.1.3 Working on text files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
2.1.4 How to read the tutorial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
2.2 Single staff notation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
2.2.1 Relative note names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
2.2.2 Accidentals and key signatures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
2.2.3 Ties and slurs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
2.2.4 Articulation and dynamics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
2.2.5 Automatic and manual beams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
2.2.6 Advanced rhythmic commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
2.3 Multiple notes at once . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
2.3.1 Music expressions explained . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
2.3.2 Multiple staves . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
2.3.3 Piano staves . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
2.3.4 Single staff polyphony . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
2.3.5 Combining notes into chords . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
2.4 Songs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
2.4.1 Printing lyrics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
2.4.2 A lead sheet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
2.5 Final touches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
2.5.1 Version number . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
2.5.2 Adding titles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
2.5.3 Absolute note names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
2.5.4 Organizing pieces with identifiers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
2.5.5 After the tutorial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
2.5.6 How to read the manual . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
5 Tweaking output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
5.1 Moving objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
5.2 Fixing overlapping notation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
5.3 Common tweaks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
5.4 Default files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
5.5 Fitting music onto fewer pages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
5.6 Advanced tweaks with Scheme. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
5.7 Avoiding tweaks with slower processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
6 Basic notation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
6.1 Pitches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
6.1.1 Normal pitches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
6.1.2 Accidentals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
6.1.3 Cautionary accidentals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
6.1.4 Micro tones . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
6.1.5 Note names in other languages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
6.1.6 Relative octaves . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
6.1.7 Octave check . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
6.1.8 Transpose . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
6.1.9 Rests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
6.1.10 Skips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
6.2 Rhythms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
6.2.1 Durations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
6.2.2 Augmentation dots. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
6.2.3 Tuplets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
6.2.4 Scaling durations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
6.2.5 Bar check . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
6.2.6 Barnumber check . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
6.2.7 Automatic note splitting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
6.3 Polyphony . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
6.3.1 Chords . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
6.3.2 Stems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
6.3.3 Basic polyphony . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
6.3.4 Explicitly instantiating voices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
6.3.5 Collision Resolution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
6.4 Staff notation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
6.4.1 Clef . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
6.4.2 Key signature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
6.4.3 Time signature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
6.4.4 Partial measures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
6.4.5 Bar lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
6.4.6 Unmetered music . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
iii
Preface
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-Wens 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 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 who 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 a 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.
Chapter 1: Introduction 2
1 Introduction
1.1 Engraving
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 five years of training before earning
the title of master engraver, and another five years of experience were necessary to become truly
skilled.
Nowadays, all newly printed music is produced with computers. This has obvious advantages;
prints are cheaper to make, and 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 an edition published in 2000. The center depicts a symbol
from a hand-engraved Barenreiter 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 Barenreiter 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 lines in the computer edition.
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 poor
results. In the next example a motive is printed twice: once using exact mathematical spacing,
and once with corrections. Can you spot which fragment is which?
Chapter 1: Introduction 3
Each bar in the fragment only uses 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-stem/up-stem combination should be put closer together, all depending on
the combined vertical positions of the notes. The upper two measures are printed with this
correction, the lower two measures without, forming down-stem/up-stem clumps of notes.
Musicians are usually more absorbed with performing than with studying the looks of a piece
of music, so 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, and they become like a labyrinth. If a musician looks away once or has a lapse
in concentration, the lines might lose their place on the page.
Similarly, the strong visual look of bold symbols on heavy staff lines stands out better when
the music is far away from the 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 her task. For performance material like sheet
music, this is of double importance: musicians have a limited amount of attention. The less
attention they need for reading, the more they can focus on playing the music. In other words,
better typography translates to better performances.
These examples demonstrate that music typography is an art that is subtle and complex,
and that producing 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.
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 is a variable with a preset value. You are free to alter this
value, giving your score a different typographical impression.
Formatting rules are also preset variables: each object has variables containing procedures.
These procedures perform the actual formatting, and by substituting different ones, we can
change the appearance of objects. In the following example, the rule which note head objects
are used to produce their symbol is changed during the music fragment.
42 c2 2 c
m bla c
G
F
D m
the innovations of contemporary notation. Hence, it encompasses some 500 years of music. Its
applications range from monophonic melodies to monstrous counterpoints for large orchestras.
How can we get a grip on such a many-headed beast, and force it into the confines of a com-
puter program? Our solution is to break 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. Such plug-ins are called engravers, by analogy
with craftsmen who translate musical ideas to graphic symbols.
In the following example, we see how we start out with a plug-in for note heads, the Note_
heads_engraver.
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.
Chapter 1: Introduction 6
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. Similarly, multiple Staff contexts can be put into a single
Score context. The Score context is the top level notation context.
See also
Program reference: Contexts.
1.4 Music representation
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 an 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
Chords can be constructed with << and >> enclosing the notes
Chapter 1: Introduction 7
<<c4 d4 e4>>
The above is also an expression, and so it may be combined again with another simultaneous
expression (a half note) using <<, \\, and >>
<< g2 \\ { f4 <<c4 d4 e4>> } >>
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, while 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 source code.
42
C C F C
42
twin kle twin kle lit tle star
Chapter 1: Introduction 8
Polyphonic notation and piano music can also be printed. The following example combines
some more exotic constructs.
48
3
4
8
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 PDF or HTML output files. This makes it easy to mix music and text in
documents.
Chapter 10 [Non-musical notation], page 234 discusses non-musical output such as titles,
multiple movements, and how to select which MIDI instruments to use.
Chapter 11 [Spacing issues], page 246 discusses issues which affect the global output, such
as selecting paper size or specifying page breaks.
Chapter 12 [Interfaces for programmers], page 271 explains how to create music functions.
Chapter 13 [Running LilyPond], page 286 shows how to run LilyPond and its helper pro-
grams. In addition, this section explains how to upgrade input files from previous versions
of LilyPond.
Chapter 14 [LilyPond-book], page 295 explains the details behind creating documents with
in-line music examples, like this manual.
Chapter 15 [Converting from other formats], page 306 explains how to run the conversion
programs. These programs are supplied with the LilyPond package, and convert a variety
of music formats to the .ly format.
Appendix A [Literature list], page 309 contains a set of useful reference books for those who
wish to know more on notation and engraving.
The Appendix B [Scheme tutorial], page 310 presents a short introduction to Scheme, the
programming language that music functions use.
Appendix C [Notation manual tables], page 312 are a set of tables showing the chord names,
MIDI instruments, a list of color names, and the Feta font.
Appendix D [Templates], page 318 of LilyPond pieces. Just cut and paste a template into
a file, add notes, and youre done!
The Appendix E [Cheat sheet], page 349 is a handy reference of the most common LilyPond
commands.
The Appendix G [LilyPond command index], page 359 is an index of all LilyPond \commands.
The Appendix H [LilyPond index], page 362 is a complete index.
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 music glossary
explains musical terms, and includes translations to various languages. It is a separate document,
available in HTML and PDF.
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
Program reference
The program reference is a set of heavily cross linked HTML pages, which document the
nitty-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 thickness values, distances, etc., can be changed in
input files. There are a huge number of formatting options, and all of them are described in
this document. Each section of the notation manual has a See also subsection, which refers
to the generated documentation. In the HTML document, these subsections have clickable
links.
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.
Chapter 1: Introduction 10
2 Tutorial
This tutorial starts with an introduction to the LilyPond music language and how to produce
printed music. After this first contact we will explain how to create common musical notation.
Warning: Every piece of LilyPond input needs to have { curly braces } placed around the
input. The braces should also be surrounded by a space unless they are at the beginning or
end of a line to avoid ambiguities. These may be omitted in some examples in this manual, but
dont forget them in your own music!
In addition, LilyPond input is case sensitive. { c d e } is valid input; { C D E } will
produce an error message.
MacOS X
If you double click LilyPond.app, it will open with an example file. Save it, for example, to
test.ly on your Desktop, and then process it with the menu command Compile > Typeset
File. The resulting PDF file will be displayed on your screen.
Be warned that the first time you ever run LilyPond, it will take a minute or two because all
of the system fonts have to be analyzed first.
For future use of LilyPond, you should begin by selecting "New" or "Open". You must save
your file before typesetting it. If any errors occur in processing, please see the log window.
Windows
On Windows, start up a text-editor1 and enter
{
c' e' g' e'
}
1
Any simple or programmer-oriented editor with UTF-8 support will do, for example Notepad. Do not use a
word processor, since these insert formatting codes that will confuse LilyPond.
Chapter 2: Tutorial 12
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. To edit an existing .ly
file, right-click on it and select Edit source.
If you double-click in the LilyPond icon on the Desktop, it will open a simple text editor
with an example file. Save it, for example, to test.ly on your Desktop, and then double-click
on the file to process it. After some seconds, you will get a file test.pdf on your desktop.
Double-click on this PDF file to view the typeset score. An alternative method to process the
test.ly file is to drag and drop it onto the LilyPond icon using your mouse pointer.
Double-clicking the file does not only result in a PDF file, but also produces a .log file that
contains some information on what LilyPond has done to the file. If any errors occur, please
examine this file.
Unix
Begin by opening a terminal window and starting a text editor. For example, you could open
an xterm and execute joe2 . In your text editor, enter the following input and save the file as
test.ly
{
c' e' g' e'
}
To process test.ly, proceed as follows
lilypond test.ly
You will see something resembling
lilypond test.ly
GNU LilyPond 2.10.0
Processing test.ly'
Parsing...
Interpreting music... [1]
Preprocessing graphical objects...
Calculating line breaks... [2]
Layout output to test.ps'...
Converting to test.pdf'...
The result is the file test.pdf which you can print or view with the standard facilities of your
operating system.3
2
There are macro files for VIM addicts, and there is a LilyPond-mode for Emacs addicts. If they have not
been installed already, refer to the file INSTALL.txt. The easiest editing environment is LilyPondTool. See
Section 13.6 [Editor support], page 293 for more information.
3
If your system does not have any such tools installed, you can try Ghostscript, a freely available package for
viewing and printing PDF and PostScript files.
Chapter 2: Tutorial 13
This behavior may be altered, but in most cases these automatic values are useful.
Pitches
The easiest way to enter notes is by using \relative mode. In this mode, the interval between
the previous note and the current note is assumed to be within a fourth. We begin by entering
the most elementary piece of music, a scale.
\relative c' {
c d e f
g a b c
}
The initial note is middle C. Each successive note is within a fourth of the previous note
in other words, the first c is the closest C to middle C. This is followed by the closest D to the
previous note. We can create melodies which have larger intervals:
\relative c' {
d f a g
c b f d
}
As you may notice, this example does not start on middle C. The first note the d is the
closest D to middle C.
To add intervals that are larger than a fourth, we can raise the octave by adding a single
quote ' (or apostrophe) to the note name. We can lower the octave by adding a comma , to
the note name.
\relative c'' {
a a, c' f,
g g'' a,, f'
}
To change a note by two (or more!) octaves, we use multiple '' or ,, but be careful that you
use two single quotes '' and not one double quote " ! The initial value in \relative c' may
also be modified like this.
Chapter 2: Tutorial 14
Durations (rhythms)
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. Beams are added automatically.
\relative c'' {
a1
a2 a4 a8 a
a16 a a a a32 a a a a64 a a a a a a a a2
}
3
If you do not specify a duration, the previous duration is used for the next note. The duration
of the first note defaults to a quarter.
To create dotted notes, add a dot . to the duration number.
\relative c'' {
a a a4. a8
a8. a16 a a8. a8 a4.
}
Rests
A rest is entered just like a note with the name r:
\relative c'' {
a r r2
r8 a r4 r4. r8
}
Time signature
The time signature) can be set with the \time command:
\relative c'' {
\time 3/4
a4 a a
\time 6/8
a4. a
Chapter 2: Tutorial 15
\time 4/4
a4 a a a
}
43 8
6
Clef
The clef can be set using the \clef command:
\relative c' {
\clef treble
c1
\clef alto
c1
\clef tenor
c1
\clef bass
c1
}
All together
Here is a small example showing all these elements together:
\relative c, {
\time 3/4
\clef bass
c2 e8 c' g'2.
f4 e d c4 c, r4
}
3
4
More information
Entering pitches and durations
see Section 6.1 [Pitches], page 59 and Section 6.2.1 [Durations], page 66.
Rests see Section 6.1.9 [Rests], page 64.
Time signatures and other timing commands
see Section 6.4.3 [Time signature], page 78.
Clefs see Section 6.4.1 [Clef], page 76.
Chapter 2: Tutorial 16
%{
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 are more tips for constructing input files in Section 4.1 [Suggestions for writing Lily-
Pond files], page 42.
HTML version, you could copy and paste the displayed input, but you must add the \relative
c'' { } like this:
\relative c'' {
... example goes here...
}
Why omit the braces? Most examples in this manual can be inserted into the middle of a
longer piece of music. For these examples, it does not make sense to add \relative c'' { }
you should not place a \relative inside another \relative, so you would not be able to copy
a small documentation example and paste it inside a longer piece of your own.
More information
Relative octaves
see Section 6.1.6 [Relative octaves], page 62.
Octave check
see Section 6.1.7 [Octave check], page 63.
4
There is another mode of entering pitches, Section 2.5.3 [Absolute note names], page 30, but in practice
relative mode is much easier and safer to use.
5
This syntax derived from note naming conventions in Nordic and Germanic languages, like German and Dutch.
To use other names for accidentals, see Section 6.1.5 [Note names in other languages], page 61.
Chapter 2: Tutorial 18
Key signatures
The key signature is set with the command \key followed by a pitch and \major or \minor.
\key d \major
a1
\key c \minor
a
No note has a printed accidental, but you must still add the is to cis and fis.
The code e does not mean print a black dot just below the first line of the staff. Rather,
it means: there is a note with pitch E-natural. In the key of A-flat major, it does get an
accidental:
\key aes \major
e
Adding all alterations explicitly might require a little more effort when typing, but the ad-
vantage is that transposing is easier, and accidentals can be printed according to different con-
ventions. See Section 9.1.1 [Automatic accidentals], page 213 for some examples how accidentals
can be printed according to different rules.
Chapter 2: Tutorial 19
More information
Accidentals
see Section 6.1.2 [Accidentals], page 60 and Section 9.1.1 [Automatic
accidentals], page 213.
Key signature
see Section 6.4.2 [Key signature], page 77.
Slurs
A slur is a curve drawn across many notes. The starting note and ending note are marked with
( and ) respectively.
d4( c16) cis( d e c cis d) e( d4)
Phrasing slurs
Slurs to indicate longer phrasing can be entered with \( and \). You can have both legato slurs
and phrasing slurs at the same time, but you cannot have simultaneous slurs or simultaneous
phrasing slurs.
a8(\( ais b c) cis2 b'2 a4 cis,\)
Chapter 2: Tutorial 20
More information
Ties see Section 6.5.1 [Ties], page 86.
Slurs see Section 6.5.2 [Slurs], page 88.
Phrasing slurs
see Section 6.5.3 [Phrasing slurs], page 89.
Fingerings
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
1
35 2
Articulations and fingerings are usually placed automatically, but you can specify a direction
using ^ (up) or _ (down). You can also use multiple articulations on the same note. However,
in most cases it is best to let LilyPond determine the articulation directions.
c_-^1 d^. f^4_2-> e^-_+
4
1
2
Dynamics
Dynamic signs are made by adding the markings (with a backslash) to the note
c\ff c\mf c\p c\pp
ff mf p pp
Chapter 2: Tutorial 21
Crescendi and decrescendi are started with the commands \< and \>. An ending dynamic,
for example \f, will finish the (de)crescendo, or the command \! can be used
c2\< c2\ff\> c2 c2\!
ff
More information
Articulations
see Section 6.6.1 [Articulations], page 94.
Fingering see Section 6.6.2 [Fingering instructions], page 96.
Dynamics see Section 6.6.3 [Dynamics], page 98.
If you do not like the automatic beams, they may be overridden manually. Mark the first note
to be beamed with [ and the last one with ].
a8[ ais] d[ ees r d] a b
More information
Automatic beams
see Section 6.5.5 [Automatic beams], page 90.
Manual beams
see Section 6.5.6 [Manual beams], page 90.
Chapter 2: Tutorial 22
Tuplets
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 }
\times 2/3 { f,8 g16[ a g a] }
\times 2/3 { d4 a8 }
3
3 3 3
Grace notes
Grace notes are created with the \grace command, although they can also be created by pre-
fixing a music expression with the keyword \appoggiatura or \acciaccatura
c2 \grace { a32[ b] } c2
c2 \appoggiatura b16 c2
c2 \acciaccatura b16 c2
More information
Grace notes
see Section 6.5.7 [Grace notes], page 91,
Tuplets see Section 6.2.3 [Tuplets], page 67,
Pickups see Section 6.4.4 [Partial measures], page 79.
Chapter 2: Tutorial 23
Putting a group of music expressions (e.g. notes) in braces means that they are in sequence
(i.e. each one follows the previous one). The result is another music expression:
{ { a4 g } f g }
Note that we have indented each level of the input with a different amount of space. LilyPond
does not care how much (or little) space there is at the beginning of a line, but indenting LilyPond
code like this makes it much easier for humans to read.
Warning: each note is relative to the previous note in the input, not relative to the c'' in
the initial \relative command.
Chapter 2: Tutorial 24
1 + 2
(1 + 2) * 3
((1 + 2) * 3) / (4 * 5)
This is a sequence of expressions, where each expression is contained in the next (larger)
one. The simplest expressions are numbers, and larger ones are made by combining expressions
with operators (like +, * and /) and parentheses. Like mathematical expressions, music
expressions can be nested arbitrarily deep, which is necessary for complex music like polyphonic
scores.
Chapter 2: Tutorial 25
3
4
3
4
2.3.3 Piano staves
Piano music is typeset in two staves connected by a brace. Printing such a staff is similar to the
polyphonic example in Section 2.3.2 [Multiple staves], page 24, but now this entire expression is
inserted inside a PianoStaff:
\new PianoStaff <<
\new Staff ...
\new Staff ...
>>
Here is a small example
\relative c'' {
\new PianoStaff <<
\new Staff { \time 2/4 c4 e g g, }
\new Staff { \clef bass c,, c' e c }
>>
}
42
2
4
6
This behavior may be changed if desired; see Chapter 9 [Changing defaults], page 213 for details.
Chapter 2: Tutorial 26
More information
See Section 7.1 [Piano music], page 109.
For polyphonic music typesetting, spacer rests can also be convenient; these are rests that do
not print. They are useful for filling up voices that temporarily do not play. Here is the same
example with a spacer rest (s) instead of a normal rest (r),
<<
{ a4 g2 f4~ f4 } \\
{ s4 g4 f2 f4 }
>>
Again, these expressions can be nested arbitrarily.
<<
\new Staff <<
{ a4 g2 f4~ f4 } \\
{ s4 g4 f2 f4 }
>>
\new Staff <<
\clef bass
{ <c g>1 ~ <c g>4 } \\
{ e,,4 d e2 ~ e4}
>>
>>
Chapter 2: Tutorial 27
More information
See Section 6.3.3 [Basic polyphony], page 70.
You can combine markings like beams and ties with chords. They must be placed outside
the angle brackets
r4 <c e g>8[ <c f a>]~ <c f a>2
2.4 Songs
This section introduces vocal music and simple song sheets.
The lyrics can be set to these notes, combining both with the \addlyrics keyword. Lyrics
are entered by separating each syllable with a space.
<<
\relative c'' {
a4 e c8 e r4
b2 c4( d)
Chapter 2: Tutorial 28
}
\addlyrics { One day this shall be free }
>>
One day this shall be 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 __:
<<
\relative c'' {
a4 e c8 e r4
b2 c4( d)
}
\addlyrics { One day this shall be free __ }
>>
One day this shall be free
Similarly, hyphens between words can be entered as two dashes, resulting in a centered
hyphen between two syllables
<<
\relative c' {
\time 2/4
f4 f c c
}
\addlyrics { A -- le -- gri -- a }
>>
42
A le gri a
More information
More options, such as putting multiple stanzas below a melody, are discussed in
Section 7.3 [Vocal music], page 118.
\chordmode { c2 f4. g8 }
For lead sheets, chords are not printed on staves, but as names on a line for themselves. This
is achieved by using \chords instead of \chordmode. This uses the same syntax as \chordmode,
but renders the notes in a ChordNames context, with the following result:
\chords { c2 f4.:m g4.:maj7 gis8:dim7 }
o7
C Fm G G
When put together, chord names, lyrics and a melody form a lead sheet,
<<
\chords { c2 g:sus4 f e }
\relative c'' {
a4 e c8 e r4
b2 c4( d)
}
\addlyrics { One day this shall be free __ }
>>
sus4
C G F E
One day this shall be free
More information
A complete list of modifiers and other options for layout can be found in Section 6.3.1
[Chords], page 70.
Chapter 2: Tutorial 30
{
... music ...
}
When the file is processed, the title and composer are printed above the music. More infor-
mation on titling can be found in Section 10.2.1 [Creating titles], page 238.
{
\clef bass
c, d, e, f,
g, a, b, c
d e f g
a b c' d'
\clef treble
e' f' g' a'
b' c'' d'' e''
f'' g'' a'' b''
c'''1
}
5
As you can see, writing a melody in the treble clef involves a lot of quote marks. Consider
this fragment from Mozart:
{
\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
}
6
8
All these quotes makes the input less readable and it is a source of errors. With \relative,
the previous example is much easier to read:
\relative c'' {
\key a \major
\time 6/8
cis8. d16 cis8 e4 e8
b8. cis16 b8 d4 d8
}
6
8
Chapter 2: Tutorial 32
If you make a mistake with an octave mark (' or ,) while working in \relative mode, it
is very obvious many notes will be in the wrong octave. When working in absolute mode, a
single mistake will not be as visible, and will not be as easy to find.
However, absolute mode is useful for music which has large intervals, and is extremely useful
for computer-generated LilyPond files.
The name of an identifier must have alphabetic characters only: no numbers, underscores, or
dashes.
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:
\paper {
\aFivePaper
line-width = \width
}
{ c4^\name }
Chapter 2: Tutorial 33
This chapter discusses general LilyPond concepts and how to create \score blocks.
a4 b c d
}
text = \lyricmode {
Aaa Bee Cee Dee
}
\score{
<<
\new Voice = "one" {
\autoBeamOff
\melody
}
\new Lyrics \lyricsto "one" \text
>>
\layout { }
\midi { }
}
Now we want to add a cello part. Lets look at the Notes only example:
\version "2.10.10"
melody = \relative c' {
\clef treble
\key c \major
\time 4/4
a4 b c d
}
\score {
\new Staff \melody
\layout { }
\midi { }
}
Chapter 3: Putting it all together 35
We dont need two \version commands. Well need the melody section. We dont want two
\score sections if we had two \scores, wed get the two parts separately. We want them
together, as a duet. Within the \score section, we dont need two \layout or \midi.
If we simply cut and paste the melody section, we would end up with two melody sections. So
lets rename them. Well call the section for the soprano sopranoMusic and the section for the
cello celloMusic. While were doing this, lets rename text to be sopranoLyrics. Remember
to rename both instances of all these names both the initial definition (the melody = relative
c' { part) and the names use (in the \score section).
While were doing this, lets change the cello parts staff celli normally use bass clef. Well
also give the cello some different notes.
\version "2.10.10"
sopranoMusic = \relative c' {
\clef treble
\key c \major
\time 4/4
a4 b c d
}
sopranoLyrics = \lyricmode {
Aaa Bee Cee Dee
}
celloMusic = \relative c {
\clef bass
\key c \major
\time 4/4
d4 g fis8 e d4
}
\score{
<<
\new Voice = "one" {
\autoBeamOff
\sopranoMusic
}
\new Lyrics \lyricsto "one" \sopranoLyrics
>>
\layout { }
\midi { }
}
This is looking promising, but the cello part wont appear in the score we havent used it
in the \score section. If we want the cello part to appear under the soprano part, we need to
add
\new Staff \celloMusic
underneath the soprano stuff. We also need to add << and >> around the music that tells
LilyPond that theres more than one thing (in this case, Staff) happening at once. The \score
looks like this now
\score{
Chapter 3: Putting it all together 36
<<
<<
\new Voice = "one" {
\autoBeamOff
\sopranoMusic
}
\new Lyrics \lyricsto "one" \sopranoLyrics
>>
\new Staff \celloMusic
>>
\layout { }
\midi { }
}
This looks a bit messy; the indentation is messed up now. That is easily fixed. Heres the
complete soprano and cello template.
\version "2.10.10"
sopranoMusic = \relative c' {
\clef treble
\key c \major
\time 4/4
a4 b c d
}
sopranoLyrics = \lyricmode {
Aaa Bee Cee Dee
}
celloMusic = \relative c {
\clef bass
\key c \major
\time 4/4
d4 g fis8 e d4
}
\score{
<<
<<
\new Voice = "one" {
\autoBeamOff
\sopranoMusic
}
\new Lyrics \lyricsto "one" \sopranoLyrics
>>
\new Staff \celloMusic
>>
\layout { }
\midi { }
}
Chapter 3: Putting it all together 37
Aaa Bee Cee Dee
Now we get to the only real stumbling block: LilyPond input in this form is actually another
shorthand. Although it compiles and displays the correct output, it is shorthand for
\score {
\relative c'' {
c4 a b c
}
}
A \score must begin with a single music expression. Remember that a music expression
could be anything from a single note to a huge
{
\new GrandStaff <<
insert the whole score of a Wagner opera in here
>>
}
Since everything is inside { ... }, it counts as one music expression.
The \score can contain other things, such as
Chapter 3: Putting it all together 38
\score {
{ c'4 a b c' }
\layout { }
\midi { }
\header { }
}
Some people put some of those commands outside the \score block for example, \header is
often placed above the \score. Thats just another shorthand that LilyPond accepts.
Another great shorthand is the ability to define variables. All the templates use this
melody = \relative c' {
c4 a b c
}
\score {
{ \melody }
}
When LilyPond looks at this file, it takes the value of melody (everything after the equals
sign) and inserts it whenever it sees \melody. Theres nothing special about the names it
could be melody, global, pianorighthand, or foofoobarbaz. You can use whatever variable
names you want. For more details, see Section 4.2 [Saving typing with identifiers and functions],
page 43.
For a complete definition of the input format, see Section 10.1.2 [File structure], page 234.
}
\layout { }
}
Remember that you can use almost any name you like. The limitations on identifier names are
detailed in Section 10.1.2 [File structure], page 234.
When writing a \score section, or when reading one, just take it slowly and carefully. Start
with the outer layer, then work on each smaller layer. It also really helps to be strict with
indentation make sure that each item on the same layer starts on the same horizontal position
in your text editor!
{
\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 upwards. Sounding f is denoted by notated c', which cor-
responds with the tuning of a normal French Horn in F. The transposition can be seen in the
following output
2
4
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
Chapter 3: Putting it all together 41
3
4
2
The score is made by combining all of the music together. 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"
<<
\new Staff \hornNotes
\new Staff \bassoonNotes
>>
leading to
42
2
4
More in-depth information on preparing parts and scores can be found in the notation manual;
see Section 8.3 [Orchestral music], page 195.
Setting run-time variables (properties) is discussed in Section 9.2.3 [Changing context prop-
erties on the fly], page 220.
Chapter 4: Working on LilyPond projects 42
Chapter 4: Working on LilyPond projects 44
You may even realize that this could be useful in minimalist music:
fragA = \relative c'' { a4 a8. b16 }
fragB = \relative c'' { a8. gis16 ees4 }
violin = \new Staff { \fragA \fragA \fragB \fragA }
\score {
{
\violin
}
}
However, you can also use these identifiers (also known as variables, macros, or (user-defined)
command) for tweaks:
dolce = \markup{ \italic \bold dolce }
padText = { \once \override TextScript #'padding = #5.0 }
fthenp=_\markup{ \dynamic f \italic \small { 2nd } \hspace #0.1 \dynamic p }
violin = \relative c'' {
\repeat volta 2 {
c4._\dolce b8 a8 g a b |
\padText
c4.^"hi there!" d8 e' f g d |
c,4.\fthenp b8 c4 c-. |
}
}
\score {
{
\violin
}
\layout{ragged-right=##t}
}
hi there!
dolce
f 2nd p
These identifiers are obviously useful for saving typing. But theyre worth considering even
if you only use them once they reduce complexity. Lets look at the previous example without
any identifiers. Its a lot harder to read, especially the last line.
violin = \relative c'' {
\repeat volta 2 {
c4._\markup{ \italic \bold dolce } b8 a8 g a b |
\once \override TextScript #'padding = #5.0
c4.^"hi there!" d8 e' f g d |
c,4.\markup{ \dynamic f \italic \small { 2nd }
Chapter 4: Working on LilyPond projects 45
\relative c''' {
c4^"piu mosso" b a b
\padText #1.8
c4^"piu mosso" d e f
\padText #2.6
c4^"piu mosso" fis a g
}
piu mosso piu mosso
piu mosso
Using identifiers is also a good way to reduce work if the LilyPond input syntax changes (see
Section 4.4 [Updating old files], page 48). If you have a single definition (such as \dolce) for all
your files (see Section 4.3 [Style sheets], page 45), then if the syntax changes, you only need to
update your single \dolce definition, instead of making changes throughout every .ly file.
\relative c'' {
\tempo 4=50
a4.\mpdolce d8 cis4--\glissando a | b4 bes a2
Chapter 4: Working on LilyPond projects 46
Poco piu mosso
= 50
mp dolce
There are some problems with overlapping output; well fix those using the techniques in
Section 5.1 [Moving objects], page 51. But lets also do something about the mpdolce and
tempoMark definitions. They produce the output we desire, but we might want to use them
in another piece. We could simply copy-and-paste them at the top of every file, but thats an
annoyance. It also leaves those definitions in our music files, and I personally find all the #()
somewhat ugly. Lets hide them in another file:
%%% save this to a file called "definitions.ly"
mpdolce = #(make-dynamic-script (markup #:hspace 1 #:translate (cons 5 0)
#:line(#:dynamic "mp" #:text #:italic "dolce" )))
tempoMark = #(define-music-function (parser location markp) (string?)
#{
\once \override Score . RehearsalMark #'self-alignment-X = #left
\once \override Score . RehearsalMark #'no-spacing-rods = ##t
\mark \markup { \bold $markp }
#})
Now lets modify our music (lets save this file as "music.ly").
\include "definitions.ly"
\relative c'' {
\tempo 4=50
a4.\mpdolce d8 cis4--\glissando a | b4 bes a2
\once \override Score.RehearsalMark #'padding = #2.0
\tempoMark "Poco piu mosso"
cis4.\< d8 e4 fis | g8(\! fis)-. e( d)-. cis2
}
Poco piu mosso
= 50
mp dolce
That looks better, but lets make a few changes. The glissando is hard to see, so lets make
it thicker and closer to the noteheads. Lets put the metronome marking above the clef, instead
of over the first note. And finally, my composition professor hates "C" time signatures, so wed
better make that "4/4" instead.
Dont change music.ly, though. Replace our definitions.ly with this:
%%% definitions.ly
mpdolce = #(make-dynamic-script (markup #:hspace 1 #:translate (cons 5 0)
#:line( #:dynamic "mp" #:text #:italic "dolce" )))
tempoMark = #(define-music-function (parser location markp) (string?)
Chapter 4: Working on LilyPond projects 47
#{
\once \override Score . RehearsalMark #'self-alignment-X = #left
\once \override Score . RehearsalMark #'no-spacing-rods = ##t
\mark \markup { \bold $markp }
#})
\layout{
\context { \Score
\override MetronomeMark #'extra-offset = #'(-9 . 0)
\override MetronomeMark #'padding = #'3
}
\context { \Staff
\override TimeSignature #'style = #'numbered
}
\context { \Voice
\override Glissando #'thickness = #3
\override Glissando #'gap = #0.1
}
}
= 50 Poco piu mosso
44
mp dolce
That looks nicer! But now suppose that I want to publish this piece. My composition
professor doesnt like "C" time signatures, but Im somewhat fond of them. Lets copy the
current definitions.ly to web-publish.ly and modify that. Since this music is aimed at
producing a pdf which will be displayed on the screen, well also increase the overall size of the
output.
%%% definitions.ly
mpdolce = #(make-dynamic-script (markup #:hspace 1 #:translate (cons 5 0)
#:line( #:dynamic "mp" #:text #:italic "dolce" )))
tempoMark = #(define-music-function (parser location markp) (string?)
#{
\once \override Score . RehearsalMark #'self-alignment-X = #left
\once \override Score . RehearsalMark #'no-spacing-rods = ##t
\mark \markup { \bold $markp }
#})
#(set-global-staff-size 23)
\layout{
\context { \Score
\override MetronomeMark #'extra-offset = #'(-9 . 0)
\override MetronomeMark #'padding = #'3
}
\context { \Staff
}
\context { \Voice
\override Glissando #'thickness = #3
Chapter 4: Working on LilyPond projects 48
= 50 Poco piu mosso
mp dolce
4
For example, in LilyPond 2.4 and earlier, accents and non-English letters were entered using
LaTeX for example, "No\"el" (this would print the French word for Christmas). In LilyPond
2.6 and above, the special "e" must be entered directly into the LilyPond file as an UTF-8
character. convert-ly cannot change all the LaTeX special characters into UTF-8 characters;
you must manually update your old LilyPond files.
good idea to comment out lines instead of deleting them. That way, if you discover that you
actually do need some lines, you can uncomment them, instead of typing them in from scratch.
There are two exceptions to the as small as possible rule:
Include the \version number.
If possible, use \paper{ ragged-right=##t } at the top of your example.
The whole point of a minimal example is to make it easy to read:
Avoid using complicated notes, keys, or time signatures, unless you wish to demonstrate
something is about the behavior of those items.
Do not use \override commands unless that is the point of the example.
Chapter 5: Tweaking output 51
5 Tweaking output
This chapter discusses how to modify output. LilyPond is extremely configurable; virtually
every fragment of output may be changed.
ritenuto
The easiest solution is to increase the distance between the object (in this case text, but it
could easily be fingerings or dynamics instead) and the note. In LilyPond, this is called the
padding property; it is measured in staff spaces. For most objects, this value is around 1.0 or
less (it varies with each object). We want to increase it, so lets try 1.5
\once \override TextScript #'padding = #1.5
e4^\markup{ \italic ritenuto } g b e
ritenuto
That looks better, but it isnt quite big enough. After experimenting with a few values,
we think 2.3 is the best number in this case. However, this number is merely the result of
experimentation and my personal taste in notation. Try the above example with 2.3... but also
try higher (and lower) numbers. Which do you think looks the best?
The staff-padding property is closely related. padding controls the minimum amount of
space between an object and the nearest other object (generally the note or the staff lines);
staff-padding controls the minimum amount of space between an object and the staff. This
is a subtle difference, but you can see the behavior here.
c4^"piu mosso" b a b
\once \override TextScript #'padding = #2.6
c4^"piu mosso" d e f
\once \override TextScript #'staff-padding = #2.6
c4^"piu mosso" fis a g
\break
c'4^"piu mosso" b a b
\once \override TextScript #'padding = #2.6
c4^"piu mosso" d e f
\once \override TextScript #'staff-padding = #2.6
c4^"piu mosso" fis a g
piu mosso piu mosso
piu mosso
Chapter 5: Tweaking output 52
piu mosso
piu mosso piu mosso
Another solution gives us complete control over placing the object we can move it horizon-
tally or vertically. This is done with the extra-offset property. It is slightly more complicated
and can cause other problems. When we move objects with extra-offset, the movement is
done after LilyPond has placed all other objects. This means that the result can overlap with
other objects.
\once \override TextScript #'extra-offset = #'( 1.0 . -1.0 )
e4^\markup{ \italic ritenuto } g b e
ritenuto
With extra-offset, the first number controls the horizontal movement (left is negative);
the second number controls the vertical movement (up is positive). After a bit of experimenting,
we decided that these values look good
\once \override TextScript #'extra-offset = #'( -1.6 . 1.0 )
e4^\markup{ \italic ritenuto } g b e
ritenuto
Again, these numbers are simply the result of a few experiments and looking at the output. You
might prefer the text to be slightly higher, or to the left, or whatever. Try it and look at the
result!
One final warning: in this section, we used
\once \override TextScript ...
This tweaks the display of text for the next note. If the note has no text, this tweak does
nothing (and does not wait until the next bit of text). To change the behavior of everything
after the command, omit the \once. To stop this tweak, use a \revert. This is explained in
depth in Section 9.3 [The \override command], page 228.
c4^"piu mosso" b
\once \override TextScript #'padding = #2.6
a4 b
c4^"piu mosso" d e f
\once \override TextScript #'padding = #2.6
c4^"piu mosso" d e f
c4^"piu mosso" d e f
\break
\override TextScript #'padding = #2.6
c4^"piu mosso" d e f
c4^"piu mosso" d e f
\revert TextScript #'padding
Chapter 5: Tweaking output 53
c4^"piu mosso" d e f
piu mosso
piu mosso piu mosso piu mosso
See also
This manual: Section 9.3 [The \override command], page 228, Section 5.3 [Common tweaks],
page 54.
See also
Program reference: DynamicText, Hairpin. Vertical positioning of these symbols is
handled by DynamicLineSpanner.
So to move dynamics around vertically, we use
\override DynamicLineSpanner #'padding = #2.0
We cannot list every object, but here is a list of the most common objects.
% This will not work, see below:
\override MetronomeMark #'padding = #3
\tempo 4=120
c1
% This works:
\override Score.MetronomeMark #'padding = #3
\tempo 4=80
d1
= 80
= 120
Note in the second example how important it is to figure out what context handles a certain
object. Since the MetronomeMark object is handled in the Score context, property changes
in the Voice context will not be noticed. For more details, see Section 9.3.1 [Constructing
a tweak], page 228.
The extra-offset property moves objects around in the output; it requires a pair of
numbers. The first number controls horizontal movement; a positive number will move the
object to the right. The second number controls vertical movement; a positive number will
move it higher. 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
Chapter 5: Tweaking output 55
5
5
Setting the 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, 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 the first up-stem in that voice, the tie appears to cross voices:
<< {
\once \override Stem #'transparent = ##t
b8~ b8\noBeam
} \\ {
b[ g8]
} >>
To make sure that the just blanked stem doesnt squeeze the too much tie, we also lengthen
the stem, by setting the length to 8,
<< {
\once \override Stem #'transparent = ##t
\once \override Stem #'length = #8
b8~ b8\noBeam
} \\ {
b[ g8]
} >>
Distances in LilyPond are measured in staff-spaces, while most thickness properties are mea-
sured in line-thickness. Some properties are different; for example, the thickness of beams are
measured in staff-spaces. For more information, see the relevant portion of the program refer-
ence.
f
f
Chapter 5: Tweaking output 57
Alter the horizontal spacing via SpacingSpanner. See Section 11.5.3 [Changing horizontal
spacing], page 267 for more details.
\score {
\relative c'' {
g4 e e2 | f4 d d2 | c4 d e f | g4 g g2 |
g4 e e2 | f4 d d2 | c4 e g g | c,1 |
d4 d d d | d4 e f2 | e4 e e e | e4 f g2 |
g4 e e2 | f4 d d2 | c4 e g g | c,1 |
}
\layout {
\context {
\Score
\override SpacingSpanner
#'base-shortest-duration = #(ly:make-moment 1 4)
}
}
}
9
\relative c''' {
c4^"piu mosso" b a b
\padText #1.8
c4^"piu mosso" d e f
\padText #2.6
c4^"piu mosso" fis a g
}
piu mosso piu mosso
piu mosso
Chapter 5: Tweaking output 58
\relative c'' {
c2 e
\tempoMark #3.0 #"Allegro"
g c
}
Allegro
\relative c''{
\pattern c8 c8\f
\pattern {d16 dis} { ais16-> b\p }
}
f p
5.7 Avoiding tweaks with slower processing
LilyPond can perform extra checks while it processes files. These commands will take extra
time, but the result may require fewer manual tweaks.
%% makes sure text scripts and lyrics are within the paper margins
\override Score.PaperColumn #'keep-inside-line = ##t
Chapter 6: Basic notation 59
6 Basic notation
This chapter explains how to use basic notation features.
6.1 Pitches
This section discusses how to specify the pitch of notes.
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.
\clef treble
c' c'' e' g d'' d' d c
\clef bass
c, c,, e, g d,, d, d c
An alternate method may be used to declare which octave to engrave a pitch; this method
does not require as many octave specifications (' and ,). See Section 6.1.6 [Relative octaves],
page 62.
Chapter 6: Basic notation 60
6.1.2 Accidentals
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 to a note name.
a2 ais a aes
a2 aisis a aeses
These are the Dutch note names. In Dutch, aes is contracted to as, but both forms are accepted.
Similarly, both es and ees are accepted
a2 as e es
A natural will cancel the effect of an accidental or key signature. However, naturals are not
encoded into the note name syntax with a suffix; a natural pitch is shown as a simple note name
a4 aes a2
Chapter 6: Basic notation 61
See also
Program reference: LedgerLineSpanner, NoteHead.
See also
The automatic production of accidentals can be tuned in many ways. For more information, see
Section 9.1.1 [Automatic accidentals], page 213.
Bugs
There are no generally accepted standards for denoting three-quarter flats, so LilyPonds symbol
does not conform to any standard.
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>
}
Chapter 6: Basic notation 63
6.1.8 Transpose
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
Chapter 6: Basic notation 64
\transpose d e ...
Consider a part written for violin (a C instrument). If this part is to be played on the A
clarinet (for which an A is notated as a C, and which sounds a minor third lower than notated),
the following transposition will produce the appropriate part
\transpose a c ...
\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 = { \key d \major cis d fis g }
\new Staff {
\clef "F" \mus
\clef "G"
\transpose c g' \mus
\transpose c f' \mus
}
\transpose may also be used to input written notes for a transposing instrument. Pitches
are normally entered into LilyPond in C (or concert pitch), but they may be entered in another
key. For example, when entering music for a B-flat trumpet which begins on concert D, one
would write
\transpose c bes { e4 ... }
To print this music in B-flat again (i.e., producing a trumpet part, instead of a concert pitch
conductors score) you would wrap the existing music with another transpose
\transpose bes c { \transpose c bes { e4 ... } }
See also
Program reference: TransposedMusic.
Example: input/test/smart-transpose.ly.
Bugs
If you want to use both \transpose and \relative, you must put \transpose outside of
\relative, since \relative will have no effect on music that appears inside a \transpose.
6.1.9 Rests
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
can be used for a single bar as well as many bars, and are discussed in Section 8.2.1 [Multi
measure rests], page 184.
To explicitly specify a rests vertical position, write a note followed by \rest. A rest will be
placed in the position where the note would appear,
Chapter 6: Basic notation 65
a'4\rest d'4\rest
This makes manual formatting of polyphonic music much easier, since the automatic rest collision
formatter will leave these rests alone.
See also
Program reference: Rest.
6.1.10 Skips
An invisible rest (also called a skip) can be entered like a note with note name s or with
\skip duration
a4 a4 s4 a4 \skip 1 a4
The s syntax is only available in note mode and chord mode. In other situations, for example,
when entering lyrics, you should use the \skip command
<<
\relative { a'2 a2 }
\new Lyrics \lyricmode { \skip 2 bla2 }
>>
bla
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.
{ s4 }
See also
Program reference: SkipMusic.
Chapter 6: Basic notation 66
6.2 Rhythms
This section discusses rhythms, durations, and bars.
6.2.1 Durations
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 the \longa and \breve commands
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.
{ a a a2 a a4 a a1 a }
6.2.2 Augmentation dots
To obtain dotted note lengths, simply add a dot (.) to the number. Double-dotted notes are
produced in a similar way.
a'4 b' c''4. b'8 a'4. b'4.. c''8.
Predefined commands
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, \dotsNeutral.
See also
Program reference: Dots, and DotColumn.
Chapter 6: Basic notation 67
6.2.3 Tuplets
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 fractions 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
3
6:4 5:3
Predefined commands
\tupletUp, \tupletDown, \tupletNeutral.
3 3
For more information about make-moment, see Section 8.4.2 [Time administration], page 203.
The format of the number is determined by the property text in TupletNumber. The default
prints only the denominator, but if it is set to the function tuplet-number::calc-fraction-
text, num:den will be printed instead.
To avoid printing tuplet numbers, use
\times 2/3 { c8 c c } \times 2/3 { c8 c c }
\override TupletNumber #'transparent = ##t
\times 2/3 { c8 c c } \times 2/3 { c8 c c }
Chapter 6: Basic notation 68
3 3
Tuplet brackets can be made to run to prefatory matter or the next note
5 3
2 3
4 4
See also
Program reference: TupletBracket, TupletNumber, and TimeScaledMusic.
Examples: input/regression/tuplet-nest.ly.
42
See also
This manual: Section 6.2.3 [Tuplets], page 67
4
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.
If you want to allow line breaking on the bar lines where Completion_heads_engraver splits
notes, you must also remove Forbid_line_breaks_engraver.
Bugs
Not all durations (especially those containing tuplets) can be represented exactly with normal
notes and dots, but the engraver will not insert tuplets.
Completion_heads_engraver only affects notes; it does not split rests.
See also
Examples: input/regression/completion-heads.ly.
Program reference: Completion_heads_engraver.
Chapter 6: Basic notation 70
6.3 Polyphony
Polyphony in music refers to having more than one voice occurring in a piece of music. Polyphony
in LilyPond refers to having more than one voice on the same staff.
6.3.1 Chords
A chord is formed by a enclosing a set of pitches between < and >. A chord may be followed by
a duration, and a set of articulations, just like simple notes
<c e g>4 <c>8
For more information about chords, see Section 7.2 [Chord names], page 112.
6.3.2 Stems
Whenever a note is found, a Stem object is created automatically. For whole notes and rests,
they are also created but made invisible.
Predefined commands
\stemUp, \stemDown, \stemNeutral.
6.3.3 Basic polyphony
The easiest way to enter fragments with more than one voice on a staff is to enter each voice as
a sequence (with {...}), and combine them simultaneously, separating the voices with \\
\new Staff \relative c' {
c16 d e f
<<
{ g4 f e | d2 e2 } \\
{ r8 e4 d c8 ~ | c b16 a b8 g ~ g2 } \\
{ s2. | s4 b4 c2 }
>>
}
Chapter 6: Basic notation 71
The separator causes Voice contexts1 to be instantiated. They bear the names "1", "2",
etc. In each of these contexts, vertical direction of slurs, stems, etc., is set appropriately.
These voices are all separate from the voice that contains the notes just outside the << \\
>> construct. This should be noted when making changes at the voice level. This also means
that slurs and ties cannot go into or out of a << \\ >> construct. Conversely, parallel voices
from separate << \\ >> constructs on the same staff are the the same voice. Here is the same
example, with different noteheads for each voice. Note that the change to the note-head style
in the main voice does not affect the inside of the << \\ >> constructs. Also, the change to the
second voice in the first << \\ >> construct is effective in the second << \\ >>, and the voice is
tied across the two constructs.
\new Staff \relative c' {
\override NoteHead #'style = #'cross
c16 d e f
<<
{ g4 f e } \\
{ \override NoteHead #'style = #'triangle
r8 e4 d c8 ~ }
>> |
<<
{ d2 e2 } \\
{ c8 b16 a b8 g ~ g2 } \\
{ \override NoteHead #'style = #'slash s4 b4 c2 }
>>
}
Polyphony does not change the relationship of notes within a \relative { } block. Each
note is calculated relative to the note immediately preceding it.
\relative { noteA << noteB \\ noteC >> noteD }
noteC is relative to noteB, not noteA; noteD is relative to noteC, not noteB or noteA.
The \voiceXXX commands set the direction of stems, slurs, ties, articulations, text annota-
tions, augmentation dots of dotted notes, and fingerings. \voiceOne and \voiceThree make
these objects point upwards, while \voiceTwo and \voiceFour make them point downwards.
The command \oneVoice will revert back to the normal setting.
An expression that appears directly inside a << >> belongs to the main voice. This is useful
when extra voices appear while the main voice is playing. Here is a more correct rendition of the
example from the previous section. The crossed noteheads demonstrate that the main melody
is now in a single voice context.
\new Staff \relative c' {
\override NoteHead #'style = #'cross
c16 d e f
\voiceOne
<<
{ g4 f e | d2 e2 }
\new Voice="1" { \voiceTwo
r8 e4 d c8 ~ | c8 b16 a b8 g ~ g2
\oneVoice
}
\new Voice { \voiceThree
s2. | s4 b4 c2
\oneVoice
}
>>
\oneVoice
}
Avoiding the \\ separator also allows nesting polyphony constructs, which in some case might
be a more natural way to typeset the music.
\new Staff \relative c' {
c16^( d e f
\voiceOne
<<
{ g4 f e | d2 e2) }
\context Voice="1" { \voiceTwo
r8 e4 d c8 ~ |
<<
{c8 b16 a b8 g ~ g2}
\new Voice { \voiceThree
s4 b4 c2
\oneVoice
}
>>
\oneVoice
}
>>
\oneVoice
}
In some instances of complex polyphonic music, you may need additional voices to avoid
collisions between notes. Additional voices are added by defining an identifier, as shown below:
voiceFive = #(context-spec-music (make-voice-props-set 4) 'Voice)
Similarly, you can merge half note heads with eighth notes, by setting merge-differently-
headed:
\new Voice << {
c8 c4.
\override Staff.NoteCollision
#'merge-differently-headed = ##t
c8 c4. } \\ { c2 c2 } >>
>>
Predefined commands
\oneVoice, \voiceOne, \voiceTwo, \voiceThree, \voiceFour.
\shiftOn, \shiftOnn, \shiftOnnn, \shiftOff: these commands specify the degree to which
chords of the current voice should be shifted. The outer voices (normally: voice one and
two) have \shiftOff, while the inner voices (three and four) have \shiftOn. \shiftOnn and
\shiftOnnn define further shift levels.
When LilyPond cannot cope, the force-hshift property of the NoteColumn object and
pitched rests can be used to override typesetting decisions.
\relative <<
{
<d g>
<d g>
} \\ {
<b f'>
\once \override NoteColumn #'force-hshift = #1.7
<b f'>
} >>
See also
Program reference: the objects responsible for resolving collisions are NoteCollision and
RestCollision.
Examples: 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.
Bugs
When using merge-differently-headed with an upstem eighth or a shorter note, and a down-
stem 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 Section 8.4.4 [Clusters], page 205).
Chapter 6: Basic notation 76
6.4.1 Clef
The clef indicates which lines of the staff correspond to which pitches. The clef is set with the
\clef command
{ c''2 \clef alto g'2 }
Clef Position
treble, violin, G, G2 G clef on 2nd line
alto, C C clef on 3rd line
tenor C clef on 4th line.
bass, F F clef on 4th line
french G clef on 1st line, so-called French violin clef
soprano C clef on 1st line
mezzosoprano C clef on 2nd line
baritone C clef on 5th line
varbaritone F clef on 3rd line
subbass F clef on 5th line
percussion percussion clef
tab tablature clef
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
8
8
See also
Manual: Section 6.5.7 [Grace notes], page 91.
Program reference: Clef.
\key d \major
a b cis d
\key g \minor
a bes c d
\set Staff.printKeyCancellation = ##f
\key d \major
a b cis d
\key g \minor
a bes c d
4
See also
Program reference: KeyCancellation, KeySignature.
4 4
2 3
4
4
2
2
Chapter 6: Basic notation 79
There are many more options for its layout. See Section 7.7.6 [Ancient time signatures],
page 152 for more examples.
\time 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 combina-
tion 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 {
\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
}
\layout {
\context {
\Staff
\consists "Measure_grouping_engraver"
}
}
}
5
8 8
9
See also
Program reference: TimeSignature, and Timing_translator.
Examples: input/test/compound-time.ly.
Bugs
Automatic beaming does not use the measure grouping specified with set-time-signature.
Chapter 6: Basic notation 80
Bugs
This command does not take into account grace notes at the start of the music. When a piece
starts with graces notes in the pickup, then the \partial should follow the grace notes
\grace f16
\partial 4
g4
a2 g2
\partial is only intended to be used at the beginning of a piece. If you use it after the
beginning, some odd warnings may occur.
| |: || :| .| .|.
Chapter 6: Basic notation 81
broken ||:
5
In addition, you can specify "||:", which is equivalent to "|:" except at line breaks, where
it gives a double bar line at the end of the line and a start repeat at the beginning of the next
line.
To allow a line break where there is no visible bar line, use
\bar ""
This will insert an invisible bar line and allow line breaks at this point (without increasing the
bar number counter).
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, PianoStaff, or
ChoirStaff.
<<
\new StaffGroup <<
\new Staff {
e'4 d'
\bar "||"
f' e'
}
\new Staff { \clef bass c4 g e g }
>>
\new Staff { \clef bass c2 c2 }
>>
See also
In this manual: Section 6.7 [Repeats], page 103, Section 6.4.7 [System start delimiters], page 82.
Program reference: BarLine (created at Staff level), SpanBar (across staves).
Chapter 6: Basic notation 82
Bugs
LilyPond will only insert line breaks and page breaks at a barline. Unless the unmetered music
ends before the end of the staff line, you will need to insert invisible bar lines
\bar ""
to indicate where breaks can occur.
The group is started with a bracket, and bar lines are connected. This is done with the
StaffGroup context
\new StaffGroup
\relative <<
\new Staff { c1 c }
\new Staff { c c }
>>
Chapter 6: Basic notation 83
The group is started with a bracket, but bar lines are not connected. This is done with the
ChoirStaff context.
\new ChoirStaff
\relative <<
\new Staff { c1 c }
\new Staff { c c }
>>
The group is started with a vertical line. Bar lines are not connected. This is the default
for the score.
\relative <<
\new Staff { c1 c }
\new Staff { c c }
>>
See also
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.
\new Staff { c1 }
>>
In combination with Frenched staves, this may be used to typeset ossia sections. An example
is shown here
ossia
42
Chapter 6: Basic notation 85
See also
Program reference: StaffSymbol.
Examples: input/test/staff-lines.ly, input/test/ossia.ly, input/test/staff
-size.ly, input/regression/staff-line-positions.ly.
2
This works quite well for piano music
music = {
\key c \major
\time 4/4
\parallelMusic #'(voiceA voiceB voiceC voiceD) {
% Bar 1
r8 g'16[ c''] e''[ g' c'' e''] r8 g'16[ c''] e''[ g' c''
e''] |
c'2 c'2 |
r8 a16[ d'] f'[ a d' f'] r8 a16[ d'] f'[ a d' f'] |
c2 c2 |
% Bar 2
a'8 b' c'' d'' e'' f'' g'' a'' |
d'4 d' d' d' |
c16 d e f d e f g e f g a f g a b |
a,4 a,4 a,4 a,4 |
Chapter 6: Basic notation 86
% Bar 3 ...
}
}
\score {
\new PianoStaff <<
\music
\new Staff <<
\voiceA \\
\voiceB
>>
\new Staff {
\clef bass
<<
\voiceC \\
\voiceD
>>
}
>>
}
6.5.1 Ties
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. Chords may be partially tied by placing the tie
inside the chord,
<c~ e g~ b> <c e g b>
Chapter 6: Basic notation 87
A tie is just a way of extending a note duration, similar to the augmentation dot. The
following example shows two ways of notating exactly the same concept
43
Ties are used either when the note crosses a bar line, or when dots cannot be used to denote the
rhythm. When using ties, larger note values should be aligned to subdivisions of the measure,
such as
not
If you need to tie a lot of notes over bars, it may be easier to use automatic note splitting
(see Section 6.2.7 [Automatic note splitting], page 69). This mechanism automatically splits
long notes, and ties them across bar lines.
When a second alternative of a repeat starts with a tied note, you have to repeat the tie.
This can be achieved with \repeatTie,
Ties may be engraved manually by changing the tie-configuration property. The first
number indicates the distance from the center of the staff in staff-spaces, and the second number
indicates the direction (1=up, -1=down).
Chapter 6: Basic notation 88
Predefined commands
\tieUp, \tieDown, \tieNeutral, \tieDotted, \tieDashed, \tieSolid.
See also
In this manual: Section 6.2.7 [Automatic note splitting], page 69.
Program reference: Tie.
Examples: input/regression/tie-arpeggio.ly input/regression/tie-manual.ly
Bugs
Switching staves when a tie is active will not produce a slanted tie.
Changing clefs or octavations during a tie is not really well-defined. In these cases, a slur
may be preferable.
6.5.2 Slurs
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)
The direction of a slur can be specified with \slurDIR , where DIR is either Up, Down, or
Neutral (automatically selected).
However, there is a convenient shorthand for forcing slur directions. By adding _ or ^ before
the opening parentheses, the direction is also set. For example,
c4_( c) c^( c)
Only one slur can be printed at once. If you need to print a long slur over a few small slurs,
please see Section 6.5.3 [Phrasing slurs], page 89.
Chapter 6: Basic notation 89
Predefined commands
\slurUp, \slurDown, \slurNeutral, \slurDashed, \slurDotted, \slurSolid.
See also
Program reference: internals document, Slur.
46
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, use
\phrasingSlurUp, \phrasingSlurDown, and \phrasingSlurNeutral.
You cannot have simultaneous phrasing slurs.
Predefined commands
\phrasingSlurUp, \phrasingSlurDown, \phrasingSlurNeutral.
See also
Program reference: PhrasingSlur.
Chapter 6: Basic notation 90
See also
Program reference: LaissezVibrerTie LaissezVibrerTieColumn
Example files: input/regression/laissez-vibrer-tie.ly
2 6
4 8
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. See Section 9.1.2 [Setting
automatic beam behavior], page 215 for details.
Individual notes may be marked with \noBeam to prevent them from being beamed
\time 2/4 c8 c\noBeam c c
2
4
See also
Program reference: Beam.
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]
For more information about make-moment, see Section 8.4.2 [Time administration], page 203.
Line breaks are normally forbidden when beams cross bar lines. This behavior can be changed
by setting allowBeamBreak.
Bugs
Kneed beams are inserted automatically when a large gap is detected between the note heads.
This behavior can be tuned through the object.
Automatically kneed cross-staff beams cannot be used together with hidden staves. See
Section 8.3.2 [Hiding staves], page 197.
Beams do not avoid collisions with symbols around the notes, such as texts and accidentals.
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.
Chapter 6: Basic notation 92
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 timing. 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
(0,0) ( 1 , -1 ) ( 1 , 0 ) ( 2 , -1 ) ( 2 , -1 ) ( 2 , 0 )
4 16 4 4 8 4 16 4
The placement of grace notes is synchronized between different staves. In the following
example, there are two sixteenth grace notes for every eighth grace note
<< \new Staff { e4 \grace { c16[ d e f] } e4 }
\new Staff { c4 \grace { g8[ b] } c4 } >>
If you want to end a note with a grace, use the \afterGrace command. It takes two
arguments: the main note, and the grace notes following the main note.
c1 \afterGrace d1 { c16[ d] } c4
This will put the grace notes after a space lasting 3/4 of the length of the main note. The
fraction 3/4 can be changed by setting afterGraceFraction, ie.
afterGraceFraction = #(cons 7 8)
will put the grace note at 7/8 of the main note.
The same effect can be achieved manually by doing
\new Voice {
<< { d1^\trill_( }
{ s2 \grace { c16[ d] } } >>
c4)
Chapter 6: Basic notation 93
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 {
\stemDown
f16->
\stemNeutral
}
g4
}
Chapter 6: Basic notation 94
See also
Program reference: GraceMusic.
Bugs
A score that starts with a \grace section needs an explicit \new Voice declaration, otherwise
the main note and the 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 of the corresponding durations in the other staves.
For the above example
\new Staff { c4 \bar "|:" \grace s16 d4 }
Grace sections should only be used within sequential music expressions. Nesting or juxta-
posing grace sections is not supported, and might produce crashes or other errors.
6.6.1 Articulations
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
c-. c-- c-+ c-| c-> c-^ c-_
The meanings of these shorthands can be changed. See ly/script-init.ly for examples.
The script is automatically placed, but the direction can be forced as well. Like other pieces
of LilyPond code, _ will place them below the staff, and ^ will place them above.
c''4^^ c''4_^
Chapter 6: Basic notation 95
Other symbols can be added using the syntax note\name. Again, they can be forced up or
down using ^ and _, e.g.,
c\fermata c^\fermata c_\fermata
Here is a chart showing all scripts available,
accent marcato staccatissimo espressivo
staccato tenuto portato upbow downbow
flageolet thumb lheel rheel ltoe
rtoe open stopped turn reverseturn
trill prall mordent prallprall prallmordent
upprall downprall upmordent downmordent
Chapter 6: Basic notation 96
pralldown prallup lineprall signumcongruentiae
shortfermata fermata longfermata verylongfermata
segno coda varcoda
See also
Program reference: Script.
Bugs
These signs appear in the printed output but have no effect on the MIDI rendering of the music.
1 2 3 4 2-3
Chapter 6: Basic notation 97
You can use the thumb-script to indicate that a note should be played with the thumb (e.g.,
in cello music)
<a_\thumb a'-3>8 <b_\thumb b'-3>
3 3
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
5
3
2
1
425
5
42
1 1
Using this feature, it is also possible to put fingering instructions very close to note heads in
monophonic music,
\set fingeringOrientations = #'(right)
<es'-2>4
2
See also
Program reference: Fingering.
Examples: input/regression/finger-chords.ly.
Chapter 6: Basic notation 98
6.6.3 Dynamics
Absolute dynamic marks are specified using a command after a note c4\ff. The available
dynamic marks are \ppppp, \pppp, \ppp, \pp, \p, \mp, \mf, \f, \ff, \fff, \ffff, \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\fp c\sf c\sff c\sp c\spp c\sfz c\rfz
ppppp p mp mf f fffff fp sf sff sp spp sfz rfz
A crescendo mark is started with \< and terminated with \! or an absolute dynamic. A
decrescendo is started with \> and is also terminated with \! or an absolute dynamic. \cr and
\decr may be used instead of \< and \>. Because these marks are bound to notes, you must
use spacer notes if multiple marks are needed during one note
c\< c\! d\> e\!
<< f1 { s4 s4\< s4\! \> s4\! } >>
A hairpin normally starts at the left edge of the beginning note and ends on the right edge of
the ending note. If the ending note falls on the downbeat, the hairpin ends on the immediately
preceding barline. This may be modified by setting the hairpinToBarline property,
\set hairpinToBarline = ##f
c4\< c2. c4\!
In some situations the \espressivo articulation mark may be suitable to indicate a crescendo
and decrescendo on the one note,
c2 b4 a g1\espressivo
This may give rise to very short hairpins. Use minimum-length in Voice.Hairpin to lengthen
them, for example
\override Voice.Hairpin #'minimum-length = #5
Hairpins may be printed with a circled tip (al niente notation) by setting the circled-tip
property,
Chapter 6: Basic notation 99
cresc. decr. dim.
cresc. poco mf
To create new dynamic marks or text that should be aligned with dynamics, see Section 8.1.8
[New dynamic marks], page 184.
Predefined commands
\dynamicUp, \dynamicDown, \dynamicNeutral.
See also
Program reference: DynamicText, Hairpin. Vertical positioning of these symbols is handled by
DynamicLineSpanner.
See also
Program reference: BreathingSign.
Examples: input/regression/breathing-sign.ly.
6.6.5 Trills
Short trills are printed like normal articulation; see Section 6.6.1 [Articulations], page 94.
Long running trills are made with \startTrillSpan and \stopTrillSpan,
\new Voice {
<< { c1 \startTrillSpan }
{ s2. \grace { d16[\stopTrillSpan e] } } >>
c4 }
Chapter 6: Basic notation 101
Trills that should be executed on an explicitly specified pitch can be typeset with the com-
mand pitchedTrill,
\pitchedTrill c4\startTrillSpan fis
f\stopTrillSpan
The first argument is the main note. The pitch of the second is printed as a stemless note
head in parentheses.
Predefined commands
\startTrillSpan, \stopTrillSpan.
See also
Program reference: TrillSpanner.
6.6.6 Glissando
A glissando is a smooth change in pitch. It is denoted by a line or a wavy line between two
notes. It is requested by attaching \glissando to a note
c2\glissando c'
\override Glissando #'style = #'zigzag
c2\glissando c,
See also
Program reference: Glissando.
Example files: input/regression/glissando.ly.
Bugs
Printing text over the line (such as gliss.) is not supported.
6.6.7 Arpeggio
You can specify an arpeggio sign (also known as broken chord) on a chord by attaching an
\arpeggio to a chord
<c e g c>\arpeggio
Chapter 6: Basic notation 102
A square bracket on the left indicates that the player should not arpeggiate the chord
\arpeggioBracket
<c' e g c>\arpeggio
The direction of the arpeggio is sometimes denoted by adding an arrowhead to the wiggly
line
\new Voice {
\arpeggioUp
<c e g c>\arpeggio
\arpeggioDown
<c e g c>\arpeggio
}
Predefined commands
\arpeggio, \arpeggioUp, \arpeggioDown, \arpeggioNeutral, \arpeggioBracket.
See also
Notation manual: Section 6.5.1 [Ties], page 86, for writing out arpeggios.
Program reference: Arpeggio.
Chapter 6: Basic notation 103
Bugs
It is not possible to mix connected arpeggios and unconnected arpeggios in one PianoStaff at
the same point in time.
6.7 Repeats
Repetition is a central concept in music, and multiple notations exist for repetitions.
Chapter 6: Basic notation 104
1. 2.
In the following example, the first ending is not a complete bar (it only had 3 beats). The
beginning of the second ending contains the 4th beat from the first ending. This extra beat
in the second ending is due to the first time ending, and has nothing to do with the \partial
at the beginning of the example.
\new Staff {
\partial 4
\repeat volta 4 { e | c2 d2 | e2 f2 | }
\alternative { { g4 g g } { a | a a a a | b2. } }
}
1.--3. 4.
Ties may be added to a second ending,
c1
\repeat volta 2 {c4 d e f ~ }
\alternative { {f2 d} {f\repeatTie f,} }
1. 2.
It is possible to shorten volta brackets by setting voltaSpannerDuration. In the next ex-
ample, the bracket only lasts one measure, which is a duration of 3/4.
\relative c''{
\time 3/4
c c c
\set Staff.voltaSpannerDuration = #(ly:make-moment 3 4)
\repeat "volta" 5 { d d d }
\alternative { { e e e f f f }
{ g g g } }
}
1.--4. 5.
43
Chapter 6: Basic notation 105
See also
Examples:
Brackets for the repeat are normally only printed over the topmost staff. This can be adjusted
by setting the voltaOnThisStaff property; see input/regression/volta-multi-staff.ly.
Bugs
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.
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.
Volta brackets are not vertically aligned.
When creating a score file using \unfoldRepeats for MIDI, it is necessary to make two
\score blocks: one for MIDI (with unfolded repeats) and one for notation (with volta, tremolo,
and percent repeats). For example,
\score {
..music..
\layout { .. }
}
Chapter 6: Basic notation 106
\score {
\unfoldRepeats ..music..
\midi { .. }
}
start-repeat
Print a |: bar line.
end-repeat
Print a :| bar line.
(volta text )
Print a volta bracket saying text: The text can be specified as a text string or as
a markup text, see Section 8.1.4 [Text markup], page 170. Do not forget to change
the font, as the default number font does not contain alphabetic characters;
(volta #f)
Stop a running volta bracket.
c4
\set Score.repeatCommands = #'((volta "93") end-repeat)
c4 c4
\set Score.repeatCommands = #'((volta #f))
c4 c4
93
See also
Program reference: VoltaBracket, RepeatedMusic, VoltaRepeatedMusic,
UnfoldedRepeatedMusic, and FoldedRepeatedMusic.
Chapter 6: Basic notation 107
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
Similar output is obtained using the tremolo subdivision, described in Section 6.7.6 [Tremolo
subdivisions], page 107.
See also
In this manual: Section 6.7.6 [Tremolo subdivisions], page 107, Section 6.7 [Repeats], page 103.
Program reference: Beam, StemTremolo.
Example files: input/regression/chord-tremolo.ly, input/regression/stem
-tremolo.ly.
Bugs
Tremolos entered in this way do not carry over into the MIDI output.
See also
In this manual: Section 6.7.5 [Tremolo repeats], page 106.
Elsewhere: StemTremolo.
Chapter 6: Basic notation 108
Measure repeats of more than 2 measures get a counter, if you switch on the
countPercentRepeats property,
\new Voice {
\set countPercentRepeats = ##t
\repeat "percent" 4 { c1 }
}
2 3 4
Isolated percents can also be printed. This is done by putting a multi-measure rest with a
different print function,
\override MultiMeasureRest #'stencil
= #ly:multi-measure-rest::percent
R1
See also
Program reference: RepeatSlash, PercentRepeat, DoublePercentRepeat,
DoublePercentRepeatCounter, PercentRepeatCounter, PercentRepeatedMusic.
Chapter 7: Instrument-specific notation 109
7 Instrument-specific notation
This chapter explains how to use notation for specific instruments.
Bugs
Dynamics are not centered, but workarounds do exist. See the piano centered dynamics
template in Section D.2 [Piano templates], page 320.
The distance between the two staves is the same for all systems in the score. It is possible
to override this per system, but it does require an arcane command incantation. See input/
test/piano-staff-distance.ly.
See also
In this manual: Section 7.1.2 [Manual staff switches], page 110.
Program reference: AutoChangeMusic.
Chapter 7: Instrument-specific notation 110
Bugs
The staff switches may not end up in optimal places. For high quality output, staff switches
should be specified manually.
\autochange cannot be inside \times.
7.1.3 Pedals
Pianos have pedals that alter the way sound is 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 pedalX Strings, 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 "|."
Chapter 7: Instrument-specific notation 111
A third style of pedal notation is a mixture of text and brackets, obtained by setting the
pedalSustainStyle 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
Sost. Ped.
For fine-tuning 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 right edge of the
note head
\override Staff.PianoPedalBracket #'shorten-pair = #'(0 . -1.0)
c\sostenutoDown d e c, f g a\sostenutoUp
Sost. Ped.
See also
In this manual: Section 6.5.4 [Laissez vibrer ties], page 89
See also
Program reference: VoiceFollower.
Predefined commands
\showStaffSwitch, \hideStaffSwitch.
<c e g>
<f bes c'>
<f bes d'>
}
sus4
sus4 6/sus4
C F B /F C F F
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.
Note that the duration of chords must be specified outside the <>.
<c e g>2
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
\chordmode { c:3 c:5 c:6 c:7 c:8 c:9 c:10 c:11 }
Chapter 7: Instrument-specific notation 114
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
\chordmode { c:5.6 c:3.7.8 c:3.6.13 }
Removals are specified similarly and are introduced by a caret. They must come after the
additions
\chordmode { c^3 c:7^5 c:9^3.5 }
Modifiers can be used to change pitches. The following modifiers are supported
m The minor chord. This modifier lowers the 3rd and (if present) the 7th step.
dim The diminished chord. This modifier lowers the 3rd, 5th and (if present) the 7th
step.
aug The augmented chord. This modifier raises the 5th step.
maj The major 7th chord. This modifier raises the 7th step if present.
sus The suspended 4th or 2nd. This modifier removes the 3rd step. Append either 2 or
4 to add the 2nd or 4th step to the chord.
Modifiers can be mixed with additions
\chordmode { 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)
\chordmode { c:13 c:13.11 c:m13 }
Chapter 7: Instrument-specific notation 115
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
\chordmode { c1 c/g c/f }
A bass note can be added instead of transposed out of the chord, by using /+pitch.
\chordmode { c1 c/+g c/+f }
Chords is a mode similar to \lyricmode, 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.
Bugs
Each step can only be present in a chord once. The following simply produces the augmented
chord, since 5+ is interpreted last
\chordmode { c:5.5-.5+ }
A B C Dm Em
Chapter 7: Instrument-specific notation 116
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
harmonies = \chordmode {
c1:m c:m \break c:m c:m d
}
<<
\new ChordNames {
\set chordChanges = ##t
\harmonies }
\new Staff \transpose c c' \harmonies
>>
Cm
Cm D
3
The previous examples all show chords over a staff. This is not necessary. Chords may
also be printed separately. It may be necessary to add Volta_engraver and Bar_engraver for
showing repeats.
\new ChordNames \with {
\override BarLine #'bar-size = #4
voltaOnThisStaff = ##t
\consists Bar_engraver
\consists "Volta_engraver"
}
\chordmode { \repeat volta 2 {
f1:maj7 f:7 bes:7
c:maj7
} \alternative {
es e
}
}
1. 2.
7
F F B 7 C E E
The default chord name layout is a system for Jazz music, proposed by Klaus Ignatzek (see
Appendix A [Literature list], page 309). It can be tuned through the following properties
Chapter 7: Instrument-specific notation 117
chordNameExceptions
This is a list that contains the chords that have special formatting.
The exceptions list should be encoded as
{ <c f g bes>1 \markup { \super "7" "wahh" } }
To get this information into chordNameExceptions takes a little manoeuvring. The
following code transforms chExceptionMusic (which is a sequential music) into a
list of exceptions.
(sequential-music-to-chord-exceptions chExceptionMusic #t)
Then,
(append
(sequential-music-to-chord-exceptions chExceptionMusic #t)
ignatzekExceptions)
adds the new exceptions to the default ones, which are defined in ly/chord
-modifier-init.ly.
For an example of tuning this property, see also input/regression/chord-name
-exceptions.ly.
majorSevenSymbol
This property contains the markup object used for the 7th step, when it is ma-
jor. Predefined options are whiteTriangleMarkup and blackTriangleMarkup. See
input/regression/chord-name-major7.ly for an example.
chordNameSeparator
Different parts of a chord name are normally separated by a slash. By setting
chordNameSeparator, you can specify other separators, e.g.,
\new ChordNames \chordmode {
c:7sus4
\set chordNameSeparator
= \markup { \typewriter "|" }
c:7sus4
}
7/sus4 7|sus4
C C
chordRootNamer
The root of a chord is usually printed as a letter with an optional alteration. The
transformation from pitch to letter is done by this function. Special note names (for
example, the German H for a B-chord) can be produced by storing a new function
in this property.
chordNoteNamer
The default is to print single pitch, e.g., the bass note, using the 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.
chordPrefixSpacer
The m for minor chords is usually printed right after the root of the chord. By
setting chordPrefixSpacer, you can fix a spacer between the root and m. The
spacer is not used when the root is altered.
The predefined variables \germanChords, \semiGermanChords, \italianChords and
\frenchChords set these variables. The effect is demonstrated here,
Chapter 7: Instrument-specific notation 118
B /B
default E/D Cm B/B B /B
german E/d Cm H/h H /his B/b
Si /Si Si /Si
semi-german E/d Cm H/h H /his B /b
Si /Si Si /Si
italian Mi/Re Do m Si/Si
Mi/R Do m Si/Si
french
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 Section C.1 [Chord name chart], page 312. Turning on these styles is described in the
input file input/test/chord-names-jazz.ly.
Predefined commands
\germanChords, \semiGermanChords. \italianChords. \frenchChords.
See also
Examples: input/regression/chord-name-major7.ly, input/regression/chord-name
-exceptions.ly, input/test/chord-names-jazz.ly.
Init files: scm/chords-ignatzek.scm, and scm/chord-entry.scm.
Bugs
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.
43
play the game
43
play the game
speel het spel
joue le jeu
The command \addlyrics cannot handle polyphony settings. For these cases you should
use \lyricsto and \lyricmode.
\lyricmode { twinkle}
Similarly, a period which follows an alphabetic sequence is included in the resulting string. As
a consequence, spaces must be inserted around property commands
\override Score . LyricText #'font-shape = #'italic
In order to assign more than one syllable to a single note, you can surround them with quotes
or use a _ character, to get spaces between syllables, or use tilde symbol (~) to get a lyric tie.
\time 3/4
\relative { c2 e4 g2 e4 }
\addlyrics { gran- de_a- mi- go }
\addlyrics { pu- "ro y ho-" nes- to }
\addlyrics { pu- ro~y~ho- nes- to }
43
gran- de a- mi- go
pu- ro y ho- nes- to
pu- royho- nes- to
The lyric ties is implemented with the Unicode character U+203F, so be sure to have a font
(Like DejaVuLGC) installed that includes this glyph.
To enter lyrics with characters from non-English languages, or with accented and special
characters (such as the heart symbol or slanted quotes), simply insert the characters directly
into the input file and save it with utf-8 encoding. See Section 10.1.7 [Text encoding], page 238
for more info.
\relative { e4 f e d e f e2 }
\addlyrics { He said: Let my peo ple go . }
He said: Let my peo ple go.
To use normal quotes in lyrics, add a backslash before the quotes. For example,
\relative c' { \time 3/4 e4 e4. e8 d4 e d c2. }
\addlyrics { "\"I" am so lone- "ly\"" said she }
3
4
"I am so lone- ly" said she
The full definition of a word start in Lyrics mode is somewhat more complex.
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 ^.
To define indentifiers containing lyrics, the function lyricmode must be used.
Chapter 7: Instrument-specific notation 121
See also
Program reference: LyricText, LyricSpace.
See also
Program reference: LyricHyphen, LyricExtender.
\new Lyrics \lyricsto "one" { No more let sins and sor -- rows grow. }
>>
42
Joy to the world! the Lord is come.
Joy to the earth! the Sa viour
No more let sins and sor rows grow.
reigns.
The second stanza is not properly aligned because the durations were not specified. A solution
for that would be to use \lyricsto.
The \addlyrics command is actually just a convenient way to write a more complicated
LilyPond structure that sets up the lyrics.
{ MUSIC }
\addlyrics { LYRICS }
is the same as
\new Voice = "blah" { music }
\new Lyrics \lyricsto "blah" { LYRICS }
For different or more complex orderings, the best way is to setup the hierarchy of staves and
lyrics first, e.g.,
\new ChoirStaff <<
\new Voice = "soprano" { music }
\new Lyrics = "sopranoLyrics" { s1 }
\new Lyrics = "tenorLyrics" { s1 }
\new Voice = "tenor" { music }
>>
and then combine the appropriate melodies and lyric lines
\context Lyrics = sopranoLyrics \lyricsto "soprano"
the lyrics
The final input would resemble
<<\new ChoirStaff << setup the music >>
\lyricsto "soprano" etc
\lyricsto "alto" etc
etc
>>
See also
Program reference: LyricCombineMusic, Lyrics.
Chapter 7: Instrument-specific notation 123
7.3.5 Melismata
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.,
<<
\new Voice = "lala" {
\time 3/4
f4 g8
\melisma
f e f
\melismaEnd
e2
}
\new Lyrics \lyricsto "lala" {
la di __ daah
}
>>
4
3
la di daah
In addition, notes are considered a melisma if they are manually beamed, and automatic
beaming (see Section 9.1.2 [Setting automatic beam behavior], page 215) is switched off.
A complete example of a SATB score setup is in section Section D.4 [Vocal ensembles],
page 329.
Predefined commands
\melisma, \melismaEnd
See also
Program reference: Melisma_translator.
input/regression/lyric-combine-new.ly.
Bugs
Melismata are not detected automatically, and extender lines must be inserted by hand.
43
play the game
more slow ly
go fas ter still
Chapter 7: Instrument-specific notation 125
The ignoreMelismata applies to the syllable fas, so it should be entered before go.
The reverse is also possible: making a lyric line slower than the standard. This can be
achieved by insert \skips into the lyrics. For every \skip, the text will be delayed another
note. For example,
\relative { c c g' }
\addlyrics {
twin -- \skip 4
kle
}
twin kle
we shall not o- ver- come
will
You can use this trick to display different lyrics for a repeated section.
\score{ <<
\new Voice = "melody" \relative c' {
c2 e | g e | c1 |
\new Voice = "verse" \repeat volta 2 {c4 d e f | g1 | }
a2 b | c1}
\new Lyrics = "mainlyrics" \lyricsto melody \lyricmode {
do mi sol mi do
la si do }
Chapter 7: Instrument-specific notation 126
do mi sol mi do do re mi fa sol
dodo rere mimi fafa solsol
6
la si do
3
Ju ras sic Park
Ty ran no sau rus Rex
the text for the first stanza is set to a melody called lahlah,
\new Lyrics \lyricsto "lahlah" {
Ju -- ras -- sic Park
}
The second stanza initially is set to the lahlah context, but for the syllable ran, it switches
to a different melody. This is achieved with
\set associatedVoice = alternative
Here, alternative is the name of the Voice context containing the triplet.
Again, the command must be one syllable too early, before Ty in this case.
\new Lyrics \lyricsto "lahlah" {
\set associatedVoice = alternative % applies to "ran"
Ty --
ran --
no --
\set associatedVoice = lahlah % applies to "rus"
sau -- rus Rex
}
The underlay is switched back to the starting situation by assigning lahlah to associatedVoice.
Chapter 7: Instrument-specific notation 127
Ky ri e
In this case, you can also have ties and slurs in the melody if you set melismaBusyProperties,
as is done in the example above.
<<
\new Staff \keepWithTag #'music \voice
\new Devnull="nowhere" \keepWithTag #'lyricrhythm \voice
\new Lyrics \lyricsto "nowhere" \lyr
\new Staff { c'8 c' c' c' c' c' c' c'
c' c' c' c' c' c' c' c' }
>>
I like my cat!
{
c c c c
\override Lyrics.LyricSpace #'minimum-distance = #1.0
c c c c
}
\addlyrics {
longtext longtext longtext longtext
longtext longtext longtext longtext
}
longtext longtext longtext longtext
longtext longtext longtext longtext
To make this change for all lyrics in the score, set the property in the layout.
\score {
{
c c c c
c c c c
}
\addlyrics {
longtext longtext longtext longtext
longtext longtext longtext longtext
}
\layout {
\context {
\Lyrics
\override LyricSpace #'minimum-distance = #1.0
}
}
}
43
1. Hi, my name is Bert.
2. Oh, che ri, je t'aime
These numbers are put just before the start of the first syllable.
<<
\new Voice = "tune" {
\time 3/4
g'4 c'2
}
\new Lyrics \lyricsto "tune" \text
>>
43
ff 1. Big bang
Chapter 7: Instrument-specific notation 130
43
Bert Hi, my name is Bert.
Ernie Oh, che ri, je t'aime
text = \lyricmode {
\set stanza = "1." Ma- ry had a lit- tle lamb,
its fleece was white as snow.
}
\book{
\score{ <<
\new Voice = "one" { \melody }
\new Lyrics \lyricsto "one" \text
>>
\layout { }
}
\markup { \column{
\line{ Verse 2. }
\line{ All the children laughed and played }
\line{ To see a lamb at school. }
}
}
\markup{
Chapter 7: Instrument-specific notation 131
\wordwrap-string #"
Verse 3.
1. Ma- ry had a lit- tle lamb, its fleece was white as snow.
Verse 2.
All the children laughed and played
To see a lamb at school.
Verse 3.
Mary took it home again,
It was against the rule.
Chapter 7: Instrument-specific notation 133
text = \lyricmode {
\set stanza = "1." This is verse one.
It has two lines.
}
\score{ <<
\new Voice = "one" { \melody }
\new Lyrics \lyricsto "one" \text
>>
\layout { }
}
\markup {
\fill-line {
\hspace #0.1 % moves the column off the left margin; can be removed if
% space on the page is tight
\column {
\line { \bold "2."
\column {
"This is verse two."
"It has two lines."
}
}
\hspace #0.1 % adds vertical spacing between verses
\line { \bold "3."
\column {
"This is verse three."
"It has two lines."
}
}
}
\hspace #0.1 % adds horizontal spacing between columns; if they are
% still too close, add more " " pairs until the result
% looks good
\column {
\line { \bold "4."
\column {
"This is verse four."
"It has two lines."
}
}
\hspace #0.1 % adds vertical spacing between verses
\line { \bold "5."
Chapter 7: Instrument-specific notation 134
\column {
"This is verse five."
"It has two lines."
}
}
}
\hspace #0.1 % gives some extra space on the right margin; can
% be removed if page space is tight
}
}
Chapter 7: Instrument-specific notation 135
See also
Program reference: LyricText, StanzaNumber, VocalName.
7.3.10 Ambitus
The term ambitus denotes a range of pitches for a given voice in a part of music. It may also
denote the pitch range that a musical instrument is capable of playing. Ambits are printed on
vocal parts, so performers can easily determine it meets their capabilities.
Ambits are 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
ambits, add the Ambitus_engraver to the Voice context, for example,
\layout {
\context {
\Voice
\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. Here is an example,
\new Staff \with {
\consists "Ambitus_engraver"
}
<<
\new Voice \with {
\remove "Ambitus_engraver"
} \relative c'' {
\override Ambitus #'X-offset = #-1.0
\voiceOne
c4 a d e f2
}
\new Voice \with {
\remove "Ambitus_engraver"
} \relative c' {
\voiceTwo
es4 f g as b2
}
>>
Chapter 7: Instrument-specific notation 137
See also
Program reference: Ambitus, AmbitusLine, AmbitusNoteHead, AmbitusAccidental.
Examples: input/regression/ambitus.ly.
Bugs
There is no collision handling in the case of multiple per-voice ambitus.
See also
Program reference: RhythmicStaff.
Examples: input/regression/rhythmic-staff.ly.
See also
Program reference: note-event.
There are also other layout possibilities. To use these, set the property drumStyleTable in
context DrumVoice. The following variables have been predefined
drums-style
This is the default. It typesets a typical drum kit on a five-line staff
cymc cyms cymr hh hhc hho hhho hhp
Chapter 7: Instrument-specific notation 139
cb hc bd sn ss tomh tommh
The drum scheme supports six different toms. When there are 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
This typesets timbales on a two line staff
timh ssh timl ssl cb
congas-style
This typesets congas on a two line staff
cgh cgho cghm ssh cgl cglo cglm ssl
bongos-style
This typesets bongos on a two line staff
boh boho bohm ssh bol bolo bolm ssl
percussion-style
To typeset all kinds of simple percussion on one line staves.
tri trio trim gui guis guil cb cl tamb cab mar hc
Chapter 7: Instrument-specific notation 140
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 = \drummode { hh8 hh hh hh hhp4 hhp }
down = \drummode { bd4 sn bd toml8 toml }
See also
Init files: ly/drumpitch-init.ly.
Program reference: DrumStaff, DrumVoice.
Bugs
Because general MIDI does not contain rim shots, the sidestick is used for this purpose instead.
}
>>
Also note that you must add chords (< > brackets) around each \parenthesize statement.
7.5 Guitar
7.5.1 String number indications
String numbers can be added to chords, by indicating the string number with \number,
2
1
See also
Program reference: StringNumber.
0 0
1
2
2
1
2
0
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
Chapter 7: Instrument-specific notation 142
8
1 2
0
2 4 9
9 11 12
See also
Program reference: TabStaff, TabVoice.
Bugs
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.
0
5 2 9
2
5 2 9
LilyPond comes with predefined string tunings for banjo, mandolin, guitar and bass guitar.
\set TabStaff.stringTunings = #bass-tuning
The default string tuning is guitar-tuning (the standard EADGBE tuning). Some other
predefined tunings are guitar-open-g-tuning, mandolin-tuning and banjo-open-g-tuning.
See also
The file scm/output-lib.scm contains the predefined string tunings. Program reference: Tab_
note_heads_engraver.
Bugs
No guitar special effects have been implemented.
Chapter 7: Instrument-specific notation 143
0 0 9 0
0 2
0
0 0
10 5
0
2
0 12 0
See also
The file scm/output-lib.scm contains predefined banjo tunings.
}
c' c' c'
}
XXO X
1 1
iii
2 3 4
1 34211
There are three different fret-diagram markup interfaces: standard, terse, and verbose. The
three interfaces produce equivalent markups, but have varying amounts of information in the
markup string. Details about the markup interfaces are found at Section 8.1.6 [Overview of text
markup commands], page 174.
You can set a number of graphical properties according to your preference. Details about
the property interface to fret diagrams are found at fret-diagram-interface.
See also
Examples: input/test/fret-diagram.ly
ip
for brevity, you can abbreviate \rightHandFinger to something short, for example RH,
#(define RH rightHandFinger)
a
i a
i
p p
Chapter 7: Instrument-specific notation 145
The letters used for the fingerings are contained in the property digit-names, but they
can also be set individually by supplying \rightHandFinger with a string argument, as in the
following example
#(define RH rightHandFinger)
{
\set strokeFingerOrientations = #'(right)
\override StrokeFinger #'digit-names = ##("x" "y" "z" "!" "@")
<c-\RH #5 >4
<c-\RH "@">4
}
@ @
See also
Internalls: StrokeFinger
8 XII
Stopped (X) note heads are used in guitar music to signal a place where the guitarist must play
a certain note or chord, with its fingers just touching the strings instead of fully pressing them.
This gives the sound a percussive noise-like sound that still maintains part of the original pitch.
It is notated with cross noteheads; this is demonstrated in Section 8.4.5 [Special noteheads],
page 205.
7.6 Bagpipe
7.6.1 Bagpipe definitions
LilyPond contains special definitions for music for the Scottish highland bagpipe; to use them,
add
\include "bagpipe.ly"
at the top of your input file. This lets you add the special gracenotes common to bagpipe music
with short commands. For example, you could write \taor instead of
Chapter 7: Instrument-specific notation 146
Bagpipe music nominally uses the key of D Major (even though that isnt really true).
However, since that is the only key that can be used, the key signature is normally not written
out. To set this up correctly, always start your music with \hideKeySignature. If you for some
reason want to show the key signature, you can use \showKeySignature instead.
Some modern music use cross fingering on c and f to flatten those notes. This can be indicated
by cflat or fflat. Similarly, the piobaireachd high g can be written gflat when it occurs in
light music.
\header {
title = "Amazing Grace"
meter = "Hymn"
arranger = "Trad. arr."
}
{
\hideKeySignature
\time 3/4
\grg \partial 4 a8. d16
\slurd d2 \grg f8[ e32 d16.]
\grg f2 \grg f8 e
\thrwd d2 \grg b4
\grG a2 \grg a8. d16
\slurd d2 \grg f8[ e32 d16.]
\grg f2 \grg e8. f16
\dblA A2 \grg A4
\grg A2 f8. A16
\grg A2 \hdblf f8[ e32 d16.]
\grg f2 \grg f8 e
\thrwd d2 \grg b4
\grG a2 \grg a8. d16
\slurd d2 \grg f8[ e32 d16.]
Chapter 7: Instrument-specific notation 147
\grg f2 e4
\thrwd d2.
\slurd d2
\bar "|."
}
Amazing Grace
Hymn Trad. arr.
3
4
See also
Examples: input/regression/note-head-style.ly gives an overview over all available note
head styles.
As shown, not all accidentals are supported by each style. When trying to access an unsup-
ported 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.
See also
In this manual: Section 6.1 [Pitches], page 59, Section 6.1.3 [Cautionary accidentals], page 61
and Section 9.1.1 [Automatic accidentals], page 213 give a general introduction of the use of
accidentals. Section 6.4.2 [Key signature], page 77 gives a general introduction of the use of key
signatures.
Program reference: KeySignature.
Examples: input/test/ancient-accidentals.ly.
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 Section 7.7.9 [Divisiones],
page 155.
See also
In this manual: Section 6.1.9 [Rests], page 64 gives a general introduction into the use of rests.
historic style mensural C clef mensural-c1, mensural-c2,
mensural-c3, mensural-c4
Editio Vaticana style do clef vaticana-do1, vaticana-do2,
vaticana-do3
Chapter 7: Instrument-specific notation 151
See also
In this manual: see Section 6.4.1 [Clef], page 76.
Bugs
The mensural g clef is mapped to the Petrucci g clef.
Chapter 7: Instrument-specific notation 152
Note that the innermost flare of each mensural flag always is vertically aligned with a staff
line.
There is no particular flag style for neo-mensural notation. Hence, when typesetting the
incipit of a transcribed piece of mensural music, the default flag style should be used. There are
no flags in Gregorian Chant notation.
Bugs
The attachment of ancient flags to stems is slightly off due to a change in early 2.3.x.
Vertically aligning each flag with a staff line assumes that stems always end either exactly
on or exactly in the middle between two staff lines. This may not always be true when using
advanced layout features of classical notation (which however are typically out of scope for
mensural notation).
\time 4/4 \time 2/2 \time 6/4 \time 6/8
\time 3/2 \time 3/4 \time 9/4 \time 9/8
\time 4/8 \time 2/4
Chapter 7: Instrument-specific notation 153
Use the style property of grob TimeSignature to select ancient time signatures. Supported
styles are neomensural and mensural. The above table uses the neomensural style. This style
is appropriate for the incipit of transcriptions of mensural pieces. The mensural style mimics
the look of historical printings of the 16th century.
The following examples show the differences in style,
2
2
2
5 single-digit
2
See also
This manual: Section 6.4.3 [Time signature], page 78 gives a general introduction to the use of
time signatures.
Bugs
Ratios of note durations do not change with the time signature. For example, the ratio of 1
brevis = 3 semibrevis (tempus perfectum) must be made by hand, by setting
breveTP = #(ly:make-duration -1 0 3 2)
...
{ c\breveTP f1 }
This sets breveTP to 3/2 times 2 = 3 times a whole note.
The old6/8alt symbol (an alternate symbol for 6/8) is not addressable with \time. Use a
\markup instead
accentus
ictus
circulus
semicirculus
episem
Bugs
Some articulations are vertically placed too closely to the correpsonding note heads.
The episem line is not displayed in many cases. If it is displayed, the right end of the episem
line is often too far to the right.
7.7.8 Custodes
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 thus helping the performer
to manage line breaks during performance.
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 \layout block, as shown in the following example
\layout {
\context {
\Staff
\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
See also
Program reference: Custos.
Examples: input/regression/custos.ly.
7.7.9 Divisiones
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 the breathmarks from Section 6.6.4 [Breath marks], page 100. 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
Predefined commands
\virgula, \caesura, \divisioMinima, \divisioMaior, \divisioMaxima, \finalis.
See also
In this manual: Section 6.6.4 [Breath marks], page 100.
Program reference: BreathingSign.
Examples: input/test/divisiones.ly.
7.7.10 Ligatures
A ligature is a graphical symbol that represents at least two distinct notes. Ligatures originally
appeared in the manuscripts of Gregorian chant notation to denote ascending or descending
sequences of notes.
Ligatures are entered by enclosing them in \[ and \]. Some ligature styles may need addi-
tional input syntax specific for this particular type of ligature. By default, the LigatureBracket
engraver just puts a square bracket above the ligature
\transpose c c' {
\[ g c a f d' \]
a g f
\[ e f a g \]
}
Chapter 7: Instrument-specific notation 156
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.
Bugs
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.
The syntax still uses the deprecated infix style \[ music expr \]. For consistency reasons, it
will eventually be changed to postfix style note\[ ... note\]. Alternatively, the file gregorian
-init.ly can be included; it provides a scheme function
\ligature music expr
with the same effect and is believed to be stable.
Chapter 7: Instrument-specific notation 157
Bugs
Horizontal spacing is poor.
1. Punctum
ab c de f
2. Virga
g
4. Oriscus
j
Chapter 7: Instrument-specific notation 158
13. Climacus
H I J
14. Scandicus
K L M
15. Salicus
N O
16. Trigonus
P
Unlike most other neumes notation systems, the input language for neumes does not reflect
the typographical appearance, but is designed to focus 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 based on 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 \]
g Virga \[ \virga b \]
h Stropha \[ \stropha b \]
j Oriscus \[ \oriscus b \]
Predefined commands
The following head prefixes are supported
\virga, \stropha, \inclinatum, \auctum, \descendens, \ascendens, \oriscus,
\quilisma, \deminutum, \cavum, \linea.
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.
Chapter 7: Instrument-specific notation 162
Two adjacent heads can be tied together with the \pes and \flexa infix commands for a
rising and falling line of melody, respectively.
Use the unary music function \augmentum to add augmentum dots.
Bugs
When an \augmentum dot appears at the end of the last staff within a ligature, it is sometimes
vertically placed wrong. As a workaround, add an additional skip note (e.g. s8) as last note of
the staff.
\augmentum should be implemented as a head prefix rather than a unary music function,
such that \augmentum can be intermixed with head prefixes in arbitrary order.
San- ctus, San- ctus,
San- ctus
\score {
<<
\new MensuralVoice = "discantus" \transpose c c' {
\override Score.BarNumber #'transparent = ##t {
c'1\melisma bes a g\melismaEnd
f\breve
\[ f1\melisma a c'\breve d'\melismaEnd \]
c'\longa
c'\breve\melisma a1 g1\melismaEnd
fis\longa^\signumcongruentiae
}
}
\new Lyrics \lyricsto "discantus" {
San -- ctus, San -- ctus, San -- ctus
}
>>
}
San ctus,
San ctus,
San ctus
Chapter 7: Instrument-specific notation 164
See also
Program reference: Accidental_engraver engraver and the AccidentalSuggestion object.
6 +7 6 6 6 6
5 5
3
The support for figured bass consists of two parts: there is an input mode, introduced
by \figuremode, 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>
4
6
Accidentals are added when you append -, !, and + to the numbers. A plus sign is added
when you append \+, and diminished fifths and sevenths can be obtained with 5/ and 7/.
<4- 6+ 7!> <5++> <3--> <7/> r <6\+ 5/>
4 5 3 7 +6
6
7
5
Spaces may be inserted by using _. Brackets are introduced with [ and ]. You can also
include text strings and text markups, see Section 8.1.6 [Overview of text markup commands],
page 174.
< [4 6] 8 [_! 12] > < 5 \markup { \number 6 \super (1) } >
4 5 (1)
6 6
8
12
Chapter 7: Instrument-specific notation 165
4 3
6 7
In this case, the extender lines always replace existing figures.
The FiguredBass context doesnt pay attention to the actual bass line. As a consequence,
you may have to insert extra figures to get extender lines below all notes, and you may have to
add \! to avoid getting an extender line, e.g.
6 5 6 6
4 5
When using continuation lines, common figures are always put in the same vertical position.
When this is unwanted, you can insert a rest with r. The rest will clear any previous alignment.
For example, you can write
<4 6>8 r8
instead of
<4 6>4
Accidentals and plus signs can appear before or after the numbers, depending on the
figuredBassAlterationDirection and figuredBassPlusDirection properties
+6 5 6 +6 5 6 6+ 5 6 6+ 5 6
4 4 4 4
Although the support for figured bass may superficially resemble chord support, it is much
simpler. The \figuremode 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.
Chapter 7: Instrument-specific notation 166
Figured bass can also be added to Staff contexts directly. In this case, their vertical position
is adjusted automatically.
6
6 4
10
4
Bugs
When using figured bass above the staff with extender lines and implicitBassFigures the lines
may become swapped around. Maintaining order consistently will be impossible when multiple
figures have overlapping extender lines. To avoid this problem, plese use stacking-dir on
BassFigureAlignment.
See also
Program reference: NewBassFigure, BassFigureAlignment, BassFigureLine,
BassFigureBracket, and BassFigureContinuation objects and FiguredBass con-
text.
Chapter 8: Advanced notation 167
8 Advanced notation
This chapter deals with rarely-used and advanced notation.
8.1 Text
This section explains how to include text (with various formatting) in your scores.
To write accented and special text (such as characters from other languages), simply insert
the characters directly into the lilypond file. The file must be saved as UTF-8. For more
information, see Section 10.1.7 [Text encoding], page 238.
longtext
longlongtext
bla bla
The \markup is described in more detail in Section 8.1.4 [Text markup], page 170.
Predefined commands
\fatText, \emptyText.
See also
In this manual: Section 8.1.4 [Text markup], page 170.
Program reference: TextScript.
Chapter 8: Advanced notation 168
rall
4 rit
Predefined commands
\textSpannerUp, \textSpannerDown, \textSpannerNeutral.
See also
Program reference: TextSpanner.
Examples: input/regression/text-spanner.ly.
Chapter 8: Advanced notation 169
\mark is only typeset above the top stave of the score. If you specify the \mark command at a
bar line, the resulting mark is placed above the bar line. If you specify it in the middle of a bar,
the resulting mark is positioned between notes. If it is specified before the beginning of a score
line, it is placed before the first note of the line. Finally, if the mark occurs at a line break, the
mark will be printed at the beginning of the next line. If there is no next line, then the mark
will not be printed at all.
D.S. al Fine
Text marks may be aligned with notation objects other than bar lines,
\relative {
c1
\key cis \major
\clef alto
\override Score.RehearsalMark #'break-align-symbol = #'key-signature
\mark "on key"
cis
\key ces \major
\override Score.RehearsalMark #'break-align-symbol = #'clef
\clef treble
\mark "on clef"
ces
\override Score.RehearsalMark #'break-align-symbol = #'time-signature
\key d \minor
\clef tenor
\time 3/4
\mark "on time"
c
}
on key
3
on clef
4
Chapter 8: Advanced notation 170
4 on time
3
4
Although text marks are normally only printed above the topmost staff, you may alter this
to print them on every staff,
{
\new Score \with {
\remove "Mark_engraver"
}
<<
\new Staff \with {
\consists "Mark_engraver"
}
{ c''1 \mark "foo" c'' }
\new Staff \with {
\consists "Mark_engraver"
}
{ c'1 \mark "foo" c' }
>>
}
foo
foo
See also
Program reference: RehearsalMark.
hello hi there, is anyone home?
hi there \special {weird} #characters
See Section 8.1.6 [Overview of text markup commands], page 174 for a list of all commands.
\markup is primarily used for TextScripts, but it can also be used anywhere text is called
in lilypond
Chapter 8: Advanced notation 171
foo bar!
don't be rit Fine
Alto
solo
bar, foo bar!
A \markup command can also be placed on its own, away from any \score block, see Sec-
tion 10.1.4 [Multiple scores in a book], page 236.
The markup in the example demonstrates font switching commands. The command \bold
and \italic apply to the first following word only; to apply a command to more than one word,
enclose the words with braces,
\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. You can stack expressions grouped vertically with the com-
mand \column. Similarly, \center-align aligns texts by their center lines:
c1^\markup { \column { a bbbb \line { c d } } }
c1^\markup { \center-align { a bbbb c } }
c1^\markup { \line { a b c } }
a a
bbbb bbbb
cd c abc
Lists with no previous command are not kept distinct. The expression
\center-align { { a b } { c d } }
is equivalent to
\center-align { a b c d }
To keep lists of words distinct, please use quotes " or the \line command
\fatText
c4^\markup{ \center-align { on three lines } }
c4^\markup{ \center-align { "all one line" } }
c4^\markup{ \center-align { { on three lines } } }
c4^\markup{ \center-align { \line { on one line } } }
on on
three three
lines all one line lines on one line
Markups can be stored in variables and these variables may be attached to notes, like
allegro = \markup { \bold \large { Allegro } }
{ a^\allegro b c d }
Some objects have alignment procedures of their own, which cancel out any effects of align-
ments applied to their markup arguments as a whole. For example, the RehearsalMark is
horizontally centered, so using \mark \markup { \left-align .. } has no effect.
In addition, vertical placement is performed after creating the text markup object. If you
wish to move an entire piece of markup, you need to use the #padding property or create an
"anchor" point inside the markup (generally with \hspace #0).
Chapter 8: Advanced notation 174
\fatText
c'4^\markup{ \raise #5 "not raised" }
\once \override TextScript #'padding = #3
c'4^\markup{ raised }
c'4^\markup{ \hspace #0 \raise #1.5 raised }
raised
raised
not raised
Some situations (such as dynamic marks) have preset font-related properties. If you are
creating text in such situations, it is advisable to cancel those properties with normal-text.
See Section 8.1.6 [Overview of text markup commands], page 174 for more details.
See also
This manual: Section 8.1.6 [Overview of text markup commands], page 174.
Program reference: TextScript.
Init files: scm/new-markup.scm.
Bugs
Kerning or generation of ligatures is only done when the TEX backend is used. In this case,
LilyPond does not account for them so texts will be spaced slightly too wide.
Syntax errors for markup mode are confusing.
8.1.6 Overview of text markup commands
The following commands can all be used inside \markup { }.
Chapter 8: Advanced notation 175
C 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)
Align arg on its right edge.
\roman arg (markup)
Set font family to roman.
\rotate ang (number) arg (markup)
Rotate object with ang degrees around its center.
\sans arg (markup)
Switch to the sans serif family
\score score (unknown)
Inline an image of music.
\semiflat
Draw a semiflat.
\semisharp
Draw a semi sharp symbol.
Chapter 8: Advanced notation 181
\sesquiflat
Draw a 3/2 flat symbol.
\sesquisharp
Draw a 3/2 sharp symbol.
\sharp
Draw a sharp symbol.
\simple str (string)
A simple text string; \markup { foo } is equivalent with \markup { \simple #"foo"
}.
\slashed-digit num (integer)
A feta number, with slash. This is for use in the context of figured bass notation
\small arg (markup)
Set font size to -1.
\smallCaps text (markup)
Turn text, which should be a string, to small caps.
\markup \smallCaps "Text between double quotes"
\smaller arg (markup)
Decrease the font size relative to current setting
\stencil stil (unknown)
Stencil as markup
\strut
Create a box of the same height as the space in the current font.
\sub arg (markup)
Set arg in subscript.
\super arg (markup)
Raising and lowering texts can be done with \super and \sub:
c1^\markup { E "=" mc \super "2" }
2
E = mc
\teeny arg (markup)
Set font size to -3.
\text arg (markup)
Use a text font instead of music symbol or music alphabet font.
\tied-lyric str (string)
Like simple-markup, but use tie characters for ~ tilde symbols.
\tiny arg (markup)
Set font size to -2.
\translate offset (pair of numbers) arg (markup)
This translates an object. Its first argument is a cons of numbers
Chapter 8: Advanced notation 182
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. If you want to
use a font from outside the style sheet, then set the font-name property,
{
\override Staff.TimeSignature #'font-name = #"Charter"
\override Staff.TimeSignature #'font-size = #2
\time 3/4
c'1_\markup {
\override #'(font-name . "Vera Bold")
{ This text is in Vera Bold }
}
}
3
4
This text is in Vera Bold
Any font can be used, as long as it is available to Pango/FontConfig. To get a full list of all
available fonts, run the command
lilypond -dshow-available-fonts blabla
(the last argument of the command can be anything, but has to be present).
The size of the font may be set with the font-size property. The resulting size is taken
relative to the text-font-size as defined in the \paper block.
It is also possible to change the default font family for the entire document. This is done by
calling the make-pango-font-tree from within the \paper block. The function takes names
for the font families to use for roman, sans serif and monospaced text. For example,
\paper {
myStaffSize = #20
#(define fonts
(make-pango-font-tree "Times New Roman"
"Nimbus Sans"
"Luxi Mono"
(/ myStaffSize 20)))
}
{
c'^\markup { roman: foo \sans bla \typewriter bar }
}
roman: foo bla bar
Chapter 8: Advanced notation 184
See also
Examples: input/regression/font-family-override.ly.
sfzp
It is also possible to print dynamics in round parenthesis or square brackets. These are often
used for adding editorial dynamics.
rndf = \markup{ \center-align {\line { \bold{\italic (}
\dynamic f \bold{\italic )} }} }
boxf = \markup{ \bracket { \dynamic f } }
{ c'1_\rndf c'1_\boxf }
(f) f
8.2 Preparing parts
This section describes various notation that are useful for preparing individual parts.
3 2 17
4
4 4
Chapter 8: Advanced notation 185
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 |
\time 10/8 R4*5*4 |
13 10
2 12 4
43 8 8
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.
If there are only a few measures of rest, LilyPond prints church rests (a series of rectangles)
in the staff. To replace that with a simple rest, use MultiMeasureRest.expand-limit.
\set Score.skipBars = ##t
R1*2 | R1*5 | R1*9
\override MultiMeasureRest #'expand-limit = 1
R1*2 | R1*5 | R1*9
5 9 2
2 5 9
Texts can be added to multi-measure rests by using the note-markup syntax Section 8.1.4
[Text markup], page 170. A variable (\fermataMarkup) is provided for adding fermatas
\set Score.skipBars = ##t
\time 3/4
R2.*10^\markup { \italic "ad lib." }
R2.^\fermataMarkup
10
ad lib.
43
high
low
If you want to have 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
See also
Program reference: MultiMeasureRestMusicGroup, MultiMeasureRest.
The layout object MultiMeasureRestNumber is for the default number, and
MultiMeasureRestText for user specified texts.
Bugs
It is not possible to use fingerings (e.g., R1-4) to put numbers over multi-measure rests. And
the pitch of multi-measure rests (or staff-centered rests) can not be influenced.
There is no way to automatically condense multiple rests into a single multi-measure rest.
Multi-measure rests do not take part in rest collisions.
Be careful when entering multi-measure 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.
= 120
See also
Program reference: MetronomeMark.
Bugs
Collisions are not checked. If you have notes above the top line of the staff (or notes with
articulations, slurs, text, etc), then the metronome marking may be printed on top of musical
symbols. If this occurs, increase the padding of the metronome mark to place it further away
from the staff.
\override Score.MetronomeMark #'padding = #2.5
A B H J
The letter I is skipped in accordance with engraving traditions. If you wish to include the
letter I, then use
\set Score.markFormatter = #format-mark-alphabet
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 = #format-mark-box-numbers
c1 \mark \default
c1 \mark \default
c1
2 3 4
1
Chapter 8: Advanced notation 188
See Section C.4 [The Feta font], page 316 for a list of symbols which may be printed with
\musicglyph.
The horizontal location of rehearsal marks can be adjusted by setting break-align-symbol
c1
\key cis \major
\clef alto
\override Score.RehearsalMark #'break-align-symbol = #'key-signature
\mark "on-key"
cis
\key ces \major
\override Score.RehearsalMark #'break-align-symbol = #'clef
\clef treble
\mark "on clef"
ces
on-key
on clef
break-align-symbol may also accept the following values: ambitus, breathing-sign, clef,
custos, staff-bar, left-edge, key-cancellation, key-signature, and time-signature.
Setting break-align-symbol will only have an effect if the symbol appears at that point in the
music.
Chapter 8: Advanced notation 189
See also
This manual: Section 8.1.3 [Text marks], page 168.
Program reference: 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.
50
Bar numbers may only be printed at bar lines; to print a bar number at the beginning of a
piece, an empty bar line must be added
\set Score.currentBarNumber = #50
\bar ""
\repeat unfold 4 {c4 c c c} \break
\repeat unfold 4 {c4 c c c}
50
54
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
4 8
Chapter 8: Advanced notation 190
Bar numbers can be removed entirely by removing the Bar number engraver from the score.
\layout {
\context {
\Score
\remove "Bar_number_engraver"
}
}
\relative c''{
c4 c c c \break
c4 c c c
}
See also
Program reference: BarNumber.
Examples: input/test/bar-number-every-five-reset.ly, and input/test/bar
-number-regular-interval.ly.
Bugs
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.
Ploink
2
Plk
Chapter 8: Advanced notation 191
You can also use markup texts to construct more complicated instrument names, for example
\set Staff.instrumentName = \markup {
\column { "Clarinetti"
\line { "in B" \smaller \flat } } }
c''1
Clarinetti
in B
If you wish to center the instrument names, you must center all of them
{ <<
\new Staff {
\set Staff.instrumentName = \markup {
\center-align { "Clarinetti"
\line { "in B" \smaller \flat } } }
c''1
}
\new Staff {
\set Staff.instrumentName = \markup{ \center-align { Vibraphone }}
c''1
}
>>
}
Clarinetti
in B
Vibraphone
For longer instrument names, it may be useful to increase the indent setting in the \layout
block.
To center instrument names while leaving extra space to the right,
\new StaffGroup \relative
<<
\new Staff {
\set Staff.instrumentName = \markup { \hcenter-in #10 "blabla" }
c1 c1
}
\new Staff {
\set Staff.instrumentName = \markup { \hcenter-in #10 "blo" }
c1 c1
}
>>
Chapter 8: Advanced notation 192
blabla
blo
To add instrument names to other contexts (such as GrandStaff, ChoirStaff, or
StaffGroup), the engraver must be added to that context.
\layout{
\context {\GrandStaff \consists "Instrument_name_engraver"}
}
More information about adding and removing engravers can be found in Section 9.2.4 [Modifying
context plug-ins], page 222.
Instrument names may be changed in the middle of a piece,
\set Staff.instrumentName = "First"
\set Staff.shortInstrumentName = "one"
c1 c c c \break
c1 c c c \break
\set Staff.instrumentName = "Second"
\set Staff.shortInstrumentName = "two"
c1 c c c \break
c1 c c c \break
First
one
Second
13
two
See also
Program reference: InstrumentName.
Chapter 8: Advanced notation 193
8va
The set-octavation function also takes -1 (for 8va bassa), 2 (for 15ma), and -2 (for 15ma
bassa) as arguments. Internally the function sets the properties ottavation (e.g., to "8va" or
"8vb") and centralCPosition. For overriding the text of the bracket, set ottavation after
invoking set-octavation, i.e.,
Chapter 8: Advanced notation 194
{
#(set-octavation 1)
\set Staff.ottavation = #"8"
c'''
}
8
See also
Program reference: OttavaBracket.
Examples: input/regression/ottava.ly, input/regression/ottava-broken.ly.
Bugs
set-octavation will get confused when clef changes happen during an octavation bracket.
both
4
cue
part
4
cue
score
The arguments of the \tag command should be a symbol (such as #'score or #'part),
followed by a music expression. It is possible to put multiple tags on a piece of music with
multiple \tag entries,
\tag #'original-part \tag #'transposed-part ...
See also
Examples: input/regression/tag-filter.ly.
Bugs
Multiple rests are not merged if you create the score with both tagged sections.
Solo
a2 Solo II
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
printPartCombineTexts to false
Chapter 8: Advanced notation 196
To change the text that is printed for solos or merging, you may set the soloText,
soloIIText, and aDueText properties.
\new Staff <<
\set Score.soloText = #"ichi"
\set Score.soloIIText = #"ni"
\set Score.aDueText = #"tachi"
\partcombine
\relative g' { g4 g a( b) r }
\relative g' { g4 g r r f }
>>
tachi ichi
ni
See also
Program reference: PartCombineMusic.
Bugs
When printPartCombineTexts is set, 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 Voices 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.
Chapter 8: Advanced notation 197
{
\relative c' <<
\new Staff { e4 f g a \break c1 }
\new Staff { c4 d e f \break R1 }
>>
}
The first system shows all staves in full. If empty staves should be removed from the first
system too, set remove-first to true in VerticalAxisGroup.
\override Score.VerticalAxisGroup #'remove-first = ##t
To remove other types of contexts, use \AncientRemoveEmptyStaffContext or
\RemoveEmptyRhythmicStaffContext.
Another application is making ossia sections, i.e., alternative melodies on a separate piece of
staff, with help of a Frenched staff.
{
e'8 f'8 \quoteDuring #"clarinet" { s2 }
}
The type of events that are present in cue notes can be trimmed with the quotedEventTypes
property. The default value is (note-event rest-event), which means that only notes and
rests of the cued voice end up in the \quoteDuring. Setting
\set Staff.quotedEventTypes =
#'(note-event articulation-event dynamic-event)
will quote notes (but no rests), together with scripts and dynamics.
Bugs
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.
Quoting grace notes is broken and can even cause LilyPond to crash.
Quoting nested triplets may result in poor notation.
See also
In this manual: Section 8.2.6 [Instrument transpositions], page 193.
Examples: input/regression/quote.ly input/regression/quote-transposition.ly
Program reference: QuoteMusic.
Chapter 8: Advanced notation 199
\new Voice {
R1*20
\cueDuring #"clarinet" #1 {
R1
}
g4 g2.
}
>>
20
The macro \transposedCueDuring is useful to add cues to instruments which use a com-
pletely different octave range (for example, having a cue of a piccolo flute within a contra bassoon
part).
picc = \relative c''' {
\clef "treble^8"
R1 |
c8 c c e g2 |
a4 g g2 |
}
\addquote "picc" { \picc }
cbsn = \relative c, {
\clef "bass_8"
c4 r g r
\transposedCueDuring #"picc" #UP c,, { R1 } |
c4 r g r |
}
<<
\context Staff = "picc" \picc
\context Staff = "cbsn" \cbsn
>>
8
8
8.3.5 Aligning to cadenzas
In an orchestral context, cadenzas present a special problem: when constructing a score that
includes a cadenza, all other instruments should skip just as many notes as the length of the
cadenza, otherwise they will start too soon or too late.
A solution to this problem are the functions mmrest-of-length and skip-of-length. These
Scheme functions take a piece of music as argument, and generate a \skip or multi-rest, exactly
as long as the piece. The use of mmrest-of-length is demonstrated in the following example.
cadenza = \relative c' {
c4 d8 << { e f g } \\ { d4. } >>
g4 f2 g4 g
}
{
\override Staff.TimeSignature #'stencil = #ly:text-interface::print
\override Staff.TimeSignature #'text = #tsMarkup
\time 3/2
c'2 \bar ":" c'4 c'4.
}
24 + 58
Each staff can also have its own time signature. This is done by moving the Timing_
translator to the Staff context.
\layout {
\context { \Score
\remove "Timing_translator"
\remove "Default_bar_line_engraver"
}
\context {
\Staff
\consists "Timing_translator"
\consists "Default_bar_line_engraver"
Chapter 8: Advanced notation 202
}
Now, each staff has its own time signature.
<<
\new Staff {
\time 3/4
c4 c c | c c c |
}
\new Staff {
\time 2/4
c4 c | c c | c c
}
\new Staff {
\time 3/8
c4. c8 c c c4. c8 c c
}
>>
43
42
83
A different form of polymetric notation is where note lengths have different values across
staves.
This notation can be created by setting a common time signature for each staff but replacing
it manually using timeSignatureFraction to the desired fraction. Then the printed durations
in each staff are scaled to the common time signature. The latter is done with \compressMusic,
which is used similar to \times, but does not create a tuplet bracket. The syntax is
\compressMusic #'(numerator . denominator ) musicexpr
In this example, music with the time signatures of 3/4, 9/8, and 10/8 are used in parallel.
In the second staff, shown durations are multiplied by 2/3, so that 2/3 * 9/8 = 3/4, and in the
third staff, shown durations are multiplied by 3/5, so that 3/5 * 10/8 = 3/4.
\relative c' { <<
\new Staff {
\time 3/4
c4 c c | c c c |
}
\new Staff {
\time 3/4
\set Staff.timeSignatureFraction = #'(9 . 8)
\compressMusic #'(2 . 3)
\repeat unfold 6 { c8[ c c] }
}
Chapter 8: Advanced notation 203
\new Staff {
\time 3/4
\set Staff.timeSignatureFraction = #'(10 . 8)
\compressMusic #'(3 . 5) {
\repeat unfold 2 { c8[ c c] }
\repeat unfold 2 { c8[ c] }
| c4. c4. \times 2/3 { c8 c c } c4
}
}
>> }
3
4
9
8
8
3
10
Bugs
When using different time signatures in parallel, the spacing is aligned vertically, but bar lines
distort the regular spacing.
As the example illustrates, ly:make-moment n m constructs a duration of n/m of a whole note.
For example, ly:make-moment 1 8 is an eighth note duration and ly:make-moment 7 16 is the
duration of seven sixteenths notes.
3
2
Setting this property only affects the ideal spacing between consecutive notes. For true
proportional notation, the following settings are also required.
True proportional notation requires that symbols are allowed to overstrike each other. That
is achieved by removing the Separating_line_group_engraver from Staff context.
Spacing influence of prefatory matter (clefs, bar lines, etc.) is removed by setting the
strict-note-spacing property to #t in SpacingSpanner grob.
Optical spacing tweaks are switched by setting uniform-stretching in SpacingSpanner
to true.
See also
input/regression/spacing-proportional/.ly input/regression/
spacing-strict-notespacing/.ly input/regression/spacing-strict-spacing-grace/.ly
An example of strict proportional notation is in the example file input/proportional.ly.
Chapter 8: Advanced notation 205
8.4.4 Clusters
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 makeClusters to a
sequence of chords, e.g.,
\makeClusters { <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.
See also
Program reference: ClusterSpanner, ClusterSpannerBeacon, Cluster_spanner_engraver.
Examples: input/regression/cluster.ly.
Bugs
Music expressions like << { g8 e8 } a4 >> are not printed accurately. Use <g a>8 <e a>8 instead.
To see all notehead styles, please see input/regression/note-head-style.ly.
Chapter 8: Advanced notation 206
See also
Program reference: NoteHead.
Bugs
The \featherDuration command only works with very short music snippets.
8.4.7 Improvisation
Improvisation is sometimes denoted with slashed note heads. Such note heads can be created by
adding a Pitch_squash_engraver to the Staff or Voice context. Then, the following command
\set squashedPosition = #0
\override NoteHead #'style = #'slash
switches on the slashes.
There are shortcuts \improvisationOn (and an accompanying \improvisationOff) for this
command sequence. They are used in the following example
\new Staff \with {
\consists Pitch_squash_engraver
} \transpose c c' {
e8 e g a a16(bes)(a8) g \improvisationOn
e8
~e2~e8 f4 fis8
~fis2 \improvisationOff a16(bes) a8 g e
}
3
Chapter 8: Advanced notation 207
It does not change the size of variable symbols, such as beams or slurs.
Internally, the fontSize context property will cause the font-size property to be set in all
layout objects. The value of font-size is a number indicating the size relative to the standard
size for the current staff height. 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. The font-size property can also be set directly, so that only certain layout
objects are affected.
c8
\override NoteHead #'font-size = #-4
c f
\override NoteHead #'font-size = #3
g
Font size changes are achieved by scaling the design size that is closest to the desired size.
The standard font size (for font-size equals 0), depends on the standard staff height. For a
20pt staff, a 10pt font is selected.
The font-size property can only be set on layout objects that use fonts. These are the ones
supporting the font-interface layout interface.
Predefined commands
The following commands set fontSize for the current voice:
\tiny, \small, \normalsize.
I'm a Stem
Hello
There are two music functions, balloonText and balloonGrobText. The latter takes the name
of the grob to adorn, while the former may be used as an articulation on a note. The other
arguments are the offset and the text of the label.
See also
Program reference: text-balloon-interface.
Examples: input/regression/balloon.ly.
Chapter 8: Advanced notation 209
Shapes are determined on the step in the scale, where the base of the scale is determined by
the \key command
Shape note heads are implemented through the shapeNoteStyles property. Its value is a
vector of symbols. The k-th element indicates the style to use for the k-th step of the scale.
Arbitrary combinations are possible, e.g.
\set shapeNoteStyles = ##(cross triangle fa #f mensural xcircle diamond)
c8 d4. e8 a2 g1
\setEasyHeads
c'2 e'4 f' | g'1
E
F
G
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 Section 11.2.1
[Setting the staff size], page 250.
Predefined commands
\setEasyHeads
See also
Program reference: HorizontalBracket.
Examples: input/regression/note-group-bracket.ly.
The full range of colors defined for X11 can be accessed by using the Scheme function x11-
color. The function takes one argument that can be a symbol
\override Beam #'color = #(x11-color 'MediumTurquoise)
or a string
\override Beam #'color = #(x11-color "MediumTurquoise")
The first form is quicker to write and is more efficient. However, using the second form it is
possible to access X11 colors by the multi-word form of its name
\override Beam #'color = #(x11-color "medium turquoise")
If x11-color cannot make sense of the parameter then the color returned defaults to black. It
should be obvious from the final score that something is wrong.
This example illustrates the use of x11-color. Notice that the stem color remains black after
being set to (x11-color Boggle), which is deliberate nonsense.
{
\override Staff.StaffSymbol #'color = #(x11-color 'SlateBlue2)
\set Staff.instrumentName = \markup {
\with-color #(x11-color 'navy) "Clarinet"
}
\time 2/4
gis''8 a''
\override Beam #'color = #(x11-color "medium turquoise")
gis'' a''
\override NoteHead #'color = #(x11-color "LimeGreen")
gis'' a''
\override Stem #'color = #(x11-color 'Boggle)
gis'' a''
}
Clarinet 2
4
See also
Appendix: Section C.3 [List of colors], page 314.
Bugs
Not all x11 colors are distinguishable in a web browser. For web use normal colors are recom-
mended.
An x11 color is not necessarily exactly the same shade as a similarly named normal color.
Notes in a chord cannot be colored with \override; use \tweak instead. See Section 9.3.5
[Objects connected to the input], page 231 for details.
8.5.8 Parentheses
Objects may be parenthesized by prefixing \parenthesize to the music event,
<
c
Chapter 8: Advanced notation 212
\parenthesize d
g
>4-\parenthesize -.
9 Changing defaults
The purpose of LilyPonds design is to provide the finest output quality as a default. Never-
theless, 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 particular effect.
The controls available for tuning are described in a separate document, the Program reference
manual. That 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 four areas where the default settings may be changed:
Automatic notation: changing the automatic creation of notation elements. For example,
changing the beaming rules.
Output: changing the appearance of individual objects. For example, changing stem direc-
tions or the location of subscripts.
Context: changing aspects of the translation from music events to notation. For example,
giving each staff a separate time signature.
Page layout: changing the appearance of the spacing, line breaks, and page dimensions.
These modifications are discussed in Chapter 10 [Non-musical notation], page 234 and
Chapter 11 [Spacing issues], page 246.
Internally, LilyPond uses Scheme (a LISP dialect) to provide infrastructure. Overriding
layout decisions in effect accesses the program internals, which requires Scheme input. Scheme
elements are introduced in a .ly file with the hash mark #.1
The voice option should be used 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 modern
or modern-cautionary should be used instead.
modern This rule corresponds to the common practice in the 20th century. This rule prints
the same accidentals as default, but temporary accidentals also are canceled in
other octaves. Furthermore, in the same octave, they also get canceled in the fol-
lowing measure
#(set-accidental-style 'modern)
cis' c'' cis'2 | c'' c'
modern-cautionary
This rule is similar to 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'
piano-cautionary
Same as #(set-accidental-style 'piano) but with the extra accidentals typeset
as cautionaries.
no-reset This is the same as default but with accidentals lasting forever and not only
until the next measure
#(set-accidental-style 'no-reset)
c1 cis cis c
forget This is sort of the opposite of 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
See also
Program reference: Accidental_engraver, Accidental, and AccidentalPlacement.
Bugs
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 happen one at a time, in the order in
which they appear in the input file. This is a problem when accidentals in a chord depend on
each other, which does not happen for the default accidental style. The problem can be solved
by manually inserting ! and ? for the problematic notes.
context is optional, and it specifies the context at which the change should be made. The
default is 'Voice. #(score-override-auto-beam-setting '(A B C D) E F) is equivalent
to #(override-auto-beam-setting '(A B C D) E F 'Score).
For example, if automatic beams should always end on the first quarter note, use
#(override-auto-beam-setting '(end * * * *) 1 4)
You can force the beam settings to only take effect on beams whose shortest note is a certain
duration
\time 2/4
#(override-auto-beam-setting '(end 1 16 * *) 1 16)
a16 a a a a a a a |
a32 a a a a16 a a a a a |
#(override-auto-beam-setting '(end 1 32 * *) 1 16)
a32 a a a a16 a a a a a |
42
3
You can force the beam settings to only take effect in certain time signatures
\time 5/8
#(override-auto-beam-setting '(end * * 5 8) 2 8)
c8 c d d d
\time 4/4
e8 e f f e e d d
\time 5/8
c8 c d d d
85 5
8
You can also remove a previously set beam-ending rule by using
#(revert-auto-beam-setting '(be p q n m) a b [context])
be, p, q, n, m, a, b and context are the same as above. Note that the default rules are specified
in scm/auto-beam.scm, so you can revert rules that you did not explicitly create.
\time 4/4
a16 a a a a a a a a a a a a a a a
#(revert-auto-beam-setting '(end 1 16 4 4) 1 4)
a16 a a a a a a a a a a a a a a a
Chapter 9: Changing defaults 217
The rule in a revert-auto-beam-setting statement must exactly match the original rule. That
is, no wildcard expansion is taken into account.
\time 1/4
#(override-auto-beam-setting '(end 1 16 1 4) 1 8)
a16 a a a
#(revert-auto-beam-setting '(end 1 16 * *) 1 8) % this won't revert it!
a a a a
#(revert-auto-beam-setting '(end 1 16 1 4) 1 8) % this will
a a a a
41
If automatic beams should end on every quarter in 5/4 time, specify all endings
#(override-auto-beam-setting '(end * * * *) 1 4 'Staff)
#(override-auto-beam-setting '(end * * * *) 1 2 'Staff)
#(override-auto-beam-setting '(end * * * *) 3 4 'Staff)
#(override-auto-beam-setting '(end * * * *) 5 4 'Staff)
...
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)
#(override-auto-beam-setting '(end * * * *) 1 2)
#(override-auto-beam-setting '(end * * * *) 7 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).
If any unexpected beam behaviour occurs, check the default automatic beam settings in scm/
auto-beam.scm for possible interference, because the beam endings defined there will still apply
on top of your own overrides. Any unwanted endings in the default vales must be reverted for
your time signature(s).
For example, to typeset (3 4 3 2)-beam endings in 12/8, begin with
%%% revert default values in scm/auto-beam.scm regarding 12/8 time
#(revert-auto-beam-setting '(end * * 12 8) 3 8)
#(revert-auto-beam-setting '(end * * 12 8) 3 4)
#(revert-auto-beam-setting '(end * * 12 8) 9 8)
Predefined commands
\autoBeamOff, \autoBeamOn.
Chapter 9: Changing defaults 218
5
(2+3) (3+2)
16
Bugs
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 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 input, the program
remembers where measure boundaries are, and which pitches require explicit accidentals. This
information can be presented on several levels. For example, the effect of an accidental is limited
to a single staff, while a bar line must be synchronized across the entire score.
Within LilyPond, these rules and bits of information are grouped in Contexts. Some examples
of contexts are Voice, Staff, and Score. They are hierarchical, for example: a Staff can
contain many Voices, and a Score can contain many Staff contexts.
Chapter 9: Changing defaults 219
Each context has the responsibility for enforcing some notation rules, creating some nota-
tion objects and maintaining the associated properties. For example, the Voice context may
introduce an accidental and then the Staff context maintains the rule to show or suppress the
accidental for the remainder of the measure. The synchronization of bar lines is handled at
Score context.
However, in some music we may not want the bar lines to be synchronized consider a
polymetric score in 4/4 and 3/4 time. In such cases, we must modify the default settings of the
Score and Staff contexts.
For very simple scores, contexts are created implicitly, and you need not be aware of them.
For larger pieces, such as anything with more than one staff, 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 to define new
contexts.
A complete description of all available contexts is in the program reference, see Translation
Context.
With this mechanism, it is possible to define an Urtext (original edition), with the option
to put several distinct articulations on the same notes.
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 Section 12.5.2 [Running a function on all layout
objects], page 284). Without an explicit \context, it is usually applied to Voice
\applyOutput #'context #function % apply to Voice
To have it interpreted at the Score or Staff level use these forms
\applyOutput #'Score #function
\applyOutput #'Staff #function
2
Chapter 9: Changing defaults 221
This command skips measures that have no notes. The result is that multi-rests are con-
densed. 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, so automatic beaming is switched off in the current
Voice. Note that the bottom-most context does not always contain the property that you wish
to change for example, attempting to set the skipBars property (of the bottom-most context,
in this case Voice) will have no effect.
R1*2
\set skipBars = ##t
R1*2
Contexts are hierarchical, so if a bigger context was specified, for example Staff, then the
change would also apply to all Voices 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,
\unset context.prop
which removes the definition of prop. This command removes the definition only if it is set in
context, so
\set Staff.autoBeaming = ##f
introduces a property setting at Staff level. The setting also applies to the current Voice.
However,
\unset Voice.autoBeaming
does not have any effect. To cancel this setting, the \unset must be specified on the same level
as the original \set. In other words, undoing the effect of Staff.autoBeaming = ##f requires
\unset Staff.autoBeaming
Like \set, the context argument does not have to be specified for a bottom context, so the
two statements
\set Voice.autoBeaming = ##t
\set autoBeaming = ##t
are equivalent.
Settings that should only apply to a single time-step can be entered with \once, for example
in
Chapter 9: Changing defaults 222
c4
\once \set fontSize = #4.7
c4
c4
In the second staff 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. This method also influences the
spacing, which may or may not be desirable. A more sophisticated method of blanking objects
is shown in Section 5.3 [Common tweaks], page 54.
The next example shows a practical application. Bar lines and time signatures are normally
synchronized across the score. This is done by the Timing_translator and Default_bar_line_
engraver. This plug-in keeps an administration of time signature, location within the measure,
etc. By moving thes engraver from Score to Staff context, we can have a score where each
staff has its own time signature.
\new Score \with {
\remove "Timing_translator"
\remove "Default_bar_line_engraver"
} <<
\new Staff \with {
\consists "Timing_translator"
\consists "Default_bar_line_engraver"
} {
\time 3/4
c4 c c c c c
}
\new Staff \with {
\consists "Timing_translator"
\consists "Default_bar_line_engraver"
} {
\time 2/4
c4 c c c c c
}
>>
43
42
explains what to fill in for name, property, and value. Here we only discuss the 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 changes the definition of the Stem within the current Staff. After
the command is interpreted all stems are thickened.
Analogous to \set, the context argument may be left out, causing the default context Voice
to be used. 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 such as 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 but the beam is not. This is because the command for Beam comes after the
Beam is started, so it has no effect.
Analogous to \unset, the \revert command for a context undoes an \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.
Chapter 9: Changing defaults 225
See also
Internals: OverrideProperty, RevertProperty, PropertySet, Backend, and All layout
objects.
Bugs
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.
Bugs
It is not possible to collect context changes in a variable and apply them to a \context definition
by referring to that variable.
Chapter 9: Changing defaults 226
The \RemoveEmptyStaffContext will overwrite your current \Staff settings. If you wish
to change the defaults for a staff which uses \RemoveEmptyStaffContext, you must do so after
calling \RemoveemptyStaffContext, ie
\layout {
\context {
\RemoveEmptyStaffContext
ad lib undress
while playing :)
These settings are defined within a \context block inside a \layout block,
\layout {
\context {
...
}
}
In the following discussion, the example input shown should go in place of the . . . in the
previous fragment.
First it is necessary to define a name for the new context:
\name ImproVoice
Since it is similar to the Voice, we want commands that work on (existing) Voices to remain
working. This is achieved by giving the new context an alias Voice,
\alias Voice
The context will print notes and instructive texts, so we need to add the engravers which
provide this functionality,
\consists Note_heads_engraver
\consists Text_engraver
but we only need this 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, and have no stem,
Chapter 9: Changing defaults 227
Some tweakable options are called subproperties and reside inside properties. To tweak
those, use commands in the form
\override Stem #'details #'beamed-lengths = #'(4 4 3)
For many properties, regardless of the data type of the property, setting the property to false
( ##f ) will result in turning it off, causing Lilypond to ignore that property entirely. This is
particularly useful for turning off grob properties which may otherwise be causing problems.
We demonstrate how to glean this information from the notation manual and the program
reference.
2
If you visit the documentation on fingering instructions (in Section 6.6.2 [Fingering instruc-
tions], page 96), you will notice:
Chapter 9: Changing defaults 229
See also
Program reference: Fingering.
The programmers reference is available as an HTML document. It is highly recommended
that you read it in HTML form, either online or by downloading the HTML documentation.
This section will be much more difficult to understand if you are using the PDF manual.
Follow the link to Fingering. At the top of the page, you will see
Fingering objects are created by: Fingering_engraver and New_fingering_
engraver.
By following related links inside the program reference, we can follow the flow of information
within the program:
Fingering: Fingering objects are created by: Fingering_engraver
Fingering_engraver: Music types accepted: fingering-event
fingering-event: Music event type fingering-event is in Music expressions named
FingerEvent
This path goes against the flow of information in the program: it starts from the output,
and ends at the input event. You could also start at an input event, and read with the flow of
information, eventually ending up at the output object(s).
The program reference can also be browsed like a normal document. It contains chapters on
Music definitions on Translation, and the Backend. Every chapter lists all the definitions
used and all properties that may be tuned.
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 proper-
ties), but others can be modified.
We have been talking of the Fingering object, but actually it does not amount to much.
The initialization file (see Section 5.4 [Default files], page 55) scm/define-grobs.scm shows
the soul of the object,
(Fingering
. ((padding . 0.5)
(avoid-slur . around)
(slur-padding . 0.2)
(staff-padding . 0.5)
(self-alignment-X . 0)
(self-alignment-Y . 0)
(script-priority . 100)
(stencil . ,ly:text-interface::print)
(direction . ,ly:script-interface::calc-direction)
(font-encoding . fetaNumber)
(font-size . -5) ; don't overlap when next to heads.
(meta . ((class . Item)
(interfaces . (finger-interface
font-interface
text-script-interface
text-interface
side-position-interface
self-alignment-interface
item-interface))))))
As you can see, the Fingering object is nothing more than a bunch of variable settings, and
the webpage in the Program Reference is directly generated from this definition.
2
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.
Chapter 9: Changing defaults 231
By increasing the value of padding, we can move the fingering away from the notehead. The
following command inserts 3 staff spaces of white between the note and the fingering:
\once \override Voice.Fingering #'padding = #3
Inserting this command before the Fingering object is created, i.e., before c2, yields the
following result:
\once \override Voice.Fingering #'padding = #3
c-2
\stemUp
f
2
In this case, the context for this tweak is Voice. 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
As you can see, properties are set directly in the objects directly, without mentioning the
grob name or context where this should be applied.
This technique only works for objects that are directly connected to an event from the input,
for example
note heads, caused by chord-pitch (i.e., notes inside a chord).
articulation signs, caused by articulation instructions.
It notably does not work for stems and accidentals (these are caused by note heads, not by
music events) or clefs (these are not caused by music inputs, but rather by the change of a
property value).
There are very few objects which are directly connected to output. A normal note (like c4)
is not directly connected to output, so
\tweak #'color #red c4
will not change color. See Section 12.3.1 [Displaying music expressions], page 276 for details.
Chapter 9: Changing defaults 232
\relative c'' {
\override Tie #'after-line-breaking =
#my-callback
c1 ~ \break c2 ~ c
}
2
When applying this trick, the new after-line-breaking callback should also call the
old one after-line-breaking, if there is one. For example, if using this with Hairpin,
ly:hairpin::after-line-breaking should also be called.
Some objects cannot be changed with \override for technical reasons. Examples of
those are NonMusicalPaperColumn and PaperColumn. They can be changed with the
\outputProperty function, which works similar to \once \override, but uses a different
syntax,
\outputProperty
#"Score.NonMusicalPaperColumn" % Grob name
#'line-break-system-details % Property name
#'((next-padding . 20)) % Value
Chapter 10: Non-musical notation 234
10 Non-musical notation
This section deals with general lilypond issues, rather than specific notation.
\header {
title = "Do-re-mi"
}
{ c'4 d' e2 }
At any point in a file, any of the following lexical instructions can be entered:
\version
\include
\sourcefilename
\sourcefileline
expressions. All of these examples are single music expressions; note the curly braces { } or
angle brackets << >> at the beginning and ending of the music.
{ c'4 c' c' c' }
{
{ c'4 c' c' c'}
{ d'4 d' d' d'}
}
<<
\new Staff { c'4 c' c' c' }
\new Staff { d'4 d' d' d' }
>>
{
\new GrandStaff <<
\new StaffGroup <<
\new Staff { \flute }
\new Staff { \oboe }
>>
\new StaffGroup <<
\new Staff { \violinI }
\new Staff { \violinII }
>>
>>
}
\score {
..
}
\markup {
..
}
\score {
..
}
However, if you want multiple output files from the same .ly file, then you can add multiple
\book blocks, where each such \book block will result in a separate output. If you do not specify
any \book block in the file, LilyPond will implicitly treat the full file as a single \book block,
see Section 10.1.2 [File structure], page 234. One important exception is within lilypond-book
documents, where you explicitly have to add a \book block, otherwise only the first \score or
\markup will appear in the output.
The header for each piece of music can be put inside the \score block. The piece name
from the header will be printed before each movement. The title for the entire book can be put
inside the \book, but if it is not present, the \header which is at the top of the file is inserted.
\header {
title = "Eight miniatures"
composer = "Igor Stravinsky"
}
\score {
...
\header { piece = "Romanze" }
}
\markup {
..text of second verse..
}
\markup {
..text of third verse..
}
\score {
...
\header { piece = "Menuetto" }
}
More clip regions can be defined by adding more pairs of rhythmic-locations to the list.
In order to use this feature, LilyPond must be invoked with -dclip-systems. The clips are
output as EPS files, and are converted to PDF and PNG if these formats are switched on as
well.
For more information on output formats, see Section 13.1 [Invoking lilypond], page 286.
See also
Examples: input/regression//clip-systems.ly
See also
input/regression/utf-8.ly
dedication
The dedicatee of the music, centered at the top of the first page.
title The title of the music, centered just below the dedication.
subtitle Subtitle, centered below the title.
subsubtitle
Subsubtitle, centered below the subtitle.
poet Name of the poet, flush-left below the subtitle.
composer Name of the composer, flush-right below the subtitle.
meter Meter string, flush-left below the poet.
opus Name of the opus, flush-right below the composer.
arranger Name of the arranger, flush-right below the opus.
instrument
Name of the instrument, centered below the arranger. Also centered at the top of
pages (other than the first page).
piece Name of the piece, flush-left below the instrument.
breakbefore
This forces the title to start on a new page (set to ##t or ##f).
copyright
Copyright notice, centered at the bottom of the first page. To insert the copyright
symbol, see Section 10.1.7 [Text encoding], page 238.
tagline Centered at the bottom of the last page.
Here is a demonstration of the fields available. Note that you may use any Section 8.1.4 [Text
markup], page 170 commands in the header.
\paper {
line-width = 9.0\cm
paper-height = 10.0\cm
}
\book {
\header {
dedication = "dedicated to me"
title = \markup \center-align { "Title first line" "Title second line,
longer" }
subtitle = "the subtitle,"
subsubtitle = #(string-append "subsubtitle LilyPond version "
(lilypond-version))
poet = "Poet"
composer = \markup \center-align { "composer" \small "(1847-1973)" }
texttranslator = "Text Translator"
meter = \markup { \teeny "m" \tiny "e" \normalsize "t" \large "e" \huge
"r" }
arranger = \markup { \fontsize #8.5 "a" \fontsize #2.5 "r" \fontsize
#-2.5 "r" \fontsize #-5.3 "a" \fontsize #7.5 "nger" }
instrument = \markup \bold \italic "instrument"
piece = "Piece"
Chapter 10: Non-musical notation 240
\score {
{ c'1 }
\header {
piece = "piece1"
opus = "opus1"
}
}
\markup {
and now...
}
\score {
{ c'1 }
\header {
piece = "piece2"
opus = "opus2"
}
}
}
dedicated to me
Title first line
Title second line,longer
the subtitle,
subsubtitle LilyPond version 2.10.33
Poet instrument composer
(1847-1973)
me ter
piece1
a r nger
r a
opus1
Chapter 10: Non-musical notation 241
2 instrument
and now...
piece2 opus2
As demonstrated before, you can use multiple \header blocks. When same fields appear in
different blocks, the latter is used. Here is a short example.
\header {
composer = "Composer"
}
\header {
piece = "Piece"
}
\score {
\new Staff { c'4 }
\header {
piece = "New piece" % overwrite previous one
}
}
If you define the \header inside the \score block, then normally only the piece and opus
headers will be printed. Note that the music expression must come before the \header.
\score {
{ c'4 }
\header {
title = "title" % not printed
piece = "piece"
opus = "opus"
}
}
title
piece opus
Chapter 10: Non-musical notation 242
You may change this behavior (and print all the headers when defining \header inside \score)
by using
\paper{
printallheaders=##t
}
The default footer is empty, except for the first page, where the copyright field from \header
is inserted, and the last page, where tagline from \header is added. The default tagline is
Music engraving by LilyPond (version).1
Headers may be completely removed by setting them to false.
\header {
tagline = ##f
composer = ##f
}
Bugs
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. Therefore the
midi file should not have more than 15 staves (or 14 if you do not use drums). Other staves will
remain silent.
Not all midi players correctly handle tempo changes in the midi output. Players that are
known to work include timidity.
Bugs
Unterminated (de)crescendos will not render properly in the midi file, resulting in silent passages
of music. The workaround is to explicitly terminate the (de)crescendo. For example,
{ a\< b c d\f }
will not work properly but
{ a\< b c d\!\f }
will.
In polyphonic music, Score.skipTypesetting will affect all voices and staves, saving even
more time.
Chapter 11: Spacing issues 246
11 Spacing issues
The global paper layout is 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. This influences where line breaks are chosen, and thus ultimately, how
many pages a piece of music takes.
Globally speaking, this procedure happens in four steps: first, flexible distances (springs)
are chosen, based on durations. All possible line breaking combinations are tried, and a bad-
ness score is calculated for each. Then the height of each possible system is estimated. Finally,
a page breaking and line breaking combination is chosen so that neither the horizontal nor the
vertical spacing is too cramped or stretched.
paper-height
The height of the page. The default is taken from the current paper
size, see Section 11.1.1 [Paper size], page 246.
top-margin
Margin between header and top of the page. Default is 5mm.
bottom-margin
Margin between footer and bottom of the page. Default is 6mm.
left-margin
Margin between the left side of the page and the beginning of the music.
Unset by default, which means that the margins is determined based on
the paper-width and line-width to center the score on the paper.
line-width
The length of the systems. Default is paper-width minus 20mm.
head-separation
Distance between the top-most music system and the page header. De-
fault is 4mm.
foot-separation
Distance between the bottom-most music system and the page footer.
Default is 4mm.
page-top-space
Distance from the top of the printable area to the center of the first
staff. This only works for staves which are vertically small. Big staves
are set with the top of their bounding box aligned to the top of the
printable area. Default is 12mm.
ragged-bottom
If set to true, systems will not be spread vertically across the page. This
does not affect the last page. Default is false.
This should be set to true for pieces that have only two or three systems
per page, for example orchestral scores.
ragged-last-bottom
If set to false, systems will be spread vertically to fill the last page.
Default is true.
Pieces that amply fill two pages or more should have this set to true.
system-count
This variable, if set, specifies into how many lines a score should be
broken. Unset by default.
between-system-space
This dimensions determines the distance between systems. It is the
ideal distance between the center of the bottom staff of one system and
the center of the top staff of the next system. Default is 20mm.
Increasing this will provide a more even appearance of the page at the
cost of using more vertical space.
between-system-padding
This dimension is the minimum amount of white space that will always
be present between the bottom-most symbol of one system, and the
top-most of the next system. Default is 4mm.
Chapter 11: Spacing issues 248
Increasing this will put systems whose bounding boxes almost touch
farther apart.
horizontal-shift
All systems (including titles and system separators) are shifted by this
amount to the right. Page markup, such as headers and footers are
not affected by this. The purpose of this variable is to make space for
instrument names at the left. Default is 0.
after-title-space
Amount of space between the title and the first system. Default is 5mm.
before-title-space
Amount of space between the last system of the previous piece and the
title of the next. Default is 10mm.
between-title-space
Amount of space between consecutive titles (e.g., the title of the book
and the title of a piece). Default is 2mm.
printallheaders
Setting this to #t will print all headers for each \score in the output.
Normally only the piece and opus \headers are printed.
systemSeparatorMarkup
This contains a markup object, which will be inserted between systems.
This is often used for orchestral scores. Unset by default.
2
Music engraving by LilyPond 2.10.33www.lilypond.org
blank-page-force
The penalty for having a blank page in the middle of a score. This is
not used by ly:optimal-breaking since it will never consider blank
pages in the middle of a score. Default value is 10.
blank-last-page-force
The penalty for ending the score on an odd-numbered page. Default
value is 0.
page-spacing-weight
The relative importance of page (vertical) spacing and line (horizontal)
spacing. High values will make page spacing more important. Default
value is 10.
auto-first-page-number
The page breaking algorithm is affected by the first page number being
odd or even. If this variable is set to #t, the page breaking algorithm
will decide whether to start with an odd or even number. This will
result in the first page number remaining as is or being increased by
one.
Example:
\paper{
paper-width = 2\cm
top-margin = 3\cm
Chapter 11: Spacing issues 250
bottom-margin = 3\cm
ragged-last-bottom = ##t
}
You can also define these values in Scheme. In that case mm, in, pt, and cm are variables
defined in paper-defaults.ly with values in millimeters. That is why the value must be
multiplied in the example
\paper {
#(define bottom-margin (* 2 cm))
}
The header and footer are created by the functions make-footer and make-header, defined
in \paper. The default implementations are in ly/paper-defaults.ly and ly/titling-init
.ly.
The page layout itself is done by two functions in the \paper block, page-music-height
and page-make-stencil. The former tells the line-breaking algorithm how much space can be
spent on a page, the latter creates the actual page given the system to put on it.
Bugs
The option right-margin is defined but doesnt set the right margin yet. The value for the right
margin has to be defined adjusting the values of left-margin and line-width.
The default page header puts the page number and the instrument field from the \header
block on a line.
The titles (from the \header{} section) are treated as a system, so ragged-bottom and
ragged-last-bottom will add space between the titles and the first system of the score.
See also
This manual: Section 8.4.8 [Selecting notation font size], page 207.
See also
This manual: Section 9.2.6 [Changing context default settings], page 225
11.3 Breaks
11.3.1 Line breaking
Line breaks are normally computed automatically. They are chosen so 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.
Chapter 11: Spacing issues 252
Predefined commands
\break, and \noBreak.
See also
Internals: LineBreakEvent.
A linebreaking configuration can now be saved as a .ly file automatically. This allows
vertical alignments to be stretched to fit pages in a second formatting run. This is fairly new
and complicated.
Bugs
Line breaks can only occur if there is a proper bar line. A note which is hanging over a bar
line is not proper, such as
c4 c2 c2 \break % this does nothing
c2 c4 | % a break here would work
c4 c2 c4 ~ \break % as does this break
c4 c2 c4
4
To allow line breaks on such bar lines, the Forbid_line_break_engraver can be removed
from Voice context, like so
\new Voice \with {
\remove "Forbid_line_break_engraver"
} {
c4 c2 c2 \break % now the break is allowed
c2 c4
}
\paper{
#(define page-breaking ly:page-turn-breaking)
}
The old page breaking algorithm is called optimal-page-breaks. If you are having trouble
with the new page breakers, you can enable the old one as a workaround.
Predefined commands
\pageBreak \noPageBreak
Bugs
There should only be one Page_turn_engraver in a score. If there is more than one, they will
interfere with each other.
\score {
\new Score \with {
\override NonMusicalPaperColumn #'line-break-permission = ##f
\override NonMusicalPaperColumn #'page-break-permission = ##f
} {
\new Staff {
\repeat unfold 2 { c'8 c'8 c'8 c'8 } \break
\repeat unfold 4 { c'8 c'8 c'8 c'8 } \break
\repeat unfold 6 { c'8 c'8 c'8 c'8 } \break
\repeat unfold 8 { c'8 c'8 c'8 c'8 } \pageBreak
\repeat unfold 8 { c'8 c'8 c'8 c'8 } \break
\repeat unfold 6 { c'8 c'8 c'8 c'8 } \break
\repeat unfold 4 { c'8 c'8 c'8 c'8 } \break
\repeat unfold 2 { c'8 c'8 c'8 c'8 }
}
}
}
Chapter 11: Spacing issues 255
11
15
18
20
>>
}
12
\overrideProperty "Score.NonMusicalPaperColumn"
#'line-break-system-details #'((Y-offset . 0))
s1 * 2 \break
\overrideProperty "Score.NonMusicalPaperColumn"
#'line-break-system-details #'((Y-offset . 35))
s1 * 3 \break
\overrideProperty "Score.NonMusicalPaperColumn"
#'line-break-system-details #'((Y-offset . 70))
s1 * 6 \break
\overrideProperty "Score.NonMusicalPaperColumn"
#'line-break-system-details #'((Y-offset . 105))
s1 * 5 \break
}
\new Voice {
\repeat unfold 2 { c'4 c'4 c'4 c'4 }
\repeat unfold 3 { c'4 c'4 c'4 c'4 }
\repeat unfold 6 { c'4 c'4 c'4 c'4 }
\repeat unfold 5 { c'4 c'4 c'4 c'4 }
Chapter 11: Spacing issues 257
}
>>
}
12
See also
Internals: Vertical alignment of staves is handled by the VerticalAlignment object. The
context parameters specifying the vertical extent are described in connection with the Axis_
group_engraver.
Example files: input/regression//page-spacing.ly, input/regression//
alignment-vertical-spacing.ly.
Chapter 11: Spacing issues 258
See also
Example files: input/regression//alignment-vertical-spacing.ly.
between-system-padding = #1
ragged-bottom=##f
ragged-last-bottom=##f
}
\overrideProperty NonMusicalPaperColumn
#'line-break-system-details #'((Y-offset . 40))
\overrideProperty NonMusicalPaperColumn
#'line-break-system-details #'((X-offset . 20) (Y-offset . 40))
\override NonMusicalPaperColumn
#'line-break-system-details #'((alignment-offsets . (0 -15)))
\override NonMusicalPaperColumn
#'line-break-system-details #'((X-offset . 20) (Y-offset . 40)
(alignment-offsets . (0 -15)))
To understand how each of these different settings work, we begin by looking at an example
that includes no overrides at all.
Chapter 11: Spacing issues 260
10
13
18
This score isolates line- and page-breaking information in a dedicated voice. This technique of
creating a breaks voice will help keep layout separate from music entry as our example becomes
more complicated. See Section 11.3.6 [Using an extra voice for breaks], page 255.
Explicit \breaks evenly divide the music into six measures per line. Vertical spacing results
from LilyPonds defaults. To set the vertical startpoint of each system explicitly, we can set the
Chapter 11: Spacing issues 261
10
13
18
Chapter 11: Spacing issues 262
10
Chapter 11: Spacing issues 263
13
18
Note that here we assign two different values to the line-break-system-details attribute
of the NonMusicalPaperColumn grob. Though the line-break-system-details attribute alist
accepts many additional spacing parameters (including, for example, a corresponding X-offset
pair), we need only set the Y-offset and alignment-offsets pairs to control the vertical
startpoint of every system and every staff. Finally, note that alignment-offsets specifies the
vertical positioning of staves but not of staff groups.
4
Chapter 11: Spacing issues 264
7
10
13
18
Chapter 11: Spacing issues 265
The ragged-bottom property adds space between systems, while the two-pass technique adds
space between staffs inside a system.
To allow this behaviour, a tweak-key variable has to be set in each score \layout block, and
the tweaks included in each score music, using the \scoreTweak music function.
%% include the generated page layout file:
\includePageLayoutFile
\score {
\new StaffGroup <<
\new Staff <<
%% Include this score tweaks:
\scoreTweak "scoreA"
{ \clef french c''1 \break c''1 }
>>
\new Staff { \clef soprano g'1 g'1 }
\new Staff { \clef mezzosoprano e'1 e'1 }
\new Staff { \clef alto g1 g1 }
\new Staff { \clef bass c1 c1 }
>>
\header {
piece = "Score with tweaks"
}
%% Define how to name the tweaks for this score:
\layout { #(define tweak-key "scoreA") }
}
For the first pass, the dump-tweaks option should be set to generate the page layout file.
lilypond -b null -d dump-tweaks <file>.ly
lilypond <file>.ly
Normally, spacing-increment is set to 1.2 staff space, which is approximately the width of
a note head, and shortest-duration-space is set to 2.0, meaning that the shortest note gets
2.4 staff space (2.0 times the spacing-increment) of horizontal space. This space is 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 32nd 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 rather the one which occurs most
frequently.
The most common shortest duration is determined as follows: in every measure, the shortest
duration is determined. The most common shortest duration is taken as the basis for the spacing,
with the stipulation that this shortest duration should always be equal to or shorter than an
8th note. The shortest duration is printed when you run lilypond with the --verbose option.
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 an 8th), is set through base-shortest-duration.
Notes that are even shorter than the common shortest note 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
In the introduction (see Section 1.1 [Engraving], page 2), it was explained that stem direc-
tions influence spacing. This is controlled with the stem-spacing-correction property in the
NoteSpacing, object. These are generated for every Voice context. The StaffSpacing object
(generated in Staff context) contains the same property for controlling the stem/bar line spac-
ing. The following example shows these corrections, once with default settings, and once with
exaggerated corrections:
Chapter 11: Spacing issues 267
Proportional notation is supported; see Section 8.4.3 [Proportional notation], page 204.
See also
Internals: SpacingSpanner, NoteSpacing, StaffSpacing, SeparationItem, and
SeparatingGroupSpanner.
Bugs
There is no convenient mechanism to manually override spacing. The following work-around
may be used to insert extra space into a score.
\once \override Score.SeparationItem #'padding = #1
No work-around exists for decreasing the amount of space.
42 4
16
The \newSpacingSection command creates a new SpacingSpanner object, and hence new
\overrides may be used in that location.
Chapter 11: Spacing issues 268
11
\score {
\relative c'' {
g4 e e2 | f4 d d2 | c4 d e f | g4 g g2 |
g4 e e2 | f4 d d2 | c4 e g g | c,1 |
d4 d d d | d4 e f2 | e4 e e e | e4 f g2 |
g4 e e2 | f4 d d2 | c4 e g g | c,1 |
}
\layout {
\context {
\Score
\override SpacingSpanner
#'base-shortest-duration = #(ly:make-moment 1 16)
}
}
}
10
13
Chapter 11: Spacing issues 269
5
5
When strict-note-spacing is set, notes are spaced without regard for clefs, bar lines, and
grace notes,
\override Score.SpacingSpanner #'strict-note-spacing = ##t
\new Staff { c8[ c \clef alto c \grace { c16[ c] } c8 c c] c32[ c32] }
\layout {
indent = #0
line-width = #150
ragged-last = ##t
}
\book {
\score { { c4 } }
\paper { annotate-spacing = ##t }
}
59.75 paper-height
(-11.15,-0.10)
24.79 space left
Music engraving by LilyPond 2.10.33www.lilypond.org
(-11.15,-0.10)
Y-extentextent-estimate
4.00 foot-separation
4.00 head-separation
6.83 page-top-space
Some unit dimensions are measured in staff spaces, while others are measured in millimeters.
The pairs (a,b) are intervals, where a is the lower edge and b the upper edge of the interval.
Chapter 12: Interfaces for programmers 271
\relative c''' {
c4^"piu mosso" b a b
\padText #1.8
c4^"piu mosso" d e f
\padText #2.6
Chapter 12: Interfaces for programmers 272
piu mosso piu mosso
piu mosso
\relative c'' {
c2 e
\tempoMark #3.0 #"Allegro"
g c
}
Allegro
Chapter 12: Interfaces for programmers 273
\relative {
\manualBeam #'(3 . 6) c8 d e f
}
or
manualBeam =
#(define-music-function (parser location beg end)
(number? number?)
#{
\once \override Beam #'positions = #(cons $beg $end)
#})
\relative {
\manualBeam #3 #6 c8 d e f
}
AltOff = {
\revert Stem #'length
\revert NoteHead #'font-size
}
Chapter 12: Interfaces for programmers 274
{ \twice }
Due to parser lookahead
In this example, the assignment happens after parser has verified that nothing interesting
happens after traLaLa = { ... }. Without the dummy statement in the above example, the
newLa definition is executed before traLaLa is defined, leading to a syntax error.
The above example shows how to export music expressions from the input to the Scheme in-
terpreter. 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
...
{ #(ly:export (make-sequential-music (list newLa))) }
Scheme code is evaluated as soon as the parser encounters it. To define some Scheme code
in a macro (to be called later), use Section 12.1.5 [Void functions], page 274 or
Chapter 12: Interfaces for programmers 276
#(define (nopc)
(ly:set-option 'point-and-click #f))
...
#(nopc)
{ c'4 }
Bugs
Mixing Scheme and LilyPond identifiers is not possible with the --safe option.
'NoteEvent
'duration
(ly:make-duration 2 0 1 1)
'pitch
(ly:make-pitch 0 0 0))
(make-music
'AbsoluteDynamicEvent
'text
"f")))))
By default, LilyPond will print these messages to the console along with all the other mes-
sages. To split up these messages and save the results of \display{STUFF}, redirect the output
to a file.
lilypond file.ly >display.txt
With a bit of reformatting, the above information is easier to read,
(make-music 'SequentialMusic
'elements (list (make-music 'EventChord
'elements (list (make-music 'NoteEvent
'duration (ly:make-duration 2 0 1 1)
'pitch (ly:make-pitch 0 0 0))
(make-music 'AbsoluteDynamicEvent
'text "f")))))
A { ... } music sequence has the name SequentialMusic, and its inner expressions are
stored as a list in its 'elements property. A note is represented as an EventChord expres-
sion, containing a NoteEvent object (storing the duration and pitch properties) and any extra
information (in this case, an AbsoluteDynamicEvent with a "f" text property.
Then the note pitch is accessed through the 'pitch property of the NoteEvent object,
#(display-scheme-music
(ly:music-property (first (ly:music-property someNote 'elements))
'pitch))
===>
(ly:make-pitch 0 0 0)
The note pitch can be changed by setting this pitch property,
#(set! (ly:music-property (first (ly:music-property someNote 'elements))
'pitch)
(ly:make-pitch 0 1 0)) ;; set the pitch to d'.
\displayLilyMusic \someNote
===>
d'
(make-music
'SequentialMusic
'elements
(list (make-music
'EventChord
'elements
(list (make-music
'NoteEvent
'duration
(ly:make-duration 2 0 1 1)
'pitch
(ly:make-pitch 0 5 0))))))
So in our function, we need to clone this expression (so that we have two notes to build
the sequence), add SlurEvents to the 'elements property of each one, and finally make a
SequentialMusic with the two EventChords.
doubleSlur = #(define-music-function (parser location note) (ly:music?)
"Return: { note ( note ) }.
note'
is supposed to be an EventChord."
(let ((note2 (ly:music-deep-copy note)))
(set! (ly:music-property note 'elements)
(cons (make-music 'SlurEvent 'span-direction -1)
(ly:music-property note 'elements)))
(set! (ly:music-property note2 'elements)
(cons (make-music 'SlurEvent 'span-direction 1)
(ly:music-property note2 'elements)))
(make-music 'SequentialMusic 'elements (list note note2))))
'pitch
(ly:make-pitch -1 0 0))))
=====
% desired output
\displayMusic c4->
===>
(make-music
'EventChord
'elements
(list (make-music
'NoteEvent
'duration
(ly:make-duration 2 0 1 1)
'pitch
(ly:make-pitch -1 0 0))
(make-music
'ArticulationEvent
'articulation-type
"marcato")))
We see that a note (c4) is represented as an EventChord expression, with a NoteEvent
expression in its elements list. To add a marcato articulation, an ArticulationEvent expression
must be added to the elements property of the EventChord expression.
To build this function, we begin with
(define (add-marcato event-chord)
"Add a marcato ArticulationEvent to the elements of event-chord'
,
which is supposed to be an EventChord expression."
(let ((result-event-chord (ly:music-deep-copy event-chord)))
(set! (ly:music-property result-event-chord 'elements)
(cons (make-music 'ArticulationEvent
'articulation-type "marcato")
(ly:music-property result-event-chord 'elements)))
result-event-chord))
The first line is the way to define a function in Scheme: the function name is add-marcato,
and has one variable called event-chord. In Scheme, the type of variable is often clear from its
name. (this is good practice in other programming languages, too!)
"Add a marcato..."
is a description of what the function does. This is not strictly necessary, but just like clear
variable names, it is good practice.
(let ((result-event-chord (ly:music-deep-copy event-chord)))
let is used to declare local variables. Here we use one local variable, named
result-event-chord, to which we give the value (ly:music-deep-copy event-chord).
ly:music-deep-copy is a function specific to LilyPond, like all functions prefixed by ly:.
It is use to make a copy of a music expression. Here we copy event-chord (the parameter of
the function). Recall that our purpose is to add a marcato to an EventChord expression. It is
better to not modify the EventChord which was given as an argument, because it may be used
elsewhere.
Now we have a result-event-chord, which is a NoteEventChord expression and is a copy
of event-chord. We add the marcato to its elements list property.
Chapter 12: Interfaces for programmers 281
Bugs
The markup-list argument of commands such as #:line, #:center, and #:column cannot be a
variable or the result of a function call.
(markup #:line (function-that-returns-markups))
is invalid. One should use the make-line-markup, make-center-markup, or make-column-
markup functions instead,
(markup (make-line-markup (function-that-returns-markups)))
As a simple example, we show how to add a \smallcaps command, which selects a small
caps font. Normally we could select the small caps font,
\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 must define a function using
define-markup-command. The command should take a single argument of type markup. There-
fore the start of the definition should read
(define-markup-command (smallcaps layout props argument) (markup?)
What follows is the content of the command: we should interpret the argument as a markup,
i.e.,
(interpret-markup layout ... 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 moved a bit to the left and top. We will define a \character command which
takes into account the necessary translation and uses the newly defined \smallcaps command:
#(define-markup-command (character layout props name) (string?)
"Print the character name in small caps, translated to the left and
top. Syntax: \\character #\"name\""
(interpret-markup layout props
(markup #:hspace 0 #:translate (cons -3 1) #: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 (#:hspace 0) before the translated text. Now the #:hspace 0 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:
{
c''^\markup \character #"Cleopatra"
e'^\markup \character #"Giulio Cesare"
}
We have used the caps font shape, but suppose that our font 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:
Chapter 12: Interfaces for programmers 284
In this case, the procedure is executed as soon as the value of the property is requested during
the formatting process.
Most of the typesetting engine is driven by such callbacks. Properties that typically use
callbacks include
stencil The printing routine, that constructs a drawing for the symbol
X-offset The routine that sets the horizontal position
X-extent The routine that computes the width of an object
The procedure always takes a single argument, being the grob.
If routines with multiple arguments must be called, the current grob can be inserted with a
grob closure. Here is a setting from AccidentalSuggestion,
(X-offset .
,(ly:make-simple-closure
(,+
,(ly:make-simple-closure
(list ly:self-alignment-interface::centered-on-x-parent))
,(ly:make-simple-closure
(list ly:self-alignment-interface::x-aligned-on-self)))))
In this example, both ly:self-alignment-interface::x-aligned-on-self and ly:self-
alignment-interface::centered-on-x-parent are called with the grob as argument. The
results are added with the + function. To ensure that this addition is properly executed, the
whole thing is enclosed in ly:make-simple-closure.
In fact, using a single procedure as property value is equivalent to
(ly:make-simple-closure (ly:make-simple-closure (list proc )))
The inner ly:make-simple-closure supplies the grob as argument to proc, the outer ensures
that result of the function is returned, rather than the simple-closure object.
Chapter 13: Running LilyPond 286
13 Running LilyPond
This chapter details the technicalities of running LilyPond.
Some of these commands are run from the command-line. By command-line, we mean the
command line in the operating system. Windows users might be more familiar with the terms
DOS shell or command shell; OSX users might be more familiar with the terms terminal
or console. OSX users should also consult Section 13.2 [Notes for the MacOS X app], page 289.
Describing how to use this part of an operating system is outside the scope of this manual;
please consult other documentation on this topic if you are unfamiliar with the command-line.
ps for PostScript.
Postscript files include TTF, Type1 and OTF fonts. No subsetting of
these fonts is done. When using oriental character sets, this can lead to
huge files.
eps for encapsulated PostScript. This dumps every page (system) as a sepa-
rate EPS file, without fonts, and as one collated EPS file with all pages
(systems) including fonts.
This mode is used by default by lilypond-book.
svg for SVG (Scalable Vector Graphics). This dumps every page as a
separate SVG file, with embedded fonts. You need a SVG viewer
which supports embedded fonts, or a SVG viewer which is able to re-
place the embedded fonts with OTF fonts. Under Unix, you may use
Inkscape (version 0.42 or later), after copying the OTF fonts in directory
PATH/TO/share/lilypond/VERSION/fonts/otf/ to ~/.fonts/.
scm for a dump of the raw, internal Scheme-based drawing commands.
Example: lilypond -bsvg filename.ly
-d,--define-default=var =val
This sets the internal program option var to the Scheme value val. If val is not
supplied, then #t is used. To switch off an option, no- may be prefixed to var, e.g.
-dno-point-and-click
is the same as
-dpoint-and-click='#f'
Another notable option is
-dpaper-size=\"letter\"
Note that the string must be enclosed in escaped quotes ( \" ).
Setting the -dhelp option will print a summary of the options available, and exit.
-h,--help
Show a summary of usage.
-H,--header=FIELD
Dump a header field to file BASENAME.FIELD
--include, -I=directory
Add directory to the search path for input files.
-i,--init=file
Set init file to file (default: init.ly).
-o,--output=FILE
Set the default output file to FILE. The appropriate suffix will be added (ie .pdf
for pdf, .tex for tex, etc).
--ps Generate PostScript.
--dvi Generate DVI files. In this case, the TEX backend should be specified, i.e., -b tex.
--png Generate pictures of each page, in PNG format. This implies --ps. The resolution
in DPI of the image may be set with
-dresolution=110
--pdf Generate PDF. This implies --ps.
Chapter 13: Running LilyPond 288
--preview
Generate an output file containing the titles and the first system
--no-pages
Do not generate the full pages. Useful in combination with --preview.
-s,--safe
Do not trust the .ly input.
When LilyPond formatting is available through a web server, either the --safe or
the --jail option MUST be passed. The --safe option will prevent inline Scheme
code from wreaking havoc, for example
#(system "rm -rf /")
{
c4^#(ly:export (ly:gulp-file "/etc/passwd"))
}
The --safe option works by evaluating in-line Scheme expressions in a special safe
module. This safe module is derived from GUILE safe-r5rs module, but adds a
number of functions of the LilyPond API. These functions are listed in scm/safe
-lily.scm.
In addition, --safe disallows \include directives and disables the use of backslashes
in TEX strings.
In --safe mode, it is not possible to import LilyPond variables into Scheme.
--safe does not detect resource overuse. It is still possible to make the program
hang indefinitely, for example by feeding cyclic data structures into the backend.
Therefore, if using LilyPond on a publicly accessible webserver, the process should
be limited in both CPU and memory usage.
Note that --safe will prevent many useful LilyPond snippets from being compiled.
For a softer but secure alternative you can use the --jail option.
-j,--jail=user,group,jail,dir
Run LilyPond in a chroot jail.
The --jail option provides a more flexible alternative to --safe when LilyPond
formatting is available through a web server or whenever LilyPond executes exter-
nally provided sources.
The --jail option works by changing the root of LilyPond to jail just before starting
the actual compilation process. The user and group are then changed to match those
provided, and the current directory is changed to dir. This setup guarantees that
it is not possible (at least in theory) to escape from the jail. Note that for --jail
to work LilyPond must be run as root, which is usually accomplished in a safe way
using sudo.
Setting up a jail is a slightly delicate matter, as we must be sure that LilyPond is
able to find whatever it needs to compile the source inside the jail. A typical setup
comprises the following items:
Setting up a separate filesystem
A separate filesystem should be created for LilyPond, so that it can be
mounted with safe options such as noexec, nodev, and nosuid. In this
way, it is impossible to run executables or to write directly to a device
from LilyPond. If you do not want to create a separate partition, just
create a file of reasonable size and use it to mount a loop device. A
separate filesystem also guarantees that LilyPond cannot write more
space than it is allowed.
Chapter 13: Running LilyPond 289
Alternatively, you may create scripts which add the path automatically. Create a directory
to store these scripts,
mkdir -p ~/bin
cd ~/bin
Create a file called lilypond which contains
exec path/to /LilyPond.app/Contents/Resources/bin/lilypond "$@"
Create similar files lilypond-book, convert-ly, and any other helper programs you use
(abc2ly, midi2ly, etc). Simply replace the bin/lilypond with bin/convert-ly (or other
program name) in the above file.
Make the file executable,
chmod u+x lilypond
Now, add this directory to your path. Modify (or create) a file called .profile in your home
directory such that it contains
export PATH=$PATH:~/bin
This file should end with a blank line.
Note that path/to will generally be /Applications/.
-n,--no-version
Normally, convert-ly adds a \version indicator to the output. Specifying this
option suppresses this.
-s, --show-rules
Show all known conversions and exit.
--to=to-patchlevel
Set the goal version of the conversion. It defaults to the latest available version.
-h, --help
Print usage help.
Bugs
Not all language changes are handled. Only one output option can be specified. Automatically
updating scheme and lilypond scheme interfaces is quite unlikely; be prepared to tweak scheme
code manually.
There are a few things that the convert-ly cannot handle. Here's a list of
limitations
that the community has complained about.
This bug report structure has been chosen because convert-ly has a structure
that doesn't
allow to smoothly implement all needed changes. Thus this is just a wishlist,
placed
here for reference.
1.6->2.0:
Doesn't always convert figured bass correctly, specifically things like {<
>}. Mats' comment on working around this:
To be able to run convert-ly
on it, I first replaced all occurencies of '{<' to some dummy like '{#'
and similarly I replaced '>}' with '&}'. After the conversion, I could
then change back from '{ #' to '{ <' and from '& }' to '> }'.
Doesn't convert all text markup correctly. In the old markup syntax,
it was possible to group a number of markup commands together within
parentheses, e.g.
-#'((bold italic) "string")
This will incorrectly be converted into
-\markup{{\bold italic} "string"}
instead of the correct
-\markup{\bold \italic "string"}
2.0->2.2:
Doesn't handle \partcombine
Doesn't do \addlyrics => \lyricsto, this breaks some scores with multiple
stanzas.
2.0->2.4:
\magnify isn't changed to \fontsize.
- \magnify #m => \fontsize #f, where f = 6ln(m)/ln(2)
remove-tag isn't changed.
- \applyMusic #(remove-tag '. . .) => \keepWithTag #'. . .
first-page-number isn't changed.
Chapter 13: Running LilyPond 292
come in such big quantities that they obscure other output. In this case, file a
bug-report.
Aborted (core dumped)
This signals a serious programming error that caused the program to crash. Such
errors are considered critical. If you stumble on one, send a bug-report.
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 the offending line to indicate the column where the error was
found. For example,
test.ly:2:19: error: not a duration: 5:
{ c'4 e'5
g' }
These locations are LilyPonds best guess about where the warning or error occurred, but
(by their very nature) warnings and errors occur when something unexpected happens. If you
cant see an error in the indicated line of your input file, try checking one or two lines above the
indicated position.
\begin{document}
\begin{lilypond}
\relative c' {
c2 g'2 \times 2/3 { f8 e d } c'2 g4
}
\end{lilypond}
\begin[fragment,quote,staffsize=26,verbatim]{lilypond}
c'4 f16
\end{lilypond}
Larger examples can be put into a separate file, and introduced with
\verb+\lilypondfile+.
\lilypondfile[quote,noindent]{screech-boink.ly}
\end{document}
Under Unix, you can view the results as follows
cd input/tutorial
mkdir -p out/
lilypond-book --output=out --psfonts lilybook.tex
lilypond-book (GNU LilyPond) 2.6.0
Reading lilybook.tex...
Chapter 14: lilypond-book: Integrating text and music 296
1
This tutorial is processed with Texinfo, so the example gives slightly different results in layout.
Chapter 14: lilypond-book: Integrating text and music 297
Documents for lilypond-book may freely mix music and text. For example,
3
Larger examples can be put into a separate file, and introduced with \lilypondfile.
48
3
4
8
Chapter 14: lilypond-book: Integrating text and music 298
The short version
\lilypond[quote,fragment,staffsize=11]{<c' e' g'>}
produces
Currently, you cannot include { or } within \lilypond{}, so this command is only useful with
the fragment option.
The default line width of the music will be adjusted by examining the commands in the
document preamble, the part of the document before \begin{document}. The lilypond-book
command sends these to LaTEX to find out how wide the text is. The line width for the music
fragments is then adjusted to the text width. Note that this heuristic algorithm can fail easily;
in such cases it is necessary to use the line-width music fragment option.
Each snippet will call the following macros if they have been defined by the user:
\preLilyPondExample called before the music
\postLilyPondExample called after the music
\betweenLilyPondSystem[1] is called between systems if lilypond-book has split the snip-
pet into several postscript files. It must be defined as taking one parameter and will be passed the
number of files already included in this snippet. The default is to simply insert a \linebreak.
For printing the LaTEX document you need a DVI to PostScript translator like dvips. To
use dvips to produce a PostScript file, add the following options to the dvips command line:
Chapter 14: lilypond-book: Integrating text and music 299
-o -Ppdf -h file.psfonts
where the filepsfonts file is obtained from lilypond-book, See Section 14.7 [Invoking lilypond-
book], page 303, for details. PDF can then be produced with a PostScript to PDF translator
like ps2pdf (which is part of GhostScript). Running dvips will produce some warnings about
fonts; these are harmless and may be ignored.
If you are running latex in twocolumn mode, remember to add -t landscape to the dvips
options.
Sometimes it is useful to display music elements (such as ties and slurs) as if they continued
after the end of the fragment. This can be done by breaking the staff and suppressing inclusion
of the rest of the lilypond output.
In LaTEX, define \betweenLilyPondSystem in such a way that inclusion of other systems is
terminated once the required number of systems are included. Since \betweenLilypondSystem
is first called after the first system, including only the first system is trivial.
\def\betweenLilyPondSystem#1{\endinput}
\begin[fragment]{lilypond}
c'1\( e'( c'~ \break c' d) e f\)
\end{lilypond}
If a greater number of systems is requested, a TeX conditional must be used before the
\endinput. In this example, replace "2" by the numer of systems you want in the output,
\def\betweenLilyPondSystem#1{
\ifnum##1<2\else\endinput\fi
}
Remember that the definition of \betweenLilyPondSystem is effective until TEX quits the
current group (such as the LaTEX environment) or is overridden by another definition (which
is, in most cases, for the rest of the document). To reset your definition, write
\let\betweenLilyPondSystem\undefined
in your LaTeX source.
This may be simplified by defining a TEX macro
\def\onlyFirstNSystems#1{
\def\betweenLilyPondSystem##1{\ifnum##1<#1\else\endinput\fi}
}
and then saying only how many systems you want before each fragment,
\onlyFirstNSystems{3}
\begin{lilypond}...\end{lilypond}
\onlyFirstNSystems{1}
\begin{lilypond}...\end{lilypond}
Contrary to LaTEX, @lilypond{...} does not generate an in-line image. It always gets a
paragraph of its own.
When using the Texinfo output format, lilypond-book also generates bitmaps of the music
(in PNG format), so you can make an HTML document with embedded music.
For inline pictures, use <lilypond ... />, where the options are separated by a colon from
the music, for example
Some music in <lilypond relative=2: a b c/> a line of text.
To include separate files, say
<lilypondfile option1 option2 ...>filename </lilypondfile>
Chapter 14: lilypond-book: Integrating text and music 301
Common conventions
For inserting all type of snippets we use the mediaobject and inlinemediaobject element, so
our snippets can be formatted inline or not inline. The snippet formatting options are always
provided in the role property of the innermost element (see in next sections). Tags are chosen
to allow DocBook editors format the content gracefully. The DocBook files to be processed with
lilypond-book should have the extension .lyxml.
Note that the option string is parsed from left to right; if an option occurs multiple times,
the last one is taken.
The following options are available for LilyPond commands:
staffsize=ht
Set staff size to ht, which is measured in points.
ragged-right
Produce ragged-right lines with natural spacing (i.e., ragged-right = ##t is added
to the LilyPond snippet). This is the default for the \lilypond{} command if no
line-width option is present. It is also the default for the lilypond environment
if the fragment option is set, and no line width is explicitly specified.
packed Produce lines with packed spacing (i.e., packed = ##t is added to the LilyPond
snippet).
line-width
line-width=size \unit
Set line width to size, using unit as units. unit is one of the following strings: cm,
mm, in, or pt. This option affects LilyPond output (this is, the staff length of the
music snippet), not the text layout.
If used without an argument, set line width to a default value (as computed with a
heuristic algorithm).
If no line-width option is given, lilypond-book tries to guess a default for
lilypond environments which dont use the ragged-right option.
notime Do not print the time signature, and turns off the timing (key signature, bar lines)
in the score.
fragment Make lilypond-book add some boilerplate code so that you can simply enter, say,
c'4
without \layout, \score, etc.
nofragment
Dont add additional code to complete LilyPond code in music snippets. Since this
is the default, nofragment is redundant normally.
indent=size \unit
Set indentation of the first music system to size, using unit as units. unit is one of
the following strings: cm, mm, in, or pt. This option affects LilyPond, not the text
layout.
noindent Set indentation of the first music system to zero. This option affects LilyPond, not
the text layout. Since no indentation is the default, noindent is redundant normally.
quote Reduce line length of a music snippet by 20.4 in and put the output into a quotation
block. The value 0.4 in can be controlled with the exampleindent option.
exampleindent
Set the amount by which the quote option indents a music snippet.
relative
relative=n
Use relative octave mode. By default, notes are specified relative to middle C. The
optional integer argument specifies the octave of the starting note, where the default
1 is middle C.
LilyPond also uses lilypond-book to produce its own documentation. To do that, some
more obscure music fragment options are available.
Chapter 14: lilypond-book: Integrating text and music 303
verbatim The argument of a LilyPond command is copied to the output file and enclosed
in a verbatim block, followed by any text given with the intertext option (not
implemented yet); then the actual music is displayed. This option does not work
well with \lilypond{} if it is part of a paragraph.
texidoc (Only for Texinfo output.) If lilypond is called with the --header=texidoc
option, and the file to be processed is called foo.ly, it creates a file foo.texidoc
if there is a texidoc field in the \header. The texidoc option makes lilypond-
book include such files, adding its contents as a documentation block right before
the music snippet.
Assuming the file foo.ly contains
\header {
texidoc = "This file demonstrates a single note."
}
{ c'4 }
and we have this in our Texinfo document test.texinfo
@lilypondfile[texidoc]{foo.ly}
the following command line gives the expected result
lilypond-book --process="lilypond --format=tex --tex \
--header=texidoc test.texinfo
Most LilyPond test documents (in the input directory of the distribution) are
small .ly files which look exactly like this.
printfilename
If a LilyPond input file is included with \lilypondfile, print the file name right
before the music snippet. For HTML output, this is a link.
fontload This option includes fonts in all of the generated EPS-files for this snippet. This
should be used if the snippet uses any font that LaTeX cannot find on its own.
-f format
--format=format
Specify the document type to process: html, latex, texi (the default) or docbook.
If this option is missing, lilypond-book tries to detect the format 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 instead.
[Note: Currently, texi is the same as texi-html.]
-F filter
--filter=filter
Pipe snippets through filter. lilypond-book will not filter and process at the
same time.
Example:
lilypond-book --filter='convert-ly --from=2.0.0 -' my-book.tely
-h
--help Print a short help message.
-I dir
--include=dir
Add dir to the include path.
-o dir
--output=dir
Place generated files in directory dir. 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
...
--padding=amount
Pad EPS boxes by this much. amount is measured in milimeters, and is 3.0 by
default. This option should be used if the lines of music stick out of the right
margin.
The width of a tightly clipped systems can vary, due to notation elements that stick
into the left margin, such as bar numbers and instrument names. This option will
shorten each line and move each line to the right by the same amount.
-P process
--process=command
Process LilyPond snippets using command. The default command is lilypond.
lilypond-book will not filter and process at the same time.
--psfonts
extract all PostScript fonts into file.psfonts for dvips. This is necessary for
dvips -h file.psfonts.
-V
--verbose
Be verbose.
-v
--version
Print version information.
Chapter 14: lilypond-book: Integrating text and music 305
Bugs
The Texinfo command @pagesizes is not interpreted. Similarly, LaTEX commands that change
margins and line widths after the preamble are ignored.
Only the first \score of a LilyPond block is processed.
{ c1 }
To produce a useful eps file, use
lilypond -b eps -dno-gs-load-fonts -dinclude-eps-fonts myfile.ly
Chapter 15: Converting from other formats 306
Bugs
Overlapping notes in an arpeggio will not be correctly rendered. The first note will be read and
the others will be ignored. Set them all to a single duration and add phrase markings or pedal
indicators.
Bugs
The list of articulation scripts is incomplete. Empty measures confuse etf2ly. Sequences of
grace notes are ended improperly.
-o,--output=file
set output filename to file. (default: print to stdout)
-v,--version
print version information.
Bugs
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.
1
In Scheme terminology, the pair is called cons, and its two elements are called car and cdr respectively.
Appendix C: Notation manual tables 312
3 5
Ignatzek (default) C Cm C+ C
3 5
Alternative C C C C
7 7 o7 / 5
7
Def C Cm C C Cm
7 7 3 3 5 7 3 5 7
Alt 5 C C C C C
7/ 5 / 5
5 7
Def C Cm C C
7 5 3 7 7 3 5
Alt10 C C C C
6 6 9 9
Def C Cm C Cm
6 36 9 9 3
Alt14 C C C C
13 11 7/ 5/9 7/ 9
Def Cm Cm Cm C
13 3 11 3 9 3 5 7 9
C C C C
Alt18
Appendix C: Notation manual tables 313
7/ 9 11 7/ 11 13
Def C C C C
7 9 11 9 11 13
C C C C
Alt22
7/ 11/ 13 7/ 5/ 9 7/ 9/ 11
7/ 13
Def C C C C
9 11 13 7 5 9 7 9 11 11 13
C C C C
Alt
26
7/ 9/ 13
7/ 11 /9 7/ 13
Def C C C C
11 9 13 9 11 9 7 11 13
C C C C
Alt
7/ 9/ 13 7/ 9/13 /9 /13
Def C C C C
11 9 13 13 9 9 7 13 7
Alt C C C C
/ 11 7/ 9/13 sus4 7/sus4
Def C C C C
9 7 11 13 9 add4 5 add4 5 7
Alt38 C C C C
Def C C Cm
add4 5 7 9 add9 3 add11
Alt42 C C C
Appendix C: Notation manual tables 314
X color names
X color names come several variants:
Any name that is spelled as a single word with capitalisation (e.g. LightSlateBlue) can
also be spelled as space separated words without capitalisation (e.g. light slate blue).
The word grey can always be spelled gray (e.g. DarkSlateGray).
Some names can take a numerical suffix (e.g. LightSalmon4).
Grey Scale
A grey scale can be obtained using:
greyN
.notdef space
plus + comma ,
hyphen - period .
zero 0 one 1
two 2 three 3
four 4 five 5
six 6 seven 7
eight 8 nine 9
f f m m
p p r r
s s z z
rests.0 rests.1
rests.0o rests.1o
rests.M3 rests.M2
rests.M1 rests.2
rests.2classical rests.3
rests.4 rests.5
rests.6 rests.7
accidentals.2 accidentals.1
accidentals.3
accidentals.0
accidentals.M2 accidentals.M1
accidentals.M4 accidentals.M3
accidentals.4 accidentals.rightparen
accidentals.leftparen arrowheads.open.01
arrowheads.open.0M1 arrowheads.open.11
arrowheads.open.1M1 [ arrowheads.close.01 \
arrowheads.close.0M1 Y arrowheads.close.11 Z
arrowheads.close.1M1 W dots.dot X
noteheads.uM2 U noteheads.dM2 V
noteheads.sM1 S noteheads.s0 T
noteheads.s1 Q noteheads.s2 R
noteheads.s0diamond O noteheads.s1diamond P
noteheads.s2diamond M noteheads.s0triangle N
noteheads.d1triangle K noteheads.u1triangle L
noteheads.u2triangle I noteheads.d2triangle J
noteheads.s0slash G noteheads.s1slash H
noteheads.s2slash E noteheads.s0cross F
noteheads.s1cross C noteheads.s2cross D
noteheads.s2xcircle A noteheads.s0do B
noteheads.d1do ? noteheads.u1do @
noteheads.d2do = noteheads.u2do >
noteheads.s0re ; noteheads.u1re <
noteheads.d1re / noteheads.u2re :
noteheads.d2re ) noteheads.s0mi *
noteheads.s1mi ' noteheads.s2mi (
noteheads.u0fa % noteheads.d0fa &
noteheads.u1fa # noteheads.d1fa $
noteheads.u2fa ! noteheads.d2fa "
Appendix D: Templates 318
Appendix D Templates
This section of the manual contains templates with the LilyPond score already set up for you.
Just add notes, run LilyPond, and enjoy beautiful printed scores!
a4 b c d
}
\score {
\new Staff \melody
\layout { }
\midi {}
}
a4 b c d
}
text = \lyricmode {
Aaa Bee Cee Dee
}
\score{
<<
\new Voice = "one" {
Appendix D: Templates 319
\autoBeamOff
\melody
}
\new Lyrics \lyricsto "one" \text
>>
\layout { }
\midi { }
}
Aaa Bee Cee Dee
f4 e8[ c] d4 g |
a2 ~ a2 |
}
harmonies = \chordmode {
c4:m f:min7 g:maj c:aug d2:dim b:sus
}
\score {
<<
\new ChordNames {
\set chordChanges = ##t
\harmonies
}
\new Staff \melody
>>
\layout{ }
\midi { }
}
7 o
Cm Fm G C+ D B
Appendix D: Templates 320
a b c d
}
text = \lyricmode {
Aaa Bee Cee Dee
}
harmonies = \chordmode {
a2 c2
}
\score {
<<
\new ChordNames {
\set chordChanges = ##t
\harmonies
}
\new Voice = "one" {
\autoBeamOff
\melody
}
\new Lyrics \lyricsto "one" \text
>>
\layout { }
\midi { }
}
A C
Aaa Bee Cee Dee
\time 4/4
a b c d
}
lower = \relative c {
\clef bass
\key c \major
\time 4/4
a2 c
}
\score {
\new PianoStaff <<
\set PianoStaff.instrumentName = "Piano "
\new Staff = "upper" \upper
\new Staff = "lower" \lower
>>
\layout { }
\midi { }
}
Piano
a b c d
}
text = \lyricmode {
Aaa Bee Cee Dee
}
\time 4/4
a b c d
}
lower = \relative c {
\clef bass
\key c \major
\time 4/4
a2 c
}
\score {
<<
\new Voice = "mel" {
\autoBeamOff
\melody
}
\new Lyrics \lyricsto mel \text
Aaa Bee Cee Dee
D.2.3 Piano centered lyrics
Instead of having a full staff for the melody and lyrics, you can place the lyrics between the
piano staff (and omit the separate melody staff).
\version "2.10.10"
upper = \relative c'' {
\clef treble
Appendix D: Templates 323
\key c \major
\time 4/4
a b c d
}
lower = \relative c {
\clef bass
\key c \major
\time 4/4
a2 c
}
text = \lyricmode {
Aaa Bee Cee Dee
}
\score {
\new GrandStaff <<
\new Staff = upper { \new Voice = "singer" \upper }
\new Lyrics \lyricsto "singer" \text
\new Staff = lower {
\clef bass
\lower
}
>>
\layout {
\context { \GrandStaff \accepts "Lyrics" }
\context { \Lyrics \consists "Bar_engraver" }
}
\midi { }
}
Aaa Bee Cee Dee
\time 4/4
a b c d
}
lower = \relative c {
\clef bass
\key c \major
\time 4/4
a2 c
}
dynamics = {
s2\fff\> s4
s\!\pp
}
pedal = {
s2\sustainDown s2\sustainUp
}
\score {
\new PianoStaff <<
\new Staff = "upper" \upper
\new Dynamics = "dynamics" \dynamics
\new Staff = "lower" <<
\clef bass
\lower
>>
\new Dynamics = "pedal" \pedal
>>
\layout {
\context {
\type "Engraver_group"
\name Dynamics
\alias Voice % So that \cresc works, for example.
\consists "Output_property_engraver"
\consists "Piano_pedal_engraver"
\consists "Script_engraver"
\consists "Dynamic_engraver"
\consists "Text_engraver"
\consists "Skip_event_swallow_translator"
\consists "Axis_group_engraver"
}
\context {
\PianoStaff
\accepts Dynamics
\override VerticalAlignment #'forced-distance = #7
}
}
}
\score {
\new PianoStaff <<
\new Staff = "upper" << \upper \dynamics >>
\new Staff = "lower" << \lower \dynamics >>
\new Dynamics = "pedal" \pedal
>>
\midi {
\context {
\type "Performer_group"
\name Dynamics
\consists "Piano_pedal_performer"
}
\context {
\PianoStaff
\accepts Dynamics
}
}
}
fff pp
D.3 String quartet
D.3.1 String quartet
This template demonstrates a string quartet. It also uses a \global section for time and key
signatures.
\version "2.10.10"
global= {
\time 4/4
Appendix D: Templates 326
\key c \major
}
c2 d e1
\bar "|." }}
violinTwo = \new Voice { \relative c''{
\set Staff.instrumentName = "Violin 2 "
g2 f e1
\bar "|." }}
viola = \new Voice { \relative c' {
\set Staff.instrumentName = "Viola "
\clef alto
e2 d c1
\bar "|." }}
cello = \new Voice { \relative c' {
\set Staff.instrumentName = "Cello "
\clef bass
c2 b a1
\bar "|."}}
\score {
\new StaffGroup <<
\new Staff << \global \violinOne >>
\new Staff << \global \violinTwo >>
\new Staff << \global \viola >>
\new Staff << \global \cello >>
>>
\layout { }
\midi { }
}
Appendix D: Templates 327
Violin 1
Violin 2
Viola
Cello
D.3.2 String quartet parts
The previous example produces a nice string quartet, but what if you needed to print parts?
This template demonstrates how to use the \tag feature to easily split a piece into individual
parts.
You need to split this template into separate files; the filenames are contained in comments
at the beginning of each file. piece.ly contains all the music definitions. The other files
score.ly, vn1.ly, vn2.ly, vla.ly, and vlc.ly produce the appropiate part.
%%%%% piece.ly
\version "2.10.10"
global= {
\time 4/4
\key c \major
}
c2 d e1
g2 f e1
e2 d c1
c2 b a1
Appendix D: Templates 328
music = {
<<
\tag #'score \tag #'vn1 \new Staff { << \global \Violinone >> }
\tag #'score \tag #'vn2 \new Staff { << \global \Violintwo>> }
\tag #'score \tag #'vla \new Staff { << \global \Viola>> }
\tag #'score \tag #'vlc \new Staff { << \global \Cello>> }
>>
}
%%%%% score.ly
\version "2.10.10"
\include "piece.ly"
#(set-global-staff-size 14)
\score {
\new StaffGroup \keepWithTag #'score \music
\layout { }
\midi { }
}
%%%%% vn1.ly
\version "2.10.10"
\include "piece.ly"
\score {
\keepWithTag #'vn1 \music
\layout { }
}
%%%%% vn2.ly
\version "2.10.10"
\include "piece.ly"
\score {
\keepWithTag #'vn2 \music
\layout { }
}
%%%%% vla.ly
\version "2.10.10"
\include "piece.ly"
\score {
\keepWithTag #'vla \music
\layout { }
}
%%%%% vlc.ly
Appendix D: Templates 329
\version "2.10.10"
\include "piece.ly"
\score {
\keepWithTag #'vlc \music
\layout { }
}
bassMusic = \relative c {
c4 c g c
}
bassWords = \lyricmode {
ho ho ho ho
}
\score {
\new ChoirStaff <<
\new Lyrics = sopranos { s1 }
\new Staff = women <<
Appendix D: Templates 330
\new Voice =
"sopranos" { \voiceOne << \global \sopMusic >> }
\new Voice =
"altos" { \voiceTwo << \global \altoMusic >> }
>>
\new Lyrics = "altos" { s1 }
\new Lyrics = "tenors" { s1 }
\new Staff = men <<
\clef bass
\new Voice =
"tenors" { \voiceOne <<\global \tenorMusic >> }
\new Voice =
"basses" { \voiceTwo <<\global \bassMusic >> }
>>
\new Lyrics = basses { s1 }
\layout {
\context {
% a little smaller so lyrics
% can be closer to the staff
\Staff
\override VerticalAxisGroup #'minimum-Y-extent = #'(-3 . 3)
}
}
}
hi hi hi hi
ha ha ha ha
hu hu hu hu
ho ho ho ho
\version "2.10.10"
global = {
\key c \major
\time 4/4
}
bassMusic = \relative c {
c4 c g c
}
bassWords = \lyricmode {
ho ho ho ho
}
\score {
<<
\new ChoirStaff <<
\new Lyrics = sopranos { s1 }
\new Staff = women <<
\new Voice =
"sopranos" { \voiceOne << \global \sopMusic >> }
\new Voice =
"altos" { \voiceTwo << \global \altoMusic >> }
>>
\new Lyrics = "altos" { s1 }
\new Lyrics = "tenors" { s1 }
\new Staff = men <<
\clef bass
\new Voice =
"tenors" { \voiceOne <<\global \tenorMusic >> }
\new Voice =
"basses" { \voiceTwo <<\global \bassMusic >> }
Appendix D: Templates 332
>>
\new Lyrics = basses { s1 }
hi hi hi hi
ha ha ha ha
hu hu hu hu
ho ho ho ho
bassMusic = \relative c {
c4 c g c
}
bassWords = \lyricmode {
Appendix D: Templates 334
ho ho ho ho
}
\score {
\new ChoirStaff <<
\new Staff = women <<
\new Voice =
"sopranos" { \voiceOne << \global \sopMusic >> }
\new Voice =
"altos" { \voiceTwo << \global \altoMusic >> }
>>
\new Lyrics \with {alignAboveContext=women} \lyricsto sopranos \sopWords
\new Lyrics \with {alignBelowContext=women} \lyricsto altos \altoWords
% we could remove the line about this with the line below, since we want
% the alto lyrics to be below the alto Voice anyway.
% \new Lyrics \lyricsto altos \altoWords
\layout {
\context {
% a little smaller so lyrics
% can be closer to the staff
\Staff
\override VerticalAxisGroup #'minimum-Y-extent = #'(-3 . 3)
}
}
}
\score {
\new ChoirStaff <<
\new Staff = women <<
\new Voice =
"sopranos" { \voiceOne << \global \sopMusic >> }
\new Voice =
"altos" { \voiceTwo << \global \altoMusic >> }
>>
\layout {
\context {
% a little smaller so lyrics
% can be closer to the staff
\Staff
\override VerticalAxisGroup #'minimum-Y-extent = #'(-3 . 3)
}
}
}
hi hi hi hi
ha ha ha ha
hu hu hu hu
ho ho ho ho
global = {
\set Score.skipBars = ##t
Appendix D: Templates 336
% incipit
\once \override Score.SystemStartBracket #'transparent = ##t
\override Score.SpacingSpanner #'spacing-increment = #1.0 % tight spacing
\key f \major
\time 2/2
\once \override Staff.TimeSignature #'style = #'neomensural
\override Voice.NoteHead #'style = #'neomensural
\override Voice.Rest #'style = #'neomensural
\set Staff.printKeyCancellation = ##f
\cadenzaOn % turn off bar lines
\skip 1*10
\once \override Staff.BarLine #'transparent = ##f
\bar "||"
\skip 1*1 % need this extra \skip such that clef change comes
% after bar line
\bar ""
% main
\revert Score.SpacingSpanner #'spacing-increment % CHECK: no effect?
\cadenzaOff % turn bar lines on again
\once \override Staff.Clef #'full-size-change = ##t
\set Staff.forceClef = ##t
\key g \major
\time 4/4
\override Voice.NoteHead #'style = #'default
\override Voice.Rest #'style = #'default
% finis bar
\bar "|."
}
discantusNotes = {
\transpose c' c'' {
\set Staff.instrumentName = "Discantus "
% incipit
\clef "neomensural-c1"
c'1. s2 % two bars
\skip 1*8 % eight bars
\skip 1*1 % one bar
Appendix D: Templates 337
% main
\clef "treble"
d'2. d'4 |
b e' d'2 |
c'4 e'4.( d'8 c' b |
a4) b a2 |
b4.( c'8 d'4) c'4 |
\once \override NoteHead #'transparent = ##t c'1 |
b\breve |
}
}
discantusLyrics = \lyricmode {
% incipit
IV-
% main
Ju -- bi -- |
la -- te De -- |
o, om --
nis ter -- |
ra, __ om- |
"..." |
-us. |
}
altusNotes = {
\transpose c' c'' {
\set Staff.instrumentName = "Altus "
% incipit
\clef "neomensural-c3"
r1 % one bar
f1. s2 % two bars
\skip 1*7 % seven bars
\skip 1*1 % one bar
% main
\clef "treble"
r2 g2. e4 fis g | % two bars
a2 g4 e |
fis g4.( fis16 e fis4) |
g1 |
\once \override NoteHead #'transparent = ##t g1 |
g\breve |
}
}
altusLyrics = \lyricmode {
% incipit
IV-
Appendix D: Templates 338
% main
Ju -- bi -- la -- te | % two bars
De -- o, om -- |
nis ter -- ra, |
"..." |
-us. |
}
tenorNotes = {
\transpose c' c' {
\set Staff.instrumentName = "Tenor "
% incipit
\clef "neomensural-c4"
r\longa % four bars
r\breve % two bars
r1 % one bar
c'1. s2 % two bars
\skip 1*1 % one bar
\skip 1*1 % one bar
% main
\clef "treble_8"
R1 |
R1 |
R1 |
r2 d'2. d'4 b e' | % two bars
\once \override NoteHead #'transparent = ##t e'1 |
d'\breve |
}
}
tenorLyrics = \lyricmode {
% incipit
IV-
% main
Ju -- bi -- la -- te | % two bars
"..." |
-us. |
}
bassusNotes = {
\transpose c' c' {
\set Staff.instrumentName = "Bassus "
% incipit
\clef "bass"
r\maxima % eight bars
f1. s2 % two bars
\skip 1*1 % one bar
Appendix D: Templates 339
% main
\clef "bass"
R1 |
R1 |
R1 |
R1 |
g2. e4 |
\once \override NoteHead #'transparent = ##t e1 |
g\breve |
}
}
bassusLyrics = \lyricmode {
% incipit
IV-
% main
Ju -- bi- |
"..." |
-us. |
}
\score {
\new StaffGroup = choirStaff <<
\new Voice =
"discantusNotes" << \global \discantusNotes >>
\new Lyrics =
"discantusLyrics" \lyricsto discantusNotes { \discantusLyrics }
\new Voice =
"altusNotes" << \global \altusNotes >>
\new Lyrics =
"altusLyrics" \lyricsto altusNotes { \altusLyrics }
\new Voice =
"tenorNotes" << \global \tenorNotes >>
\new Lyrics =
"tenorLyrics" \lyricsto tenorNotes { \tenorLyrics }
\new Voice =
"bassusNotes" << \global \bassusNotes >>
\new Lyrics =
"bassusLyrics" \lyricsto bassusNotes { \bassusLyrics }
>>
\layout {
\context {
\Score
% no bars in staves
\override BarLine #'transparent = ##t
\context {
\Voice
% no slurs
\override Slur #'transparent = ##t
Discantus
IV- Ju bi la te De
Altus
IV- Ju bi la te
Tenor
8
IV-
Bassus
IV-
Appendix D: Templates 341
3
o, om nis ter ra, om- ... -us.
De o, om nis ter ra, ... -us.
8
Ju bi la te ... -us.
Ju bi- ... -us.
verba = \lyricmode {
Lo -- rem ip -- sum do -- lor sit a -- met
}
\score {
\new Staff <<
\new Voice = "melody" {
\chant
}
\new Lyrics = "one" \lyricsto melody \verba
>>
\layout {
\context {
\Staff
\remove "Time_signature_engraver"
\remove "Bar_engraver"
\override Stem #'transparent = ##t
}
\context {
\Voice
Appendix D: Templates 342
Lo rem ip sum do lor sit a met
#(set-global-staff-size 16)
\include "english.ly"
sl = {
\override NoteHead #'style = #'slash
\override Stem #'transparent = ##t
}
nsl = {
\revert NoteHead #'style
\revert Stem #'transparent
}
cr = \override NoteHead #'style = #'cross
ncr = \revert NoteHead #'style
Appendix D: Templates 343
jzchords = { }
global = {
\time 4/4
}
\Key
c1 c \sl d4^"Solo" d d d \nsl
}
bariharmony = \transpose c' a \chordmode {
\jzchords s1 s d2:maj e:m7
}
barisax = {
\global
\set Staff.instrumentName = #"Bari Sax"
\clef treble
<<
\bari
>>
}
PianoRH = {
\clef treble
\global
\set Staff.midiInstrument = "acoustic grand"
<<
\new Voice = "one" \rhUpper
\new Voice = "two" \rhLower
>>
}
PianoLH = {
\clef bass
\global
\set Staff.midiInstrument = "acoustic grand"
<<
\new Voice = "one" \lhUpper
\new Voice = "two" \lhLower
>>
}
piano = {
<<
\set PianoStaff.instrumentName = #"Piano"
\new Staff = "upper" \PianoRH
\new Staff = "lower" \PianoLH
>>
}
\Key
c1 c c
}
bass = {
\global
\set Staff.instrumentName = #"Bass"
\clef bass
<<
\Bass
>>
}
down = \drummode {
bd4 s bd s bd s bd s bd s bd s
}
drumContents = {
\global
<<
\set DrumStaff.instrumentName = #"Drums"
\new DrumVoice { \voiceOne \up }
\new DrumVoice { \voiceTwo \down }
>>
}
\score {
<<
\new StaffGroup = "horns" <<
\new Staff = "trumpet" \trumpet
\new Staff = "altosax" \altosax
\new ChordNames = "barichords" \bariharmony
\new Staff = "barisax" \barisax
\new Staff = "trombone" \trombone
>>
>>
\layout {
\context { \RemoveEmptyStaffContext }
\context {
\Score
\override BarNumber #'padding = #3
\override RehearsalMark #'padding = #2
skipBars = ##t
}
}
\midi { }
}
Song
(tune)
Me
moderato
Swing
Trumpet
Alto Sax
7
B C m
Solo
Bari Sax
Trombone
/9
Cm D
Guitar
Piano
Bass
Drums
Appendix D: Templates 348
D.7.1 LaTeX
You can include LilyPond fragments in a LaTeX document.
\documentclass[]{article}
\begin{document}
\begin{lilypond}
\relative c'' {
a4 b c d
}
\end{lilypond}
\begin{lilypond}
\relative c'' {
d4 c b a
}
\end{lilypond}
\end{document}
D.7.2 Texinfo
You can include LilyPond fragments in Texinfo; in fact, this entire manual is written in Texinfo.
\input texinfo
@node Top
Texinfo text
@lilypond[verbatim,fragment,ragged-right]
a4 b c d
@end lilypond
@lilypond[verbatim,fragment,ragged-right]
d4 c b a
@end lilypond
@bye
Appendix E: Cheat sheet 349
1 2 8 16 durations
c4. c4.. augmentation dots
cdefgab scale
3
4
r4 r8 rest
d~d tie
Appendix E: Cheat sheet 350
note' raise octave
c( d e) slur
a8[ b] beam
c-> c-. articulations
Appendix E: Cheat sheet 351
mfsfz
a\< a a\! crescendo
<> chord
\partial 8 upstep
3
twinkle
Appendix E: Cheat sheet 352
twin kle
\context ChordNames printing chord names
o
C F
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 propri-
etary 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 works title, preceding the beginning of the
body of the text.
2. VERBATIM COPYING
You may copy and distribute the Document in any medium, either commercially or noncom-
mercially, 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.
3. COPYING IN QUANTITY
If you publish printed copies of the Document numbering more than 100, and the Docu-
ments 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.
Appendix F: GNU Free Documentation License 355
4. MODIFICATIONS
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:
A. Use in the Title Page (and on the covers, if any) a title distinct from that of the
Document, and from those of previous versions (which should, if there were any, be
listed in the History section of the Document). You may use the same title as a previous
version if the original publisher of that version gives permission.
B. List on the Title Page, as authors, one or more persons or entities responsible for
authorship of the modifications in the Modified Version, together with at least five of
the principal authors of the Document (all of its principal authors, if it has less than
five).
C. State on the Title page the name of the publisher of the Modified Version, as the
publisher.
D. Preserve all the copyright notices of the Document.
E. Add an appropriate copyright notice for your modifications adjacent to the other copy-
right notices.
F. Include, immediately after the copyright notices, a license notice giving the public
permission to use the Modified Version under the terms of this License, in the form
shown in the Addendum below.
G. Preserve in that license notice the full lists of Invariant Sections and required Cover
Texts given in the Documents license notice.
H. Include an unaltered copy of this License.
I. Preserve the section entitled History, and its title, and add to it an item stating at
least the title, year, new authors, and publisher of the Modified Version as given on the
Title Page. If there is no section entitled History in the Document, create one stating
the title, year, authors, and publisher of the Document as given on its Title Page, then
add an item describing the Modified Version as stated in the previous sentence.
J. Preserve the network location, if any, given in the Document for public access to a
Transparent copy of the Document, and likewise the network locations given in the
Document for previous versions it was based on. These may be placed in the History
section. You may omit a network location for a work that was published at least four
years before the Document itself, or if the original publisher of the version it refers to
gives permission.
K. In any section entitled Acknowledgments or Dedications, preserve the sections
title, and preserve in the section all the substance and tone of each of the contributor
acknowledgments and/or dedications given therein.
L. Preserve all the Invariant Sections of the Document, unaltered in their text and in their
titles. Section numbers or the equivalent are not considered part of the section titles.
M. Delete any section entitled Endorsements. Such a section may not be included in the
Modified Version.
N. Do not retitle any existing section as Endorsements or to conflict in title with any
Invariant Section.
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
Appendix F: GNU Free Documentation License 356
the list of Invariant Sections in the Modified Versions license notice. These titles must be
distinct from any other section titles.
You may add a section entitled Endorsements, provided it contains nothing but endorse-
ments of your Modified Version by various partiesfor 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.
5. COMBINING DOCUMENTS
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.
6. COLLECTIONS OF DOCUMENTS
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.
7. AGGREGATION WITH INDEPENDENT WORKS
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 Documents 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.
Appendix F: GNU Free Documentation License 357
8. TRANSLATION
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.
9. TERMINATION
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.
10. FUTURE REVISIONS OF THIS LICENSE
The Free Software Foundation may publish new, revised versions of the GNU Free Doc-
umentation 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.
Appendix F: GNU Free Documentation License 358
! \alternative. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 \applyContext . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284
\applyOutput. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284
\arpeggio . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
# \arpeggioBracket . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
# ............................................ 310 \arpeggioDown . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
##f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 310 \arpeggioNeutral . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
##t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 310 \arpeggioUp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
#'symbol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311 \ascendens . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
#(set-accidental-style 'piano-cautionary) . . 215 \auctum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
\augmentum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
\autoBeamOff. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
\autoBeamOn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
\bar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
' . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 \book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236
\break . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252
\breve . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
( \cadenzaOff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
(begin * * * *) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215 \cadenzaOn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
(end * * * *) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215 \caesura . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
\cavum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
\clef . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
, \context . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
, . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 \deminutum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
\denies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227
\descendens . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
. \displayLilyMusc . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66 \displayLilyMusic . . . . . . . . . . . . . . . . . . . . . . . . . . . 276
\displayMusic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276
\divisioMaior . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
/ \divisioMaxima . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
/ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115 \divisioMinima . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
/+ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115 \dorian . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
\dotsDown . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
\dotsNeutral . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
? \dotsUp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 \dynamicDown. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
\dynamicNeutral . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
\dynamicUp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
[ \emptyText . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
\f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
[ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
\fatText . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
\ff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
] \fff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
\ffff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 \finalis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
\flexa . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
\fp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
\frenchChords . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
_ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120 \germanChords . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
\glissando . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
\grace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
\ \header in LaTEX documents . . . . . . . . . . . . . . . . . . . 298
\! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 \hideNotes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
\< . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 \hideStaffSwitch . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
\> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 \inclinatum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
\\ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70 \include . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238
\accepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227 \ionian . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
\aeolian . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 \italianChords . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
\afterGrace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92 \key . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77, 209
\aikenHeads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209 \layout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251
Appendix G: LilyPond command index 360
C O
chordNameExceptions . . . . . . . . . . . . . . . . . . . . . . . . . 117 oddFooterMarkup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242
chordNameSeparator . . . . . . . . . . . . . . . . . . . . . . . . . . 117 oddHeaderMarkup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242
chordNoteNamer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117 opus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239
chordPrefixSpacer . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
chordRootNamer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
common-shortest-duration . . . . . . . . . . . . . . . . . . . . 266 P
composer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239
page-spacing-weight . . . . . . . . . . . . . . . . . . . . . . . . . 249
convert-ly . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290
page-top-space . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247
copyright . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239
currentBarNumber . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189 paper-height. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246
paper-width . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246
papersize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246
D piano accidentals. . . . . . . . . . . . . . . . . . . . . . . . . . . . 214
dedication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239 piece . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239
defaultBarType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81 pipeSymbol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
dim . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114 poet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239
print-first-page-number . . . . . . . . . . . . . . . . . . . . . 246
print-page-number . . . . . . . . . . . . . . . . . . . . . . . . . . . 246
E printallheaders . . . . . . . . . . . . . . . . . . . . . . . . . 242, 248
evenFooterMarkup . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242
evenHeaderMarkup . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242
R
r . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
F R . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184
first-page-number . . . . . . . . . . . . . . . . . . . . . . . . . . . 246 ragged-bottom . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247
followVoice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111 ragged-last . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269
font-interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182 ragged-last-bottom . . . . . . . . . . . . . . . . . . . . . . . . . . 247
foot-separation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247 ragged-right. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269
repeatCommands . . . . . . . . . . . . . . . . . . . . . . . . . . . 81, 106
H
head-separation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247 S
horizontal-shift . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248 s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
scoreTitleMarkup . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242
I set-accidental-style . . . . . . . . . . . . . . . . . . . . . . . . 213
shapeNoteStyles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
indent . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269
showLastLength . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245
instrument . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239
skipTypesetting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245
spacing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266
L Staff.midiInstrument . . . . . . . . . . . . . . . . . . . . . . . . 244
layout file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250 stem-spacing-correction . . . . . . . . . . . . . . . . . . . . . 266
left-margin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247 stemLeftBeamCount . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
line-width . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247, 269 stemRightBeamCount . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
ly:optimal-breaking . . . . . . . . . . . . . . . . . . . . . . . . . 253 subdivideBeams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
ly:page-turn-breaking . . . . . . . . . . . . . . . . . . . . . . . 253 subsubtitle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239
subtitle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239
suggestAccidentals . . . . . . . . . . . . . . . . . . . . . . . . . . 163
M sus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
m ............................................ 114 system-count. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247
maj . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114 systemSeparatorMarkup . . . . . . . . . . . . . . . . . . . . . . . 248
majorSevenSymbol . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
meter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239
minimumFret . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141 T
minimumPageTurnLength . . . . . . . . . . . . . . . . . . . . . . . 253 tagline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239
minimumRepeatLengthForPageTurn . . . . . . . . . . . . . 253 texi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298
modern style accidentals . . . . . . . . . . . . . . . . . . . . 214 textSpannerDown . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
modern-cautionary . . . . . . . . . . . . . . . . . . . . . . . . . . . 214 textSpannerNeutral . . . . . . . . . . . . . . . . . . . . . . . . . . 168
modern-voice. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214 textSpannerUp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
modern-voice-cautionary . . . . . . . . . . . . . . . . . . . . . 214 title . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239
top-margin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247
tremoloFlags. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
N tupletNumberFormatFunction . . . . . . . . . . . . . . . . . . 67
no-reset accidental style . . . . . . . . . . . . . . . . . . . 215
W
Appendix H: LilyPond index 362
! \aikenHeads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 \alternative. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
\applyContext . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284
\applyOutput. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284
# \arpeggio . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
# ............................................ 310 \arpeggioBracket . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
##f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 310 \arpeggioDown . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
##t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 310 \arpeggioNeutral . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
#'symbol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311 \arpeggioUp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
#(set-accidental-style 'piano-cautionary) . . 215 \ascendens . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
\auctum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
\augmentum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
\autoBeamOff. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
\autoBeamOn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
' . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 \bar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
\book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236
\break . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252
( \breve . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
(begin * * * *) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215 \cadenzaOff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
(end * * * *) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215 \cadenzaOn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
\caesura . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
\cavum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
, \clef . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
, . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 \context . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
\deminutum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
\denies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227
. \descendens . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66 \displayLilyMusc . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
\displayLilyMusic . . . . . . . . . . . . . . . . . . . . . . . . . . . 276
\displayMusic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276
/ \divisioMaior . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
/ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115 \divisioMaxima . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
/+ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115 \divisioMinima . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
\dorian . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
\dotsDown . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
? \dotsNeutral . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 \dotsUp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
\dynamicDown. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
\dynamicNeutral . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
[ \dynamicUp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
\emptyText . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
[ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
\f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
\fatText . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
] \ff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
\fff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 \ffff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
\finalis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
\flexa . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
\fp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
_ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120 \frenchChords . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
\germanChords . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
\glissando . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
\ \grace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
\! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 \header in LaTEX documents . . . . . . . . . . . . . . . . . . . 298
\< . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 \hideNotes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
\> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 \hideStaffSwitch . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
\\ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70 \inclinatum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
\accepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227 \include . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238
\addlyrics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119 \ionian . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
\aeolian . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 \italianChords . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
\afterGrace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92 \key . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77, 209
Appendix H: LilyPond index 363
B C
Backend . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225, 229 cadenza . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
Bagpipe . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145 call trace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292
balance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 calling code during interpreting . . . . . . . . . . . . . . . . 284
balloon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208 calling code on layout objects . . . . . . . . . . . . . . . . . . 284
Banjo tablatures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143 caps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
Banter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118 caps-markup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
Bar check . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 Case sensitive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11, 16
Bar lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80 cautionary accidental . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
bar lines, symbols on . . . . . . . . . . . . . . . . . . . . . . . . . . 168 center-align. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
Bar numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189 center-align-markup . . . . . . . . . . . . . . . . . . . . . . . . . 175
Bar_engraver. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116 changing properties . . . . . . . . . . . . . . . . . . . . . . . . . . . 220
barCheckSynchronize . . . . . . . . . . . . . . . . . . . . . . . . . . 68 char . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
baritone clef . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 char-markup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
BarLine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81 ChoirStaff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
BarNumber . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190 choral score . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
base-shortest-duration . . . . . . . . . . . . . . . . . . . . . . 266 choral tenor clef . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
bass clef . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 chord diagrams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
Appendix H: LilyPond index 365
expression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 fourth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
extender. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121 fraction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
extender line . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 fraction-markup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
extending lilypond . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 french clef . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
External programs, generating LilyPond files . . . . 308 Frenched scores . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197
extra-offset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52, 54 fret . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
fret diagrams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
fret-diagram. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
F fret-diagram-interface . . . . . . . . . . . . . . . . . . . . . . 144
fatal error . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292 fret-diagram-markup . . . . . . . . . . . . . . . . . . . . . . . . . 176
FDL, GNU Free Documentation License . . . . . . . . 353 fret-diagram-terse . . . . . . . . . . . . . . . . . . . . . . . . . . 176
fermata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 fret-diagram-terse-markup . . . . . . . . . . . . . . . . . . 176
fermata on bar line . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168 fret-diagram-verbose . . . . . . . . . . . . . . . . . . . . . . . . 177
fermata on multi-measure rest . . . . . . . . . . . . . . . . . 185 fret-diagram-verbose-markup . . . . . . . . . . . . . . . . 177
Feta font . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 316 fromproperty. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
FiguredBass . . . . . . . . . . . . . . . . . . . . 164, 165, 166, 197 fromproperty-markup . . . . . . . . . . . . . . . . . . . . . . . . . 177
file searching. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287 full measure rests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184
file size, output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294
fill-line . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
fill-line-markup . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
G
filled-box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176 general-align . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
filled-box-markup . . . . . . . . . . . . . . . . . . . . . . . . . . . 176 general-align-markup . . . . . . . . . . . . . . . . . . . . . . . . 177
Finale . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307 ghost notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
finalis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155 Glissando . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
finding graphical objects . . . . . . . . . . . . . . . . . . . . . . . 228 grace notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22, 91
finger . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176 GraceMusic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94, 276
finger change . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96 grand staff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
finger-interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229 GrandStaff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82, 214
finger-markup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176 graphical object descriptions . . . . . . . . . . . . . . . . . . . 228
FingerEvent . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229 Gregorian square neumes ligatures. . . . . . . . . . . . . . 157
fingering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20, 96 Gregorian_ligature_engraver . . . . . . . . . . . . . . . . 148
Fingering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97, 229 grob . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229
fingering-event . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229 grob-interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229
Fingering_engraver . . . . . . . . . . . . . . . . . . . . . . 229, 231 GUILE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 310
fingerings, right hand, for guitar . . . . . . . . . . . . . . . . 144 guitar tablature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
first-page-number . . . . . . . . . . . . . . . . . . . . . . . . . . . 246
flageolet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
flags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152 H
flat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 Hairpin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53, 98, 100
flat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176 Hal Leonard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
flat-markup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176 half note . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
FoldedRepeatedMusic . . . . . . . . . . . . . . . . . . . . . . . . . 106 halign . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
follow voice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111 halign-markup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
followVoice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111 hbracket . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
font . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 hbracket-markup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
font families, setting . . . . . . . . . . . . . . . . . . . . . . . . . . . 183 hcenter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178
font magnification . . . . . . . . . . . . . . . . . . . . . . . . 182, 183 hcenter-in . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178
font selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182 hcenter-in-markup . . . . . . . . . . . . . . . . . . . . . . . . . . . 178
font size . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183 hcenter-markup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178
font size, setting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250 head-separation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247
font switching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173 header . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242
Font, Feta . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 316 header, page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246
font-interface . . . . . . . . . . . . . . . . . 179, 182, 207, 229 Hidden notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
fontCaps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176 hiding objects. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
fontCaps-markup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176 Hiding staves . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197
fontsize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176 horizontal spacing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265
fontsize-markup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176 horizontal-shift . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248
foot marks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 Horizontal_bracket_engraver . . . . . . . . . . . . . . . . 210
foot-separation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247 HorizontalBracket . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
footer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242 hspace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178
footer, page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246 hspace-markup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178
Forbid_line_breaks_engraver . . . . . . . . . . . . . . . . . 69 html . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298
foreign languages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 HTML, music in . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295
four bar music. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251 hufnagel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
Appendix H: LilyPond index 367
K M
keepWithTag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194 m . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
Key signature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 magnify . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178
key signature, setting . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 magnify-markup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178
KeyCancellation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 maj . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
KeySignature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78, 149 majorSevenSymbol . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
kneed beams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 make-dynamic-script . . . . . . . . . . . . . . . . . . . . . . . . . . 184
manual staff switches . . . . . . . . . . . . . . . . . . . . . . . . . . 110
marcato . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
L margins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246
Laissez vibrer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 markalphabet. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178
LaissezVibrerTie . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 markalphabet-markup . . . . . . . . . . . . . . . . . . . . . . . . . 178
LaissezVibrerTieColumn . . . . . . . . . . . . . . . . . . . . . . . 90 markletter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178
landscape . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246 markletter-markup . . . . . . . . . . . . . . . . . . . . . . . . . . . 178
LANG . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289 markup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
language . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 markup text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
large . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178 measure lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
large-markup. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178 measure numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
latex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298 measure repeats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
LaTEX, music in . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295 measure, partial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
Appendix H: LilyPond index 368
U Voice . . . . 156, 196, 198, 199, 206, 218, 219, 220, 221,
UnfoldedRepeatedMusic . . . . . . . . . . . . . . . . . . . . . . . 106 224, 226, 228, 231, 243, 266, 306
upbeat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 VoiceFollower . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
upbow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 voices, more on a staff . . . . . . . . . . . . . . . . . . . . . . . . 26
volta . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
Updating a LilyPond file. . . . . . . . . . . . . . . . . . . . . . . 290
volta brackets and ties . . . . . . . . . . . . . . . . . . . . . . . . . . 87
upright . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
Volta_engraver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
upright-markup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
VoltaBracket. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
using the manual . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
VoltaRepeatedMusic . . . . . . . . . . . . . . . . . . . . . . . . . . 106
V W
varbaritone clef . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 warning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292
varcoda . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 whichBar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
variables . . . . . . . . . . . . . . . . . . . . . . . . . . . 10, 38, 43, 235 White mensural ligatures . . . . . . . . . . . . . . . . . . . . . . 156
Vaticana, Editio . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147 whiteout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
VaticanaStaffContext . . . . . . . . . . . . . . . . . . . . . . . . . . 162 whiteout-markup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
VaticanaVoiceContext . . . . . . . . . . . . . . . . . . . . . . . . . 162 whole note . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
vcenter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182 whole rests for a full measure . . . . . . . . . . . . . . . . . . 184
vcenter-markup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182 with-color . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
verbatim-file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182 with-color-markup . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
verbatim-file-markup . . . . . . . . . . . . . . . . . . . . . . . . 182 with-dimensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
versioning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 with-dimensions-markup . . . . . . . . . . . . . . . . . . . . . . 182
vertical spacing . . . . . . . . . . . . . . . . . . . . . . . . . . . 257, 269 with-url . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
VerticalAlignment . . . . . . . . . . . . . . . . . . . . . . . 257, 258 with-url-markup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
VerticalAxisGroup . . . . . . . . . . . . . . . . . . . . . . . 197, 257 wordwrap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
Viewing music . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 wordwrap-field . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
vim . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293 wordwrap-field-markup . . . . . . . . . . . . . . . . . . . . . . . 182
violin clef . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 wordwrap-markup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
VocalName . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136 wordwrap-string . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
Voice . . . . . . . . . . . . . . . . . . . . . 65, 71, 98, 110, 121, 123 wordwrap-string-markup . . . . . . . . . . . . . . . . . . . . . . 182
Voice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136 Writing music in parallel . . . . . . . . . . . . . . . . . . . . . . . . 85