This document shows all kinds of tips and tricks, from simple to
advanced. You may also find dirty tricks, or the very very
latest features that have not been documented or fully implemented
yet.
This document is for LilyPond version
2.2.6.
Using
You can add various stuff to notes using In general, first do a
The showing of ambituses can be switched off or they can be
shifted horizontally by using If you want to mix per-voice and per-staff ambituses, then you have to
define new context type derived from the
Accidentals are available in different ancient styles, which all
are collected here.
Here are shown many (all?) of the symbols that are
included in LilyPond's support of ancient notation.
Time signatures may also be engraved in an old style.
Here's an example of bagpipe music.
By setting
You can move
There a many types of bar lines available.
bar-number-every-five-reset.ly If you would like the bar numbers to appear at regular intervals, but
not starting from measure zero, you can use a context function,
bar-number-regular-interval.ly Bar numbers can also be printed inside boxes.
By default, bar numbers are printed only in the first measure. This
setting can be overridden, so that bar numbers on start of every measure.
The eighth notes may be seemingly attached to different
beams, and the corresponding notes connected by ties (see also
tie-cross-voice.ly).
Such a situation may occur, for example, in the cello suites.
You can override the automatic beaming settings.
The auto-beamer, which can be overridden, will only engrave beams
that end before encountering of
The
There are presets for the
Beam positions may be controlled manually, by overriding the
You can alter the number of stems in a beam. In this example,
two sets of four 32nds are joined, as if they were 8th notes.
The direction of a beam may be calculated in several ways. As shown in
the example, the beam are be below the notes if:
If your favourite algorithm is not one of these, you can hook up your
own one.
(These beam direction functions are defined in scm/beam.scm.)
Beams can be placed across a
When a beam falls in the middle of the staff, the beams point normally
down. However, this behaviour can be altered, if desired.
Beams may be forced to be over rests.
Invisible (or transparent) can be useful, when wierd tricks are needed;
especially, a slur cannot be attach to a rest or spacer rest.
A blank music paper can be produced by using spacer rests, and removing
A blank music paper can be produced also by using invisible notes, and removing
The
A second staff can be aligned to a fragment (say, a
cadenza) from the first staff, using a Scheme function: the
function creates a skip of the same length as the cadenza.
The font can be changed to small caps.
Cautinary accidentals are displayed in slurs by default. They can be
shown also with accidentals of smaller size.
The english naming of chords (default) can be changed to german
(
Chord names are generated from a list pitches. The
functions which construct these names can be customised. Here are shown
Jazz chords, following Ignatzek (pp. 17-18, 1995) and
an alternative Jazz chord notation.
Chords following Banter (1987) can also be printed from this file, but
are turned off for brevity.
Since there are several interpretations for recognizing
chord names, the lowest note is the bass note of a chord and the inversion
of the chord is found accordingly.
Jazz chord names can also be printed without notes.
Appending
In these scales, the clef and key signature are shown at the end of the line.
The positioning of glyph and note can be separated.
In an orchestral score (Beethoven's Coriolan overture), there are
different instrument groups, and some of the instruments may be
transposed. Instruments are indicated either with a long or short name.
After a line break, some function may called by overriding
Crescendi can be printed in a number of different ways.
Cue notes are typeset in a smaller font.
Divisiones are gregorian variants of breathing signs.
Choices are
Slurs can be forced to always attach to note heads.
You can attach slurs and ties to noteheads.
Absolute dynamics have an effect on MIDI files.
Pił forte dynamics is produced using
By inserting the TeX command \embeddedps, you can
insert postscript directly into the output.
You can embed scheme functions in your scores. While generating the
output, “hello world” is printed to the console.
You can embed Tex commands in your score.
In polyphonic notation, many voices can share a staff: In
this situation, the accidentals and staff are shared, but the stems,
slurs, beams, etc. are private to each voice. Hence, engravers should
be grouped. The engravers for note head, 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, more Staff contexts can be put into a single Score
context.
The notation problem, creating a certain symbol,
is handled by plugins. Each plugin is called Engraver. In this example,
engravers is switched on one by one, in the following order:
Engravers are grouped. For example, note heads, slurs, beams etc. form
a Voice context. Engravers for key, accidental, bar, etc. form a
Staff context.
You can add (possibly temporarily) an extra staff after the beginning of
a piece.
An alternate method to make bass figures is to use
Voices can be traced automatically when they switch staves by setting
Horizontal shift (
The breaking of line works also with polyphony. This is taken from
Gourlay's paper on breaking lines.
Here is demonstrated a preliminary support of Gregorian Scripts:
ictus, circulus, semicirculus, accentus, episem.
Artificial harmonics are notated with a different notehead style, by
marking the harmonic pitch with
High level functionality (eg. conditional defines),
can be accomplished with GUILE.
This example puts the current version in the tagline via Scheme,
however, the tagline is not printed to the collated webpage snippets.
Notes may be manually horizontally shifted.
You can combine two parts on the same staff using the part
combiner. For vocal scores (hymns), there is no need to add solo/a2
texts, so they should be switched off.
In improvisation, noteheads do not have a pitch, and have different
shapes. In this example, this is achieved by adding
This example shows how to make an “incipit” to indicate
scordatora tuning of a violin part, by overriding the
You can have a name for the whole
Vaticana ligature uses four staff lines, special clef, an notes
calligraphic notes.
In the generated output for printing, there are several titles which do not appear in the web pages.
In tightly engraved music, hyphens are removed, except at the
end of the line. Normally, lyrics are not typeset so tightly, but by
tuning down In some languages (e.g. German and Hungarian), hyphens should not
disappear, since spelling depends on hyphenation. For that purpose,
hyphens can be forced to remain by overriding
By inserting
In mensural ligatures, notes with ancient durations are printed
in a tight manner.
Mensural notes may also have note heads.
Converting LilyPond input to MIDI and then again back with
The positions of accidentals may be manually set by incorporating
some Scheme code.
Objects, like text, can be moved around by using some Scheme code.
This example shows prelude in C major of WTK1, but coded
using Scheme functions to avoid typing work.
You can engrave music using just Scheme expressions. Although those
expressions reflect the inner mechanism of LilyPond, they are rather
clumsy to use, so avoid them, if possible.
Engravers can be removed one by one. Here, the time signature and bar lines
have been removed.
According to normal typesetting conventions, LilyPond typesets key
changes at the end of the line, when the change appears at a line break.
This example shows how to change this default to only print the
new key signature at the beginning of the next line.
The printing of the staff lines may be suppressed by removing the
corresponding engraver.
A temporary ossia in an instrumental part may
be printed using a separate, short staff. A simpler solution is
also given: instantiate a full staff, and let
Stress optimal page breaking. This should look nice on 4 a6 pages.
In orchestral scores and hymns, voices are traditionally combined into
one staff. LilyPond has a part combiner that combines, or separates, two
voices according to the actual rhythm and pitch. Configurable texts, such
as “solo” and “à2”, are typeset automatically in appropriate
places.
When entering partially typeset music (i.e. for students to be
completed by hand), you may need the spacing that correspond to the
timing of notes: all measures have same length, etc. It can be
implemented by adding an invisible staff with a lot of fast notes.
The
It is possible to have different staff distances between
the staffs of a piano system, but it requires some advanced Scheme code.
Currently, this is for testing purposes.
It is possible to have multiple time signatures, each one in an own staffs,
at the same time, and have even a proper vertical alignment of the different
durations. This is done, firstly, by setting a common time signature for
each staff but replacing it manually using 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.
You can have multiple time signatures occuring at the same time.
This is done by moving the timing engraver to staff context. Also,
The object may be extended to larger sized by overriding their properties.
The lyrics in this example have an extent of
By controlling manually the signs and numbers in repeats, an unusual
output can be produced.
By setting
Alternate lyrics can be used, as well as alternate notes for repeats.
Dots of rests should follow the rest positions.
Rests may be used in various styles.
Symmetric, or palindromical music can be produced, first, by printing
some music, and second, by printing the same music applying a Scheme
function to reverse the syntax.
Rythmic exercises may be produced by removing the
In addition to major and minor keys, the key can be given also in terms
of greek, modal scales: ionian (= major), dorian, phrygian, lydian, mixolydian,
aeolian (= minor), and locrian. All these scales are in the key of C.
Using
Some articulations may be entered using an abbreviation.
This chart shows all articulations, or scripts, that feta font contains.
Relative placements of different script types can be controlled
by overriding In this example, accidentals are put either below or above other
script symbols.
Text and articulations may be stacked on top of each other.
You can enter notes and articulations separately, and merge
them into one thread. In this example, a repead series of staccato dots
is attached to the notes.
In some cases, you may want to control the attachment points of a slur
by hand.
The curvature of a slur is adjusted to stay away from note heads and
stems. When the curvature would increase much, the slur is reverted
to its default shape. The Slur's property
The appearance of slurs may be changed from solid to dotted or dashed.
In extreme cases, you can resort to setting the
By setting the minimum length of a slur, notes are more separated.
Strange slurs can be produced by setting properties by hand.
There is a way to enforce enharmonic modifications for notes in order
to have the minimum number of accidentals. In that case, “Double
accidentals should be removed, as well as E-sharp (-> F), bC (-> B),
bF (-> E), B-sharp (-> C).”, as proposed by a request for a new feature.
In that manner, the most natural enharmonic notes are chosen in this example.
When stretching notes, every note should stretch according to its duration.
Eighth notes should be spaced equidistantly.
In order to selectively change the properties of spanners after
a line break, Scheme code must be used. In thas manner, the tie
after the line break in this example is moved around.
Staffs can be nested in various combinations. Here,
In this preliminary test of a modern score, the staff lines are washed
out temporarily. This is done by making a tuned
The number of lines in a staff may changed by overriding
In order to change staff sizes, both
By just increasing
The chords which exceptionally cross staves may be produced by increasing
the length of the stem in the lower stave, so it reaches the stem in the
upper stave, or vice versa.
Extending stems to the center line may be prevented using
The length of stems can be altered.
A hammer in tablature can be faked with slurs.
Tablature is internally done by overriding the note-head formatting function
and let it act on a 6-line staff. A special engraver takes then care of
choosing the fret and converting the pitch to a number.
Thus, by providing the fret numbers, the same music can be generated both
for a normal and tabulature staffs. By default, the fret is the smallest
possible, according to
An additional stave can be typeset in the middle of a score line.
A new context type is created for the temporary staff to avoid printing
time and key signatures and clef at the beginning of the extra stave.
Inline TeX (or PostScript) may be used, for example, to rotate text.
To see the result, use the
Text spanners can be used in the similar manner than markings for pedals
or octavation.
There are different fonts and glyphs to be used with 0.1 Introduction
make-music
, you can add various stuff to notes. In this
example staccato dots are added to the notes. For this simple case,
it is not necessary to use scm constructs (see separate-staccato.ly
).
make-music
.
In this example, an extra fingering is attached to a note.
display
of the music you want to
create, then write a function that will structure the music for you.
applyoutput
.
Voice
or Staff
context. The derived context must contain the Ambitus_engraver
and it must be accepted by a proper parent context, which are respectively
the Staff
context or Score
context in the example below.
The original context and the derived context can then be used in parallel
in the same score (not demonstrated in this file).
barAlways
and defaultBarType
, barlines may be inserted automatically everywhere.
Bar_engraver
and Span_bar_engraver
to
a different engraving context, if you want, for example, bar lines
on lyrics.
set-bar-number-visibility
, to set automatically
barNumberVisibility
, so that the bar numbers appear at regular
intervals, starting from the measure in which
set-bar-number-visibility
is set using \applycontext
.
autoBeaming
can also be turned off.
auto-beam
engraver in the case of common
time signatures.
positions
setting of the Beam
grob.
majority
mean
median
PianoStaff
.
Bar_number_engraver
. Here is an empty staff with a tablature staff.
Bar_number_engraver
.
print-function
can be overridden to draw a box around an arbitrary
grob.
\germanChords
replaces B and Bes to H and B) or semi-german
(\semiGermanChords
replaces B and Bes to H and Bb).
_8
or ^8
to a clef name will
add an octavation sign to the clef; then the clef name
is given in quotes (such as "treble^8").
\clef
is
a front-end, which keeps them together. All the notes in this example
are central C.
after-line-breaking-callback
. This can be most useful to assertain
that a piece uses a specified number of lines; typically the number of
lines (or systems) is not engraved, but it can be printed to console when
generating the output. The number of lines may be associated either
to the number of systems or the system number of a grob.
divisioMinima
, divisioMaior
,
divisioMaxima
and finalis
, virgula
and
caesura
.
\markup
.
markup
texts.
followVoice
.
hshift
) can be forced in order to avoid collisions.
\harmonic
.
Pitch_squash_engraver
and setting squashedPosition
when the
improvisation is active.
style
of
a TimeSignature
.
Here are the two first bars of Biber's Rosary sonata III.
GrandStaff
in addition to
individual Staff
s.
padding
of in SeparationItem
, syllables are put
closer together, and as a result hyphens may disappear.
minimum-length
of
the LyricHyphen
grob.
\skip
statements into lyric lines, one can attach
less lyric syllables to a melody.
midi2ly.py
is a reversible procedure in some simple cases,
which mean that the original .ly
-file and the one converted
back from the generated .midi
-file do not differ.
Here are produced some scales.
RemoveEmptyStaffContext
take out the unused parts.
PhrasingSlur
can be made higher in order to avoid collision
with other slurs.
timeSignatureFraction
to
the desired fraction, and secondly, by scaling the printed durations to
the actual, polymetric durations.
Staff
should be given the alias Timing
to make \time
command work correctly. The spacing is aligned vertically, although the bar
lines seem to distort the regular spacing.
(-10,10)
, which is why
they are spaced so widely.
voltaSpannerDuration
, the horizontal length of a volta
bracket can be shortened.
Clef
engraver,
putting all notes to the same pitch and using transparent staff lines.
ly:export
, the result of Scheme expressions can be passed
as LilyPond input. Within a Scheme expression, you can use, define or
change the corresponding variables. In this example, the D-s and E-s are
generated using scheme functions, and between there are manually
(without Scheme) entered C-s.
script-priority
.
beautiful
(which is
loosely related to the enclosed area between the slur and the notes)
controls the transition point, and by increasing that value you may
keep slurs more curved.
control-points
of a slur manually, althout it involves
a lot of trial and error. Be sure to force line breaks at both sides, since
different horizontal spacing will require rearrangement of the
slur.
StaffGroup
and ChoirStaff
produce similar straight brackets, whereas
GrandStaff
produces curly brackets. In InnerStaffGroup
and InnerChoirStaff
, the brackets are shifted leftwards.
StaffContainer
,
which \skip
s some notes without printing lines either and
creates a
ew Staff
then in order to create the lines again.
(Be careful if you use this; it has been done by splitting the
grouping Axis_group_engraver
and creating functionality into
separate contexts, but the clefs and time signatures may not do
what you would expect.)
line-count
in the properties of StaffSymbol
.
staff-space
and fontSize
must be scaled.
staff-space
on a staff, you may produce strange
results.
no-stem-extend
.
minimumFret
.
lilypond.py
script to generate the
output for printing of the source of this example (commenting one line).
\markup
command.