[Top][Contents][Index] |
LilyPond — Notation Reference
This manual provides a reference for all notation that can be produced with LilyPond version 2.23.2. It assumes that the reader is familiar with the material in the Learning Manual. |
1. Musical notation | Notation which is used in almost all projects. | |
2. Specialist notation | Notation which is only used for specific purposes. | |
3. General input and output | General information about LilyPond input and output. | |
4. Spacing issues | Display of output on paper. | |
5. Changing defaults | Tuning output. | |
Appendices | ||
---|---|---|
A. Notation manual tables | Tables and charts. | |
B. Cheat sheet | Summary of LilyPond syntax. | |
C. GNU Free Documentation License | License of this document. | |
D. LilyPond command index | ||
E. LilyPond index |
For more information about how this manual fits with the other documentation, or to read this manual in other formats, see Manuals. If you are missing any manuals, the complete documentation can be found at http://lilypond.org/. |
[ << Top ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Top ] | [ Up : Top ] | [ Pitches > ] |
1. Musical notation
This chapter explains how to create musical notation.
1.1 Pitches | Writing and display the pitches of notes. | |
1.2 Rhythms | Writing and displaying the durations of notes. | |
1.3 Expressive marks | Adding expression to notes. | |
1.4 Repeats | Repeat music. | |
1.5 Simultaneous notes | More than one note at once. | |
1.6 Staff notation | Displaying staves. | |
1.7 Editorial annotations | Special notation to increase legibility. | |
1.8 Text | Adding text to scores. |
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Musical notation ] | [ Up : Musical notation ] | [ Writing pitches > ] |
1.1 Pitches
This section discusses how to specify the pitch of notes. There are three steps to this process: input, modification, and output.
1.1.1 Writing pitches | ||
1.1.2 Changing multiple pitches | ||
1.1.3 Displaying pitches | ||
1.1.4 Note heads |
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Pitches ] | [ Up : Pitches ] | [ Absolute octave entry > ] |
1.1.1 Writing pitches
This section discusses how to input pitches. There are two different ways to place notes in octaves: absolute and relative mode. In most cases, relative mode will be more convenient.
Absolute octave entry | ||
Relative octave entry | ||
Accidentals | ||
Note names in other languages |
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Writing pitches ] | [ Up : Writing pitches ] | [ Relative octave entry > ] |
Absolute octave entry
A pitch name is specified using lowercase letters a
through g
. The note names c
to b
are
engraved in the octave below middle C.
{ \clef bass c4 d e f g4 a b c d4 e f g }
Other octaves may be specified with a single quote ('
)
or comma (,
) character. Each '
raises the
pitch by one octave; each ,
lowers the pitch by an
octave.
{ \clef treble c'4 e' g' c'' c'4 g b c' \clef bass c,4 e, g, c c,4 g,, b,, c, }
Common octave marks can be entered just once on a reference pitch
after \fixed
placed before the music. Pitches inside
\fixed
only need '
or ,
marks
when they are above or below the octave of the reference pitch.
{ \fixed c' { \clef treble c4 e g c' c4 g, b, c } \clef bass \fixed c, { c4 e g c' c4 g, b, c } }
Pitches in the music expression following \fixed
are
unaffected by any enclosing \relative
, discussed next.
See also
Music Glossary: Pitch names.
Snippets: Pitches.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Absolute octave entry ] | [ Up : Writing pitches ] | [ Accidentals > ] |
Relative octave entry
Absolute octave entry requires specifying the octave for every single note. Relative octave entry, in contrast, specifies each octave in relation to the last note: changing one note’s octave will affect all of the following notes.
Relative note mode has to be entered explicitly using the
\relative
command:
\relative startpitch musicexpr
In relative mode, each note is assumed to be as close to the
previous note as possible. This means that the octave of each
pitch inside musicexpr
is calculated as follows:
- If no octave changing mark is used on a pitch, its octave is calculated so that the interval with the previous note is less than a fifth. This interval is determined without considering accidentals.
-
An octave changing mark
'
or,
can be added to respectively raise or lower a pitch by an extra octave, relative to the pitch calculated without an octave mark. -
Multiple octave changing marks can be used. For example,
''
and,,
will alter the pitch by two octaves. -
The pitch of the first note is relative to
startpitch
.startpitch
is specified in absolute octave mode. Which choices are meaningful?- an octave of
c
Identifying middle C with
c'
is quite basic, so finding octaves ofc
tends to be straightforward. If your music starts withgis
abovec'''
, you’d write something like\relative c''' { gis' … }
- an octave of the first note inside
Writing
\relative gis''' { gis … }
makes it easy to determine the absolute pitch of the first note inside.- no explicit starting pitch
The form
\relative { gis''' … }
serves as a compact version of the previous option: the first note inside is written in absolute pitch itself. (This happens to be equivalent to choosingf
as the reference pitch.)
The documentation will usually employ the last option.
- an octave of
Here is the relative mode shown in action:
\relative { \clef bass c d e f g a b c d e f g }
Octave changing marks are used for intervals greater than a fourth:
\relative { c'' g c f, c' a, e'' c }
A note sequence without a single octave mark can nevertheless span large intervals:
\relative { c f b e a d g c }
When \relative
blocks are nested, the innermost
\relative
block starts with its own reference pitch
independently of the outer \relative
.
\relative { c' d e f \relative { c'' d e f } }
\relative
has no effect on \chordmode
blocks.
\new Staff { \relative c''' { \chordmode { c1 } } \chordmode { c1 } }
\relative
is not allowed inside of \chordmode
blocks.
Music inside a \transpose
block is absolute unless a
\relative
is included.
\relative { d' e \transpose f g { d e \relative { d' e } } }
If the preceding item is a chord, the first note of the chord is
used as the reference point for the octave placement of a
following note or chord. Inside chords, the next note is always
relative to the preceding one. Examine the next example
carefully, paying attention to the c
notes.
\relative { c' <c e g> <c' e g'> <c, e, g''> }
As explained above, the octave of pitches is calculated only with the note names, regardless of any alterations. Therefore, an E-double-sharp following a B will be placed higher, while an F-double-flat will be placed lower. In other words, a double-augmented fourth is considered a smaller interval than a double-diminished fifth, regardless of the number of semitones that each interval contains.
\relative { c''2 fis c2 ges b2 eisis b2 feses }
In complex situations, it is sometimes useful to get back to a
certain pitch regardless of what happened before. This can be
done using \resetRelativeOctave
:
\relative { << { c''2 d } \\ { e,,2 f } >> \resetRelativeOctave c'' c2 }
See also
Music Glossary: fifth, interval, Pitch names.
Notation Reference: Octave checks.
Snippets: Pitches.
Internals Reference: RelativeOctaveMusic.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Relative octave entry ] | [ Up : Writing pitches ] | [ Note names in other languages > ] |
Accidentals
Note: New users are sometimes confused about accidentals and
key signatures. In LilyPond, note names specify pitches; key
signatures and clefs determine how these pitches are displayed.
An unaltered note like c
means ‘C natural’,
regardless of the key signature or clef. For more information,
see
Pitches and key signatures.
A sharp pitch is made by adding is
to the note
name, and a flat pitch by adding es
. As you
might expect, a double sharp or double flat
is made by adding isis
or eses
. This syntax is
derived from Dutch note naming conventions. To use other names
for accidentals, see Note names in other languages.
\relative c'' { ais1 aes aisis aeses }
A natural pitch is entered as a simple note name; no suffix is required. A natural sign will be printed when needed to cancel the effect of an earlier accidental or key signature.
\relative c'' { a4 aes a2 }
Quarter tones may be added; the following is a series of Cs with increasing pitches:
\relative c'' { ceseh1 ces ceh c cih cis cisih }
Normally accidentals are printed automatically, but you may also
print them manually. A reminder accidental can be forced by
adding an exclamation mark !
after the pitch. A
cautionary accidental (i.e., an accidental within parentheses) can
be obtained by adding the question mark ?
after the
pitch.
\relative c'' { cis cis cis! cis? c c c! c? }
Accidentals on tied notes are only printed at the beginning of a new system:
\relative c'' { cis1~ 1~ \break cis }
Selected Snippets
Hiding accidentals on tied notes at the start of a new system
This shows how to hide accidentals on tied notes at the start of a new system.
\relative c'' { \override Accidental.hide-tied-accidental-after-break = ##t cis1~ cis~ \break cis }
Preventing extra naturals from being automatically added
In accordance with traditional typesetting rules, a natural sign is
printed before a sharp or flat if a previous double sharp or flat on
the same note is canceled. To change this behavior to contemporary
practice, set the extraNatural
property to f
in the
Staff
context.
\relative c'' { aeses4 aes ais a \set Staff.extraNatural = ##f aeses4 aes ais a }
See also
Music Glossary: sharp, flat, double sharp, double flat, Pitch names, quarter tone.
Learning Manual: Pitches and key signatures.
Notation Reference: Automatic accidentals, Annotational accidentals (musica ficta), Note names in other languages.
Snippets: Pitches.
Internals Reference: Accidental_engraver, Accidental, AccidentalCautionary, accidental-interface.
Known issues and warnings
There are no generally accepted standards for denoting quarter-tone accidentals, so LilyPond’s symbols do not conform to any standard.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Accidentals ] | [ Up : Writing pitches ] | [ Changing multiple pitches > ] |
Note names in other languages
There are predefined sets of note and accidental names for various other languages. Selecting the note name language is usually done at the beginning of the file; the following example is written using Italian note names:
\language "italiano" \relative { do' re mi sib }
The available languages and the note names they define are:
Language
Note Names
nederlands
c
d
e
f
g
a
bes
b
català
or
catalan
do
re
mi
fa
sol
la
sib
si
deutsch
c
d
e
f
g
a
b
h
english
c
d
e
f
g
a
bf
/b-flat
b
español
or
espanol
do
re
mi
fa
sol
la
sib
si
français
do
ré
/re
mi
fa
sol
la
sib
si
italiano
do
re
mi
fa
sol
la
sib
si
norsk
c
d
e
f
g
a
b
h
português
or
portugues
do
re
mi
fa
sol
la
sib
si
suomi
c
d
e
f
g
a
b
h
svenska
c
d
e
f
g
a
b
h
vlaams
do
re
mi
fa
sol
la
sib
si
In addition to note names, accidental suffixes may also vary depending on the language:
Language
sharp
flat
double sharp
double flat
nederlands
is
es
isis
eses
català
or
catalan
d
/s
b
dd
/ss
bb
deutsch
is
es
isis
eses
english
s
/-sharp
f
/-flat
ss
/x
/-sharpsharp
ff
/-flatflat
español
or
espanol
s
b
ss
/x
bb
français
d
b
dd
/x
bb
italiano
d
b
dd
bb
norsk
iss
/is
ess
/es
ississ
/isis
essess
/eses
português
or
portugues
s
b
ss
bb
suomi
is
es
isis
eses
svenska
iss
ess
ississ
essess
vlaams
k
b
kk
bb
In Dutch, German, Norwegian, and Finnish, aes
is contracted to
as
; in Dutch and Norwegian, however, both forms are accepted by
LilyPond. Exactly the same holds for es
and ees
,
aeses
and ases
, and finally eeses
and eses
.
In German and Finnish, LilyPond additionally provides the more frequent
form asas
for ases
.
\relative c'' { a2 as e es a ases e eses }
Some music uses microtones whose alterations are fractions of a ‘normal’ sharp or flat. The following table lists note name suffixes for quarter-tone accidentals; here the prefixes semi- and sesqui- respectively mean ‘half’ and ‘one and a half’.
Language
semi-sharp
semi-flat
sesqui-sharp
sesqui-flat
nederlands
ih
eh
isih
eseh
català
or
catalan
qd
/qs
qb
tqd
/tqs
tqb
deutsch
ih
eh
isih
eseh
english
qs
qf
tqs
tqf
español
or
espanol
cs
cb
tcs
tcb
français
sd
sb
dsd
bsb
italiano
sd
sb
dsd
bsb
norsk
ih
eh
issih
/isih
esseh
/eseh
português
or
portugues
sqt
bqt
stqt
btqt
suomi
ih
eh
isih
eseh
svenska
ih
eh
issih
esseh
vlaams
hk
hb
khk
bhb
In German, there are similar name contractions for microtones as with normal pitches described above.
\language "deutsch" \relative c'' { asah2 eh aih eisih }
Most languages presented here are commonly associated with Western classical music, also referred to as Common Practice Period. However, alternate pitches and tuning systems are also supported: see Common notation for non-Western music.
See also
Music Glossary: Pitch names, Common Practice Period.
Notation Reference: Common notation for non-Western music.
Installed Files: ‘scm/define-note-names.scm’.
Snippets: Pitches.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Note names in other languages ] | [ Up : Pitches ] | [ Octave checks > ] |
1.1.2 Changing multiple pitches
This section discusses how to modify pitches.
Octave checks | ||
Transpose | ||
Inversion | ||
Retrograde | ||
Modal transformations |
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Changing multiple pitches ] | [ Up : Changing multiple pitches ] | [ Transpose > ] |
Octave checks
In relative mode, it is easy to forget an octave changing mark. Octave checks make such errors easier to find by displaying a warning and correcting the octave if a note is found in an unexpected octave.
To check the octave of a note, specify the absolute octave after
the =
symbol. This example will generate a warning
(and change the pitch) because the second note is the absolute
octave d''
instead of d'
as indicated by the octave
correction.
\relative { c''2 d='4 d e2 f }
The octave of notes may also be checked with the
\octaveCheck controlpitch
command.
controlpitch
is specified in absolute mode. This
checks that the interval between the previous note and the
controlpitch
is within a fourth (i.e., the normal
calculation of relative mode). If this check fails, a warning is
printed. While the previous note itself is not changed, future
notes are relative to the corrected value.
\relative { c''2 d \octaveCheck c' e2 f }
Compare the two bars below. The first and third \octaveCheck
checks fail, but the second one does not fail.
\relative { c''4 f g f c4 \octaveCheck c' f \octaveCheck c' g \octaveCheck c' f }
See also
Snippets: Pitches.
Internals Reference: RelativeOctaveCheck.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Octave checks ] | [ Up : Changing multiple pitches ] | [ Inversion > ] |
Transpose
A music expression can be transposed with \transpose
. The
syntax is
\transpose frompitch topitch musicexpr
This means that musicexpr
is transposed by the
interval between the pitches frompitch
and
topitch
: any note with pitch frompitch
is changed to topitch
and any other note is
transposed by the same interval. Both pitches are entered in
absolute mode.
Note: Music inside a transpose
block is absolute
unless a relative
is included in the block.
Consider a piece written in the key of D-major. It can be transposed up to E-major; note that the key signature is automatically transposed as well.
\transpose d e { \relative { \key d \major d'4 fis a d } }
If a part written in C (normal concert pitch) is to be played on the A clarinet (for which an A is notated as a C and thus sounds a minor third lower than notated), the appropriate part will be produced with:
\transpose a c' { \relative { \key c \major c'4 d e g } }
Note that we specify \key c \major
explicitly. If we
do not specify a key signature, the notes will be transposed but
no key signature will be printed.
\transpose
distinguishes between enharmonic pitches: both
\transpose c cis
or \transpose c des
will
transpose up a semitone. The first version will print sharps and
the notes will remain on the same scale step, the second version
will print flats on the scale step above.
music = \relative { c' d e f } \new Staff { \transpose c cis { \music } \transpose c des { \music } }
\transpose
may also be used in a different way, to input
written notes for a transposing instrument. The previous examples
show how to enter pitches in C (or concert pitch) and
typeset them for a transposing instrument, but the opposite is
also possible if you for example have a set of instrumental parts
and want to print a conductor’s score. For example, when entering
music for a B-flat trumpet that begins on a notated E (concert D),
one would write:
musicInBflat = { e4 … } \transpose c bes, \musicInBflat
To print this music in F (e.g., rearranging to a French horn) you
could wrap the existing music with another \transpose
:
musicInBflat = { e4 … } \transpose f c' { \transpose c bes, \musicInBflat }
For more information about transposing instruments, see Instrument transpositions.
Selected Snippets
Transposing pitches with minimum accidentals ("Smart" transpose)
This example uses some Scheme code to enforce enharmonic modifications for notes in order to have the minimum number of accidentals. In this case, the following rules apply:
Double accidentals should be removed
B sharp -> C
E sharp -> F
C flat -> B
F flat -> E
In this manner, the most natural enharmonic notes are chosen.
#(define (naturalize-pitch p) (let ((o (ly:pitch-octave p)) (a (* 4 (ly:pitch-alteration p))) ;; alteration, a, in quarter tone steps, ;; for historical reasons (n (ly:pitch-notename p))) (cond ((and (> a 1) (or (eqv? n 6) (eqv? n 2))) (set! a (- a 2)) (set! n (+ n 1))) ((and (< a -1) (or (eqv? n 0) (eqv? n 3))) (set! a (+ a 2)) (set! n (- n 1)))) (cond ((> a 2) (set! a (- a 4)) (set! n (+ n 1))) ((< a -2) (set! a (+ a 4)) (set! n (- n 1)))) (if (< n 0) (begin (set! o (- o 1)) (set! n (+ n 7)))) (if (> n 6) (begin (set! o (+ o 1)) (set! n (- n 7)))) (ly:make-pitch o n (/ a 4)))) #(define (naturalize music) (let ((es (ly:music-property music 'elements)) (e (ly:music-property music 'element)) (p (ly:music-property music 'pitch))) (if (pair? es) (ly:music-set-property! music 'elements (map naturalize es))) (if (ly:music? e) (ly:music-set-property! music 'element (naturalize e))) (if (ly:pitch? p) (begin (set! p (naturalize-pitch p)) (ly:music-set-property! music 'pitch p))) music)) naturalizeMusic = #(define-music-function (m) (ly:music?) (naturalize m)) music = \relative c' { c4 d e g } \score { \new Staff { \transpose c ais { \music } \naturalizeMusic \transpose c ais { \music } \transpose c deses { \music } \naturalizeMusic \transpose c deses { \music } } \layout { } }
See also
Notation Reference: Instrument transpositions, Inversion, Modal transformations, Relative octave entry, Retrograde.
Snippets: Pitches.
Internals Reference: TransposedMusic.
Known issues and warnings
The relative conversion will not affect \transpose
,
\chordmode
or \relative
sections in its argument. To use
relative mode within transposed music, an additional \relative
must be placed inside \transpose
.
Triple accidentals will not be printed if using \transpose
. An
‘enharmonically equivalent’ pitch will be used instead (e.g., d-flat
rather than e-triple-flat).
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Transpose ] | [ Up : Changing multiple pitches ] | [ Retrograde > ] |
Inversion
A music expression can be inverted and transposed in a single operation with:
\inversion around-pitch to-pitch musicexpr
The musicexpr
is inverted interval-by-interval around
around-pitch
, and then transposed so that
around-pitch
is mapped to to-pitch
.
music = \relative { c' d e f } \new Staff { \music \inversion d' d' \music \inversion d' ees' \music }
Note: Motifs to be inverted should be expressed in absolute form
or be first converted to absolute form by enclosing them in a
relative
block.
See also
Notation Reference: Modal transformations, Retrograde, Transpose.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Inversion ] | [ Up : Changing multiple pitches ] | [ Modal transformations > ] |
Retrograde
A music expression can be reversed to produce its retrograde:
music = \relative { c'8. ees16( fis8. a16 b8.) gis16 f8. d16 } \new Staff { \music \retrograde \music }
Known issues and warnings
\retrograde
is a rather simple tool. Since many events are
‘mirrored’ rather than exchanged, tweaks and directional
modifiers for opening spanners need to be added at the matching
closing spanners: ^(
needs to be ended by ^)
, every
\<
or \cresc
needs to be ended by \!
or
\endcr
, every \>
or \decr
needs to be ended
by \enddecr
. Property-changing commands/overrides with a
lasting effect will likely cause surprises.
See also
Notation Reference: Inversion, Modal transformations, Transpose.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Retrograde ] | [ Up : Changing multiple pitches ] | [ Displaying pitches > ] |
Modal transformations
In a musical composition that is based on a scale, a motif is frequently transformed in various ways. It may be transposed to start at different places in the scale or it may be inverted around a pivot point in the scale. It may also be reversed to produce its retrograde, see Retrograde.
Note: Any note that does not lie within the given scale will be left untransformed.
Modal transposition
A motif can be transposed within a given scale with:
\modalTranspose from-pitch to-pitch scale motif
The notes of motif are shifted within the scale by the number of scale degrees given by the interval between to-pitch and from-pitch:
diatonicScale = \relative { c' d e f g a b } motif = \relative { c'8 d e f g a b c } \new Staff { \motif \modalTranspose c f \diatonicScale \motif \modalTranspose c b, \diatonicScale \motif }
An ascending scale of any length and with any intervals may be specified:
pentatonicScale = \relative { ges aes bes des ees } motif = \relative { ees'8 des ges,4 <ges' bes,> <ges bes,> } \new Staff { \motif \modalTranspose ges ees' \pentatonicScale \motif }
When used with a chromatic scale \modalTranspose
has a
similar effect to \transpose
, but with the ability to
specify the names of the notes to be used:
chromaticScale = \relative { c' cis d dis e f fis g gis a ais b } motif = \relative { c'8 d e f g a b c } \new Staff { \motif \transpose c f \motif \modalTranspose c f \chromaticScale \motif }
Modal inversion
A motif can be inverted within a given scale around a given pivot note and transposed in a single operation with:
\modalInversion around-pitch to-pitch scale motif
The notes of motif are placed the same number of scale degrees from the around-pitch note within the scale, but in the opposite direction, and the result is then shifted within the scale by the number of scale degrees given by the interval between to-pitch and around-pitch.
So to simply invert around a note in the scale use the same value for around-pitch and to-pitch:
octatonicScale = \relative { ees' f fis gis a b c d } motif = \relative { c'8. ees16 fis8. a16 b8. gis16 f8. d16 } \new Staff { \motif \modalInversion fis' fis' \octatonicScale \motif }
To invert around a pivot between two notes in the scale, invert around one of the notes and then transpose by one scale degree. The two notes specified can be interpreted as bracketing the pivot point:
scale = \relative { c' g' } motive = \relative { c' c g' c, } \new Staff { \motive \modalInversion c' g' \scale \motive }
The combined operation of inversion and retrograde produce the retrograde-inversion:
octatonicScale = \relative { ees' f fis gis a b c d } motif = \relative { c'8. ees16 fis8. a16 b8. gis16 f8. d16 } \new Staff { \motif \retrograde \modalInversion c' c' \octatonicScale \motif }
See also
Notation Reference: Inversion, Retrograde, Transpose.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Modal transformations ] | [ Up : Pitches ] | [ Clef > ] |
1.1.3 Displaying pitches
This section discusses how to alter the output of pitches.
Clef | ||
Key signature | ||
Ottava brackets | ||
Instrument transpositions | ||
Automatic accidentals | ||
Ambitus |
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Displaying pitches ] | [ Up : Displaying pitches ] | [ Key signature > ] |
Clef
Without any explicit command, the default clef for LilyPond is the treble (or G) clef.
c'2 c'
However, the clef can be changed by using the \clef
command and
an appropriate clef name. Middle C is shown in each of the
following examples.
\clef treble c'2 c' \clef alto c'2 c' \clef tenor c'2 c' \clef bass c'2 c'
For the full range of possible clef names see Clef styles.
Specialized clefs, such as those used in Ancient music, are described in Mensural clefs and Gregorian clefs. Music that requires tablature clefs is discussed in Default tablatures and Custom tablatures.
For mixing clefs when using cue notes, see the \cueClef
and
\cueDuringWithClef
commands in Formatting cue notes.
By adding _8
or ^8
to the clef name, the
clef is transposed one octave down or up respectively,
and _15
and ^15
transpose by two octaves.
Other integers can be used if required. Clef names containing
non-alphabetic characters must be enclosed in quotes
\clef treble c'2 c' \clef "treble_8" c'2 c' \clef "bass^15" c'2 c' \clef "alto_2" c'2 c' \clef "G_8" c'2 c' \clef "F^5" c'2 c'
Optional octavation can be obtained by enclosing the numeric argument in parentheses or brackets:
\clef "treble_(8)" c'2 c' \clef "bass^[15]" c'2 c'
The pitches are displayed as if the numeric argument were given without parentheses/brackets.
By default, a clef change taking place at a line break will cause the new clef symbol to be printed at the end of the previous line, as a warning clef, as well as the beginning of the next. This warning clef can be suppressed.
\clef treble { c'2 c' } \break \clef bass { c'2 c' } \break \clef alto \set Staff.explicitClefVisibility = #end-of-line-invisible { c'2 c' } \break \unset Staff.explicitClefVisibility \clef bass { c'2 c' } \break
By default, a clef that has previously been printed will not be
re-printed if the same \clef
command is issued again and
will be ignored. The command
\set Staff.forceClef = ##t
changes this behaviour.
\clef treble c'1 \clef treble c'1 \set Staff.forceClef = ##t c'1 \clef treble c'1
To be more precise, it is not the \clef
command itself that
prints a clef. Instead, it sets or changes a property of the
Clef_engraver
, which then decides by its own whether to
display a clef or not in the current staff. The forceClef
property overrides this decision locally to re-print a clef once.
When there is a manual clef change, the glyph of the changed clef will be smaller than normal. This behaviour can be overridden.
\clef "treble" c'1 \clef "bass" c'1 \clef "treble" c'1 \override Staff.Clef.full-size-change = ##t \clef "bass" c'1 \clef "treble" c'1 \revert Staff.Clef.full-size-change \clef "bass" c'1 \clef "treble" c'1
Selected Snippets
Tweaking clef properties
Changing the Clef glyph, its position, or the ottavation does not
change the position of subsequent notes on the staff. To get key
signatures on their correct staff lines middleCClefPosition
must
also be specified, with positive or negative values moving
middle C
up or down respectively, relative to the staff’s center
line.
For example, \clef "treble_8"
is equivalent to setting the
clefGlyph
, clefPosition
(the vertical position of the
clef itself on the staff), middleCPosition
and
clefTransposition
. Note that when any of these properties
(except middleCPosition
) are changed a new clef symbol is
printed.
The following examples show the possibilities when setting these properties manually. On the first line, the manual changes preserve the standard relative positioning of clefs and notes, whereas on the second line, they do not.
{ % The default treble clef \key f \major c'1 % The standard bass clef \set Staff.clefGlyph = #"clefs.F" \set Staff.clefPosition = #2 \set Staff.middleCPosition = #6 \set Staff.middleCClefPosition = #6 \key g \major c'1 % The baritone clef \set Staff.clefGlyph = #"clefs.C" \set Staff.clefPosition = #4 \set Staff.middleCPosition = #4 \set Staff.middleCClefPosition = #4 \key f \major c'1 % The standard choral tenor clef \set Staff.clefGlyph = #"clefs.G" \set Staff.clefPosition = #-2 \set Staff.clefTransposition = #-7 \set Staff.middleCPosition = #1 \set Staff.middleCClefPosition = #1 \key f \major c'1 % A non-standard clef \set Staff.clefPosition = #0 \set Staff.clefTransposition = #0 \set Staff.middleCPosition = #-4 \set Staff.middleCClefPosition = #-4 \key g \major c'1 \break % The following clef changes do not preserve % the normal relationship between notes, key signatures % and clefs: \set Staff.clefGlyph = #"clefs.F" \set Staff.clefPosition = #2 c'1 \set Staff.clefGlyph = #"clefs.G" c'1 \set Staff.clefGlyph = #"clefs.C" c'1 \set Staff.clefTransposition = #7 c'1 \set Staff.clefTransposition = #0 \set Staff.clefPosition = #0 c'1 % Return to the normal clef: \set Staff.middleCPosition = #0 c'1 }
See also
Notation Reference: Mensural clefs, Gregorian clefs, Default tablatures, Custom tablatures, Formatting cue notes.
Installed Files: ‘scm/parser-clef.scm’.
Snippets: Pitches.
Internals Reference: Clef_engraver, Clef, ClefModifier, clef-interface.
Known issues and warnings
Ottavation numbers attached to clefs are treated as separate
grobs. So any \override
done to the Clef will also
need to be applied, as a separate \override
, to the
ClefModifier grob.
\new Staff \with { \override Clef.color = #blue \override ClefModifier.color = #red } \clef "treble_8" c'4
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Clef ] | [ Up : Displaying pitches ] | [ Ottava brackets > ] |
Key signature
Note: New users are sometimes confused about accidentals and
key signatures. In LilyPond, note names are the raw input; key
signatures and clefs determine how this raw input is displayed.
An unaltered note like c
means ‘C natural’,
regardless of the key signature or clef. For more information,
see
Pitches and key signatures.
The key signature indicates the tonality in which a piece is played. It is denoted by a set of alterations (flats or sharps) at the start of the staff. The key signature may be altered:
\key pitch mode
Here, mode
should be \major
or \minor
to get a key signature of pitch
-major or
pitch
-minor, respectively. You may also use the
standard mode names, also called church modes:
\ionian
, \dorian
, \phrygian
, \lydian
,
\mixolydian
, \aeolian
, and \locrian
.
\relative { \key g \major fis''1 f fis }
Additional modes can be defined, by listing the alterations for each scale step when the mode starts on C.
freygish = #`((0 . ,NATURAL) (1 . ,FLAT) (2 . ,NATURAL) (3 . ,NATURAL) (4 . ,NATURAL) (5 . ,FLAT) (6 . ,FLAT)) \relative { \key c \freygish c'4 des e f \bar "||" \key d \freygish d es fis g }
Accidentals in the key signature may be printed in octaves other
than their traditional positions, or in multiple octaves, by
using the flat-positions
and sharp-positions
properties of KeySignature
. Entries in these properties
specify the range of staff-positions where accidentals will be
printed. If a single position is specified in an entry, the
accidentals are placed within the octave ending at that staff
position.
\override Staff.KeySignature.flat-positions = #'((-5 . 5)) \override Staff.KeyCancellation.flat-positions = #'((-5 . 5)) \clef bass \key es \major es g bes d' \clef treble \bar "||" \key es \major es' g' bes' d'' \override Staff.KeySignature.sharp-positions = #'(2) \bar "||" \key b \major b' fis' b'2
Selected Snippets
Preventing natural signs from being printed when the key signature changes
When the key signature changes, natural signs are automatically printed
to cancel any accidentals from previous key signatures. This may be
prevented by setting to f
the printKeyCancellation
property in the Staff
context.
\relative c' { \key d \major a4 b cis d \key g \minor a4 bes c d \set Staff.printKeyCancellation = ##f \key d \major a4 b cis d \key g \minor a4 bes c d }
Non-traditional key signatures
The commonly used \key
command sets the keyAlterations
property in the Staff
context. To create non-standard key
signatures, set this property directly.
The format of this command is a list:
\set Staff.keyAlterations = #`(((octave . step) . alter) ((octave . step) . alter) ...)
where, for each element in the list octave
specifies the octave
(0 being the octave from middle c to the b above), step
specifies
the note within the octave (0 means c and 6 means b), and alter
is ,SHARP ,FLAT ,DOUBLE-SHARP
etc.
Alternatively, using the more concise format for each item in the list,
(step . alter)
specifies the same alteration holds in all
octaves. For microtonal scales where a “sharp” is not 100 cents,
alter
refers to the proportion of a 200-cent whole tone.
\include "arabic.ly" \relative do' { \set Staff.keyAlterations = #`((0 . ,SEMI-FLAT) (1 . ,SEMI-FLAT) (2 . ,FLAT) (5 . ,FLAT) (6 . ,SEMI-FLAT)) %\set Staff.extraNatural = ##f re reb \dwn reb resd dod dob dosd \dwn dob | dobsb dodsd do do | }
See also
Music Glossary: church mode, scordatura.
Learning Manual: Pitches and key signatures.
Snippets: Pitches.
Internals Reference: KeyChangeEvent, Key_engraver, Key_performer, KeyCancellation, KeySignature, key-signature-interface.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Key signature ] | [ Up : Displaying pitches ] | [ Instrument transpositions > ] |
Ottava brackets
Ottava brackets introduce an extra transposition of an octave for the staff:
\relative c'' { a2 b \ottava #-2 a2 b \ottava #-1 a2 b \ottava #0 a2 b \ottava #1 a2 b \ottava #2 a2 b }
By default, only a number is printed at the start of the bracket. That setting may be changed to include an abbreviated ordinal, either in superscript or in normal letters (the latter was formerly used by default); the default bold font weight of these characters may also be altered, as explained in Selecting font and font size.
The following example demonstrates various options, as well as how to go back to the current default behavior:
\relative c'' { \ottava #1 a'2 b \ottava #2 a'2 b \bar "||" \set Staff.ottavationMarkups = #ottavation-ordinals \ottava #1 a,2 b \ottava #2 a'2 b \bar "||" \override Staff.OttavaBracket.font-series = #'medium \set Staff.ottavationMarkups = #ottavation-simple-ordinals \ottava #1 a,2 b \ottava #2 a'2 b \bar "||" \revert Staff.OttavaBracket.font-series \set Staff.ottavationMarkups = #ottavation-numbers \ottava #1 a,2 b \ottava #2 a'2 b }
Selected Snippets
Changing ottava text
Internally, \ottava
sets the properties ottavation
(for
example, to 8va
or 8vb
) and middleCPosition
. To
override the text of the bracket, set ottavation
after invoking
\ottava
.
Short text is especially useful when a brief ottava is used.
{ c'2 \ottava #1 \set Staff.ottavation = #"8" c''2 \ottava #0 c'1 \ottava #1 \set Staff.ottavation = #"Text" c''1 }
Adding an ottava marking to a single voice
If you have more than one voice on the staff, setting octavation in one voice will transpose the position of notes in all voices for the duration of the ottava bracket. If the ottavation is only intended to apply to one voice, the middleCPosition and ottava bracket may be set explicitly. In this snippet, the bass clef usually has middleCPosition set to 6, six positions above the center line, so in the 8va portion middleCPosition is 7 positions (one octave) higher still.
{ \clef bass << { <g d'>1~ q2 <c' e'> } \\ { r2. \set Staff.ottavation = #"8vb" \once \override Staff.OttavaBracket.direction = #DOWN \set Voice.middleCPosition = #(+ 6 7) <b,,, b,,>4 ~ | q2 \unset Staff.ottavation \unset Voice.middleCPosition <c e>2 } >> }
Modifying the Ottava spanner slope
It is possible to change the slope of the Ottava spanner.
\relative c'' { \override Staff.OttavaBracket.stencil = #ly:line-spanner::print \override Staff.OttavaBracket.bound-details = #`((left . ((Y . 0) ; Change the integer here (attach-dir . ,LEFT) (padding . 0) (stencil-align-dir-y . ,CENTER))) (right . ((Y . 5) ; Change the integer here (padding . 0) (attach-dir . ,RIGHT) (text . ,(make-draw-dashed-line-markup (cons 0 -1.2)))))) \override Staff.OttavaBracket.left-bound-info = #ly:line-spanner::calc-left-bound-info-and-text \override Staff.OttavaBracket.right-bound-info = #ly:line-spanner::calc-right-bound-info \ottava #1 c1 c'''1 }
See also
Music Glossary: octavation.
Notation Reference: Selecting font and font size.
Snippets: Pitches.
Internals Reference: Ottava_spanner_engraver, OttavaBracket, ottava-bracket-interface.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Ottava brackets ] | [ Up : Displaying pitches ] | [ Automatic accidentals > ] |
Instrument transpositions
When typesetting scores that involve transposing instruments, some parts can be typeset in a different pitch than the concert pitch. In these cases, the key of the transposing instrument should be specified; otherwise the MIDI output and cues in other parts will produce incorrect pitches. For more information about quotations, see Quoting other voices.
\transposition pitch
The pitch to use for \transposition
should correspond to
the real sound heard when a c'
written on the staff is
played by the transposing instrument. This pitch is entered in
absolute mode, so an instrument that produces a real sound which
is one tone higher than the printed music should use
\transposition d'
. \transposition
should
only be used if the pitches are not being entered in
concert pitch.
Here are a few notes for violin and B-flat clarinet where the parts have been entered using the notes and key as they appear in each part of the conductor’s score. The two instruments are playing in unison.
\new GrandStaff << \new Staff = "violin" \with { instrumentName = "Vln" midiInstrument = "violin" } \relative c'' { % not strictly necessary, but a good reminder \transposition c' \key c \major g4( c8) r c r c4 } \new Staff = "clarinet" \with { instrumentName = \markup { Cl (B\flat) } midiInstrument = "clarinet" } \relative c'' { \transposition bes \key d \major a4( d8) r d r d4 } >>
The \transposition
may be changed during a piece. For
example, a clarinetist may be required to switch from an A clarinet
to a B-flat clarinet.
flute = \relative c'' { \key f \major \cueDuring "clarinet" #DOWN { R1 _\markup\tiny "clarinet" c4 f e d R1 _\markup\tiny "clarinet" } } clarinet = \relative c'' { \key aes \major \transposition a aes4 bes c des R1^\markup { muta in B\flat } \key g \major \transposition bes d2 g, } \addQuote "clarinet" \clarinet << \new Staff \with { instrumentName = "Flute" } \flute \new Staff \with { instrumentName = "Cl (A)" } \clarinet >>
See also
Music Glossary: concert pitch, transposing instrument.
Notation Reference: Quoting other voices, Transpose.
Snippets: Pitches.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Instrument transpositions ] | [ Up : Displaying pitches ] | [ Ambitus > ] |
Automatic accidentals
There are many different conventions on how to typeset accidentals. LilyPond provides a function to specify which accidental style to use. This function is called as follows:
\new Staff << \accidentalStyle voice { … } >>
The accidental style applies to the current Staff
by
default (with the exception of the styles piano
and
piano-cautionary
, which are explained below). Optionally,
the function can take a second argument that determines in which
scope the style should be changed. For example, to use the same
style in all staves of the current StaffGroup
, use:
\accidentalStyle StaffGroup.voice
The following accidental styles are supported. To demonstrate each style, we use the following example:
musicA = { << \relative { cis''8 fis, bes4 <a cis>8 f bis4 | cis2. <c, g'>4 | } \\ \relative { ais'2 cis, | fis8 b a4 cis2 | } >> } musicB = { \clef bass \new Voice { \voiceTwo \relative { <fis a cis>8[ <fis a cis> \change Staff = up cis' cis \change Staff = down <fis, a> <fis a>] \showStaffSwitch \change Staff = up dis'4 | \change Staff = down <fis, a cis>4 gis <f a d>2 | } } } \new PianoStaff { << \new Staff = "up" { \accidentalStyle default \musicA } \new Staff = "down" { \accidentalStyle default \musicB } >> }
Note that the last lines of this example can be replaced by the following, as long as the same accidental style should be used in both staves.
\new PianoStaff { << \new Staff = "up" { %%% change the next line as desired: \accidentalStyle Score.default \musicA } \new Staff = "down" { \musicB } >> }
-
default
-
This is the default typesetting behavior. It corresponds to eighteenth-century common practice: accidentals are remembered to the end of the measure in which they occur and only in their own octave. Thus, in the example below, no natural signs are printed before the
b
in the second measure or the lastc
: -
voice
-
The normal behavior is to remember the accidentals at
Staff
-level. In this style, however, accidentals are typeset individually for each voice. Apart from that, the rule is similar todefault
.As a result, accidentals from one voice do not get canceled in other voices, which is often an unwanted result: in the following example, it is hard to determine whether the second
a
should be played natural or sharp. Thevoice
option should therefore be used only 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 or in a piano score) thenmodern
ormodern-cautionary
should be used instead. -
modern
-
This rule corresponds to the common practice in the twentieth century. It omits some extra natural signs, which were traditionally prefixed to a sharp following a double sharp, or a flat following a double flat. The
modern
rule prints the same accidentals asdefault
, with two additions that serve to avoid ambiguity: after temporary accidentals, cancellation marks are printed also in the following measure (for notes in the same octave) and, in the same measure, for notes in other octaves. Hence the naturals before theb
and thec
in the second measure of the upper staff: -
modern-cautionary
-
This rule is similar to
modern
, but the ‘extra’ accidentals are printed as cautionary accidentals (with parentheses). They can also be printed at a different size by overridingAccidentalCautionary
’sfont-size
property. -
modern-voice
-
This rule is used for multivoice accidentals to be read both by musicians playing one voice and musicians playing all voices. Accidentals are typeset for each voice, but they are canceled across voices in the same
Staff
. Hence, thea
in the last measure is canceled because the previous cancellation was in a different voice, and thed
in the lower staff is canceled because of the accidental in a different voice in the previous measure: -
modern-voice-cautionary
-
This rule is the same as
modern-voice
, but with the extra accidentals (the ones not typeset byvoice
) typeset as cautionaries. Even though all accidentals typeset bydefault
are typeset with this rule, some of them are typeset as cautionaries. -
piano
-
This rule reflects twentieth-century practice for piano notation. Its behavior is very similar to
modern
style, but here accidentals also get canceled across the staves in the sameGrandStaff
orPianoStaff
, hence all the cancellations of the final notes.This accidental style applies to the current
GrandStaff
orPianoStaff
by default. -
piano-cautionary
-
This is the same as
piano
but with the extra accidentals typeset as cautionaries. -
choral
-
This rule is a combination of the
modern-voice
and thepiano
style. It shows all accidentals required for singers that only follow their own voice, as well as additional accidentals for readers that follow all voices of an entireChoirStaff
simultaneously.This accidental style applies to the current
ChoirStaff
by default. -
choral-cautionary
-
This is the same as
choral
but with the extra accidentals typeset as cautionaries. -
neo-modern
-
This rule reproduces a common practice in contemporary music: accidentals are printed like with
modern
, but they are printed again if the same note appears later in the same measure – except if the note is immediately repeated. -
neo-modern-cautionary
-
This rule is similar to
neo-modern
, but the ‘extra’ accidentals are printed as cautionary accidentals (with parentheses). They can also be printed at a different size by overridingAccidentalCautionary
’sfont-size
property. -
neo-modern-voice
-
This rule is used for multivoice accidentals to be read both by musicians playing one voice and musicians playing all voices. Accidentals are typeset for each voice as with
neo-modern
, but they are canceled across voices in the sameStaff
. -
neo-modern-voice-cautionary
-
This rule is similar to
neo-modern-voice
, but the extra accidentals are printed as cautionary accidentals. -
dodecaphonic
-
This rule reflects a practice introduced by composers at the beginning of the 20th century, in an attempt to abolish the hierarchy between natural and non-natural notes. With this style, every note gets an accidental sign, including natural signs.
-
dodecaphonic-no-repeat
-
Like with the dodecaphonic accidental style every note gets an accidental sign by default, but accidentals are suppressed for pitches immediately repeated within the same staff.
-
dodecaphonic-first
-
Similar to the dodecaphonic accidental style every pitch gets an accidental sign, but only the first time it is encountered in a measure. Accidentals are only remembered for the actual octave but throughout voices.
-
teaching
-
This rule is intended for students, and makes it easy to create scale sheets with automatically created cautionary accidentals. Accidentals are printed like with
modern
, but cautionary accidentals are added for all sharp or flat tones specified by the key signature, except if the note is immediately repeated. -
no-reset
-
This is the same as
default
but with accidentals lasting ‘forever’ and not only within the same measure: -
forget
-
This is 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 came before in the music.
See also
Snippets: Pitches.
Internals Reference: Accidental, Accidental_engraver, GrandStaff, PianoStaff, Staff, AccidentalSuggestion, AccidentalPlacement, accidental-suggestion-interface.
Known issues and warnings
Simultaneous notes are not considered in the automatic
determination of accidentals; only previous notes and the key
signature are considered. Forcing accidentals with !
or ?
may be required when the same note name occurs
simultaneously with different alterations, as in ‘<f! fis!>’.
In alternative endings, cautionary cancellation should be based on
the previous played measure, but it is based on the
previous printed measure. In the following example, the
natural c
in the second alternative does not need a natural
sign:
The following work-around can be used: define a function that locally changes
the accidental style to forget
:
forget = #(define-music-function (music) (ly:music?) #{ \accidentalStyle forget #music \accidentalStyle modern #}) { \accidentalStyle modern \time 2/4 \repeat volta 2 { c'2 } \alternative { \volta 1 { cis' } \volta 2 { \forget c' } } }
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Automatic accidentals ] | [ Up : Displaying pitches ] | [ Note heads > ] |
Ambitus
The term ambitus (pl. 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. Ambitus are printed on vocal parts so that performers can easily determine if it matches their capabilities.
Ambitus are denoted at the beginning of a piece near the initial clef. The range is graphically specified by two note heads that represent the lowest and highest pitches. Accidentals are only printed if they are not part of the key signature.
\layout { \context { \Voice \consists "Ambitus_engraver" } } \relative { aes' c e2 cis,1 }
Selected Snippets
Adding ambitus per voice
Ambitus can be added per voice. In this case, the ambitus must be moved manually to prevent collisions.
\new Staff << \new Voice \with { \consists "Ambitus_engraver" } \relative c'' { \override Ambitus.X-offset = #2.0 \voiceOne c4 a d e f1 } \new Voice \with { \consists "Ambitus_engraver" } \relative c' { \voiceTwo es4 f g as b1 } >>
Ambitus with multiple voices
Adding the Ambitus_engraver
to the Staff
context creates
a single ambitus per staff, even in the case of staves with multiple
voices.
\new Staff \with { \consists "Ambitus_engraver" } << \new Voice \relative c'' { \voiceOne c4 a d e f1 } \new Voice \relative c' { \voiceTwo es4 f g as b1 } >>
Changing the ambitus gap
It is possible to change the default gap between the ambitus noteheads and the line joining them.
\layout { \context { \Voice \consists "Ambitus_engraver" } } \new Staff { \time 2/4 % Default setting c'4 g'' } \new Staff { \time 2/4 \override AmbitusLine.gap = #0 c'4 g'' } \new Staff { \time 2/4 \override AmbitusLine.gap = #1 c'4 g'' } \new Staff { \time 2/4 \override AmbitusLine.gap = #1.5 c'4 g'' }
Ambitus after key signature
By default, ambitus are positioned at the left of the clef. The
\ambitusAfter
function allows for changing this placement. Syntax is
\ambitusAfter grob-interface
(see
Interfaces
Graphical Object Interfaces for a list of possible values for grob-interface
).
A common use case is printing the ambitus between key signature and time
signature.
\new Staff \with { \consists Ambitus_engraver } \relative { \ambitusAfter key-signature \key d \major es'8 g bes cis d2 }
See also
Music Glossary: ambitus.
Snippets: Pitches.
Internals Reference: Ambitus_engraver, Voice, Staff, Ambitus, AmbitusAccidental, AmbitusLine, AmbitusNoteHead, ambitus-interface.
Known issues and warnings
There is no collision handling in the case of multiple per-voice ambitus.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Ambitus ] | [ Up : Pitches ] | [ Special note heads > ] |
1.1.4 Note heads
This section suggests ways of altering note heads.
Special note heads | ||
Easy notation note heads | ||
Shape note heads | ||
Improvisation |
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Note heads ] | [ Up : Note heads ] | [ Easy notation note heads > ] |
Special note heads
The appearance of note heads may be altered:
\relative c'' { c4 b \override NoteHead.style = #'cross c4 b \revert NoteHead.style a b \override NoteHead.style = #'harmonic a b \revert NoteHead.style c4 d e f }
To see all note head styles, see Note head styles.
The cross
style is used to represent a variety of musical
intentions. The following generic predefined commands modify the
note head in both staff and tablature contexts and can be used to
represent any musical meaning:
\relative { c''4 b \xNotesOn a b c4 b \xNotesOff c4 d }
The music function form of this predefined command may be used inside and outside chords to generate crossed note heads in both staff and tablature contexts:
\relative { c''4 b \xNote { e f } c b < g \xNote c f > b }
As synonyms for \xNote
, \xNotesOn
and \xNotesOff
,
\deadNote
, \deadNotesOn
and \deadNotesOff
can
be used. The term dead note is commonly used by guitarists.
There is also a similar shorthand for diamond shapes:
\relative c'' { <c f\harmonic>2 <d a'\harmonic>4 <c g'\harmonic> f\harmonic }
Predefined commands
\harmonic
,
\xNotesOn
,
\xNotesOff
,
\xNote
.
See also
Snippets: Pitches.
Notation Reference: Note head styles, Chorded notes, Indicating harmonics and dampened notes.
Internals Reference: note-event, Note_heads_engraver, Ledger_line_engraver, NoteHead, LedgerLineSpanner, note-head-interface, ledger-line-spanner-interface.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Special note heads ] | [ Up : Note heads ] | [ Shape note heads > ] |
Easy notation note heads
The ‘easy play’ note head includes a note name inside the head. It is used in music for beginners. To make the letters readable, it should be printed in a large font size. To print with a larger font, see Setting the staff size.
#(set-global-staff-size 26) \relative c' { \easyHeadsOn c2 e4 f g1 \easyHeadsOff c,1 }
Predefined commands
\easyHeadsOn
,
\easyHeadsOff
.
Selected Snippets
Numbers as easy note heads
Easy notation note heads use the note-names
property of the
NoteHead
object to determine what appears inside the note
head. By overriding this property, it is possible to print numbers
representing the scale-degree.
A simple engraver can be created to do this for every note head object it sees.
#(define Ez_numbers_engraver (make-engraver (acknowledgers ((note-head-interface engraver grob source-engraver) (let* ((context (ly:translator-context engraver)) (tonic-pitch (ly:context-property context 'tonic)) (tonic-name (ly:pitch-notename tonic-pitch)) (grob-pitch (ly:event-property (event-cause grob) 'pitch)) (grob-name (ly:pitch-notename grob-pitch)) (delta (modulo (- grob-name tonic-name) 7)) (note-names (make-vector 7 (number->string (1+ delta))))) (ly:grob-set-property! grob 'note-names note-names)))))) #(set-global-staff-size 26) \layout { ragged-right = ##t \context { \Voice \consists \Ez_numbers_engraver } } \relative c' { \easyHeadsOn c4 d e f g4 a b c \break \key a \major a,4 b cis d e4 fis gis a \break \key d \dorian d,4 e f g a4 b c d }
See also
Notation Reference: Setting the staff size.
Snippets: Pitches.
Internals Reference: note-event, Note_heads_engraver, NoteHead, note-head-interface.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Easy notation note heads ] | [ Up : Note heads ] | [ Improvisation > ] |
Shape note heads
In shape note head notation, the shape of the note head corresponds to the harmonic function of a note in the scale. This notation was popular in nineteenth-century American song books. Shape note heads can be produced in Sacred Harp, Southern Harmony, Funk (Harmonia Sacra), Walker, and Aiken (Christian Harmony) styles:
\relative c'' { \aikenHeads c, d e f g2 a b1 c \break \aikenThinHeads c,4 d e f g2 a b1 c \break \sacredHarpHeads c,4 d e f g2 a b1 c \break \southernHarmonyHeads c,4 d e f g2 a b1 c \break \funkHeads c,4 d e f g2 a b1 c \break \walkerHeads c,4 d e f g2 a b1 c \break }
Shapes are typeset according to the step in the scale, where the base
of the scale is determined by the \key
command. When writing
in a minor key, the scale step can be determined from the relative
major:
\relative c'' { \key a \minor \aikenHeads a b c d e2 f g1 a \break \aikenHeadsMinor a,4 b c d e2 f g1 a \break \aikenThinHeadsMinor a,4 b c d e2 f g1 a \break \sacredHarpHeadsMinor a,2 b c d \break \southernHarmonyHeadsMinor a2 b c d \break \funkHeadsMinor a2 b c d \break \walkerHeadsMinor a2 b c d \break }
Predefined commands
\aikenHeads
,
\aikenHeadsMinor
,
\aikenThinHeads
,
\aikenThinHeadsMinor
,
\funkHeads
,
\funkHeadsMinor
,
\sacredHarpHeads
,
\sacredHarpHeadsMinor
,
\southernHarmonyHeads
,
\southernHarmonyHeadsMinor
,
\walkerHeads
,
\walkerHeadsMinor
.
Selected Snippets
Aiken head thin variant noteheads
Aiken head white notes get harder to read at smaller staff sizes, especially with ledger lines. Losing interior white space makes them appear as quarter notes.
\score { { \aikenHeads c''2 a' c' a % Switch to thin-variant noteheads \set shapeNoteStyles = ##(doThin reThin miThin faThin sol laThin tiThin) c'' a' c' a } } % END EXAMPLE
Applying note head styles depending on the step of the scale
The shapeNoteStyles
property can be used to define various note
head styles for each step of the scale (as set by the key signature or
the tonic
property).
This property requires a set of symbols, which can be purely arbitrary
(geometrical expressions such as triangle
, cross
, and
xcircle
are allowed) or based on old American engraving
tradition (some latin note names are also allowed).
That said, to imitate old American song books, there are several
predefined note head styles available through shortcut commands such as
\aikenHeads
or \sacredHarpHeads
.
This example shows different ways to obtain shape note heads, and demonstrates the ability to transpose a melody without losing the correspondence between harmonic functions and note head styles.
fragment = { \key c \major c2 d e2 f g2 a b2 c } \new Staff { \transpose c d \relative c' { \set shapeNoteStyles = ##(do re mi fa #f la ti) \fragment } \break \relative c' { \set shapeNoteStyles = ##(cross triangle fa #f mensural xcircle diamond) \fragment } }
To see all note head styles, see Note head styles.
See also
Snippets: Pitches.
Notation Reference: Note head styles.
Internals Reference: note-event, Note_heads_engraver, NoteHead, note-head-interface.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Shape note heads ] | [ Up : Note heads ] | [ Rhythms > ] |
Improvisation
Improvisation is sometimes denoted with slashed note heads, where the performer may choose any pitch but should play the specified rhythm. Such note heads can be created:
\new Voice \with { \consists "Pitch_squash_engraver" } \relative { e''8 e g a a16( bes) a8 g \improvisationOn e8 ~ 2 ~ 8 f4 f8 ~ 2 \improvisationOff a16( bes) a8 g e }
Predefined commands
\improvisationOn
,
\improvisationOff
.
See also
Snippets: Pitches.
Internals Reference: Pitch_squash_engraver, Voice, RhythmicStaff.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Improvisation ] | [ Up : Musical notation ] | [ Writing rhythms > ] |
1.2 Rhythms
This section discusses rhythms, rests, durations, beaming and bars.
1.2.1 Writing rhythms | ||
1.2.2 Writing rests | ||
1.2.3 Displaying rhythms | ||
1.2.4 Beams | ||
1.2.5 Bars | ||
1.2.6 Special rhythmic concerns |
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Rhythms ] | [ Up : Rhythms ] | [ Durations > ] |
1.2.1 Writing rhythms
Durations | ||
Tuplets | ||
Scaling durations | ||
Ties |
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Writing rhythms ] | [ Up : Writing rhythms ] | [ Tuplets > ] |
Durations
The durations of notes are entered using numbers and dots. The number
entered is based on the reciprocal value of the length of the note. For
example, a quarter note is designated using the numerical value of
4
as it is a 1/4 note, a half note using 2
, an eighth
using 8
and so on. Durations as short as 1024
notes can be
entered but shorter values, while possible, can only be entered as
beamed notes. Also see Beams.
For notes longer than a whole use the \longa
– double breve –
and \breve
commands. A note with the duration of a quadruple
breve is possible using the \maxima
command but is only supported
within ancient music notation. See Ancient notation.
\relative { \time 8/1 c''\longa c\breve c1 c2 c4 c8 c16 c32 c64 c128 c128 }
Here are the same durations with automatic beaming turned off.
\relative { \time 8/1 \autoBeamOff c''\longa c\breve c1 c2 c4 c8 c16 c32 c64 c128 c128 }
Isolated durations – durations without a pitch – that occur within a music sequence will take their pitch from the preceding note or chord.
\relative { \time 8/1 c'' \longa \breve 1 2 4 8 16 32 64 128 128 }
Isolated pitches – pitches without a duration – that occur within a
music sequence will take their duration from the preceding note or
chord. If there is no preceding duration, then default for the note is
always 4
, a quarter note.
\relative { a' a a2 a a4 a a1 a }
Place a dot (.
) after the duration to obtain ‘dotted’ note
lengths. Double-dotted notes are specified by appending two dots,
and so on.
\relative { a'4 b c4. b8 a4. b4.. c8. }
To avoid clashing with staff lines, dots on notes are normally moved up. In polyphonic situations however, they can be placed, manually, above or below the staff as required. See Direction and placement.
Some note durations cannot be represented using just numbers and dots but only by tying two or more notes together. See Ties.
To specify durations that align the syllables of lyrics and notes together see Vocal music.
Notes can also be spaced proportionately to their duration, see Proportional notation.
Predefined commands
\autoBeamOn
,
\autoBeamOff
,
\dotsUp
,
\dotsDown
,
\dotsNeutral
.
Selected Snippets
Alternative breve notes
Breve notes are also available with two vertical lines on each side of the notehead instead of one line and in baroque style.
\relative c'' { \time 4/2 c\breve | \override Staff.NoteHead.style = #'altdefault b\breve \override Staff.NoteHead.style = #'baroque b\breve \revert Staff.NoteHead.style a\breve }
Changing the number of augmentation dots per note
The number of augmentation dots on a single note can be changed independently of the dots placed after the note.
\relative c' { c4.. a16 r2 | \override Dots.dot-count = #4 c4.. a16 r2 | \override Dots.dot-count = #0 c4.. a16 r2 | \revert Dots.dot-count c4.. a16 r2 | }
See also
Music Glossary: breve, longa, maxima, note value, Duration names notes and rests.
Notation Reference: Beams, Ties, Stems, Writing rhythms, Writing rests, Vocal music, Ancient notation, Proportional notation.
Snippets: Rhythms.
Internals Reference: Dots, DotColumn.
Known issues and warnings
While there is no fundamental limit to rest durations (longest or
shortest), there is a limit to the number of glyphs possible so only
rests between 1024
and \maxima
may be printed.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Durations ] | [ Up : Writing rhythms ] | [ Scaling durations > ] |
Tuplets
Tuplets are made from a music expression with the \tuplet
command, multiplying the speed of the music expression by a fraction:
\tuplet fraction { music }
The fraction’s numerator will be printed over or under the notes, optionally with a bracket. The most common tuplets are triplets (3 notes played within the duration normally allowed for 2).
\relative { a'2 \tuplet 3/2 { b4 4 4 } c4 c \tuplet 3/2 { b4 a g } }
When entering long passages of tuplets, having to write a separate
\tuplet
command for each group is inconvenient. It is possible
to specify the duration of one tuplet group directly before the music
in order to have the tuplets grouped automatically:
\relative { g'2 r8 \tuplet 3/2 8 { cis16 d e e f g g f e } }
Tuplet brackets may be manually placed above or below the staff:
\relative { \tupletUp \tuplet 3/2 { c''8 d e } \tupletNeutral \tuplet 3/2 { c8 d e } \tupletDown \tuplet 3/2 { f,8 g a } \tupletNeutral \tuplet 3/2 { f8 g a } }
Tuplets may be nested:
\relative { \autoBeamOff c''4 \tuplet 5/4 { f8 e f \tuplet 3/2 { e[ f g] } } f4 }
Modifying nested tuplets which begin at the same musical moment must be
done with \tweak
; see The \tweak
command.
Tuplet brackets may be replaced with slurs, as is preferred in many older editions:
\relative { \tuplet 3/2 4 { \override TupletBracket.tuplet-slur = ##t c'4 e8 d4 f8 \override TupletBracket.bracket-visibility = ##t e f g f e d } c1 }
By default, a bracket is only printed if all of the notes it spans
are not beamed together; in some cases (for example with slurs, as
in the example above) it may be preferrable to change that behavior,
through the bracket-visibility
property as detailed in
one of the following snippets.
More generally, either or both the TupletBracket
and
TupletNumber
objects may be hidden or shown as explained in
Visibility of objects; however, a more flexible way of
modifying the duration of notes without printing a tuplet
bracket is also introduced in Scaling durations.
Predefined commands
\tupletUp
,
\tupletDown
,
\tupletNeutral
.
Selected Snippets
Entering several tuplets using only one \tuplet command
The property tupletSpannerDuration
sets how long each of the
tuplets contained within the brackets after \tuplet
should
last. Many consecutive tuplets can then be placed within a single
\tuplet
expression, thus saving typing.
There are several ways to set tupletSpannerDuration
. The
command \tupletSpan
sets it to a given duration, and clears it
when instead of a duration \default
is specified. Another way
is to use an optional argument with \tuplet
.
\relative c' { \time 2/4 \tupletSpan 4 \tuplet 3/2 { c8^"\\tupletSpan 4" c c c c c } \tupletSpan \default \tuplet 3/2 { c8^"\\tupletSpan \\default" c c c c c } \tuplet 3/2 4 { c8^"\\tuplet 3/2 4 {...}" c c c c c } }
Changing the tuplet number
By default, only the numerator of the tuplet number is printed over the
tuplet bracket, i.e., the numerator of the argument to the
\tuplet
command.
Alternatively, num:den of the tuplet number may be printed, or the tuplet number may be suppressed altogether.
\relative c'' { \tuplet 3/2 { c8 c c } \tuplet 3/2 { c8 c c } \override TupletNumber.text = #tuplet-number::calc-fraction-text \tuplet 3/2 { c8 c c } \omit TupletNumber \tuplet 3/2 { c8 c c } }
Non-default tuplet numbers
LilyPond also provides formatting functions to print tuplet numbers different than the actual fraction, as well as to append a note value to the tuplet number or tuplet fraction.
\relative c'' { \once \override TupletNumber.text = #(tuplet-number::non-default-tuplet-denominator-text 7) \tuplet 3/2 { c4. c4. c4. c4. } \once \override TupletNumber.text = #(tuplet-number::non-default-tuplet-fraction-text 12 7) \tuplet 3/2 { c4. c4. c4. c4. } \once \override TupletNumber.text = #(tuplet-number::append-note-wrapper (tuplet-number::non-default-tuplet-fraction-text 12 7) (ly:make-duration 3 0)) \tuplet 3/2 { c4. c4. c4. c4. } \once \override TupletNumber.text = #(tuplet-number::append-note-wrapper tuplet-number::calc-denominator-text (ly:make-duration 2 0)) \tuplet 3/2 { c8 c8 c8 c8 c8 c8 } \once \override TupletNumber.text = #(tuplet-number::append-note-wrapper tuplet-number::calc-fraction-text (ly:make-duration 2 0)) \tuplet 3/2 { c8 c8 c8 c8 c8 c8 } \once \override TupletNumber.text = #(tuplet-number::fraction-with-notes (ly:make-duration 2 1) (ly:make-duration 3 0)) \tuplet 3/2 { c4. c4. c4. c4. } \once \override TupletNumber.text = #(tuplet-number::non-default-fraction-with-notes 12 (ly:make-duration 3 0) 4 (ly:make-duration 2 0)) \tuplet 3/2 { c4. c4. c4. c4. } }
Controlling tuplet bracket visibility
The default behavior of tuplet-bracket visibility is to print a bracket unless there is a beam of the same length as the tuplet.
To control the visibility of tuplet brackets, set the property
'bracket-visibility
to either #t
(always print a
bracket), 'if-no-beam
(only print a bracket if there is no beam,
which is the default behavior), or #f
(never print a
bracket). The latter is in fact equivalent to omitting the
@code{TupletBracket} object altogether from the printed output.
music = \relative c'' { \tuplet 3/2 { c16[ d e } f8] \tuplet 3/2 { c8 d e } \tuplet 3/2 { c4 d e } } \new Voice { \relative c' { << \music s4^"default" >> \override TupletBracket.bracket-visibility = #'if-no-beam << \music s4^"'if-no-beam" >> \override TupletBracket.bracket-visibility = ##t << \music s4^"#t" >> \override TupletBracket.bracket-visibility = ##f << \music s4^"#f" >> \omit TupletBracket << \music s4^"omit" >> } }
Permitting line breaks within beamed tuplets
This artificial example shows how both manual and automatic line breaks may be permitted to within a beamed tuplet. Note that such off-beat tuplets have to be beamed manually.
\layout { \context { \Voice % Permit line breaks within tuplets \remove "Forbid_line_break_engraver" % Allow beams to be broken at line breaks \override Beam.breakable = ##t } } \relative c'' { a8 \repeat unfold 5 { \tuplet 3/2 { c[ b a] } } % Insert a manual line break within a tuplet \tuplet 3/2 { c[ b \bar "" \break a] } \repeat unfold 5 { \tuplet 3/2 { c[ b a] } } c8 }
See also
Music Glossary: triplet, tuplet, polymetric.
Learning Manual: Tweaking methods.
Notation Reference:
Direction and placement,
Visibility of objects,
Time administration,
Scaling durations,
The \tweak
command,
Polymetric notation.
Snippets: Rhythms.
Internals Reference: TupletBracket, TupletNumber, TimeScaledMusic.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Tuplets ] | [ Up : Writing rhythms ] | [ Ties > ] |
Scaling durations
The duration of single notes, rests or chords may be multiplied by
a fraction N/M
by appending *N/M
(or *N
if
M
is 1) to the duration. Factors may also be added by
using Scheme expressions evaluating to a number or musical length
like *#(ly:music-length music)
. This is convenient
for scaling a duration of ‘1’ to let a note or multi-measure
rest stretch to a length derived from a music variable.
Adding a factor will not affect the appearance of the
notes or rests produced, but the altered duration will be used in
calculating the position within the measure and setting the duration
in the MIDI output. Multiplying factors may be combined like
*L*M/N
. Factors are part of the duration: if a duration is
not specified for subsequent notes, the default duration taken from
the preceding note will include any scaling factor.
In the following example, the first three notes take up exactly two beats, but no triplet bracket is printed.
\relative { \time 2/4 % Alter durations to triplets a'4*2/3 gis a % Normal durations a4 a % Double the duration of chord <a d>4*2 % Duration of quarter, appears like sixteenth b16*4 c4 }
The duration of spacer rests may also be modified by
a multiplier. This is useful for skipping many measures, e.g.,
s1*23
.
Longer stretches of music may be compressed by a fraction in the same way, as if every note, chord or rest had the fraction as a multiplier. This leaves the appearance of the music unchanged but the internal duration of the notes will be multiplied by the given scale factor, usually num/den. Here is an example showing how music can be compressed and expanded:
\relative { \time 2/4 % Normal durations <c'' a>4 c8 a % Scale music by *2/3 \scaleDurations 2/3 { <c a f>4. c8 a f } % Scale music by *2 \scaleDurations 2 { <c' a>4 c8 b } }
One application of this command is in polymetric notation, see Polymetric notation.
See also
Notation Reference: Tuplets, Invisible rests, Polymetric notation.
Snippets: Rhythms.
Known issues and warnings
The calculation of the position within a measure must take into account all the scaling factors applied to the notes within that measure and any fractional carry-out from earlier measures. This calculation is carried out using rational numbers. If an intermediate numerator or denominator in that calculation exceeds 2^30 the execution and typesetting will stop at that point without indicating an error.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Scaling durations ] | [ Up : Writing rhythms ] | [ Writing rests > ] |
Ties
A tie connects two adjacent note heads of the same pitch. The tie in effect extends the duration of a note.
Note: Ties should not be confused with slurs, which indicate articulation, or phrasing slurs, which indicate musical phrasing. A tie is just a way of extending a note duration, similar to the augmentation dot.
A tie is entered by appending a tilde symbol (~
) to the first
of each pair of notes being tied. This indicates that the note
should be tied to the following note, which must be at the same pitch.
{ a'2~ 4~ 16 r r8 }
Ties can make use of the ‘last explicit pitch’ interpretation of isolated durations:
{ a'2~ 4~ 16 r r8 }
Ties are used either when the note crosses a bar line, or when dots cannot be used to denote the rhythm. Ties should also be used when note values cross larger subdivisions of the measure:
\relative { r8 c'4.~ 4 r4 | r8^"not" c2~ 8 r4 }
If you need to tie many notes across bar lines, it may be easier to use automatic note splitting, see Automatic note splitting. This mechanism automatically splits long notes, and ties them across bar lines.
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 ties inside the chord.
\relative c' { <c e g>2~ 2 | <c e g>4~ <c e g c> <c~ e g~ b> <c e g b> | }
When a tie continues into alternative endings, you have to specify the repeated tie as follows:
\relative { \repeat volta 2 { c'' g <c e>2~ } \alternative { % the following note is tied normally \volta 1 { <c e>2. r4 } % the following note has a repeated tie \volta 2 { <c e>2\repeatTie d4 c } } }
L.v. ties (laissez vibrer) indicate that notes must not be damped at the end. It is used in notation for piano, harp and other string and percussion instruments. They can be entered as follows:
<c' f' g'>1\laissezVibrer
Ties may be made to curve up or down manually; see Direction and placement.
Ties may be made dashed, dotted, or a combination of solid and dashed.
\relative c' { \tieDotted c2~ 2 \tieDashed c2~ 2 \tieHalfDashed c2~ 2 \tieHalfSolid c2~ 2 \tieSolid c2~ 2 }
Custom dash patterns can be specified:
\relative c' { \tieDashPattern #0.3 #0.75 c2~ 2 \tieDashPattern #0.7 #1.5 c2~ 2 \tieSolid c2~ 2 }
Dash pattern definitions for ties have the same structure as dash pattern definitions for slurs. For more information about complex dash patterns, see Slurs.
Override whiteout and layer layout properties of objects that should cause a gap in ties.
\relative { \override Tie.layer = #-2 \override Staff.TimeSignature.layer = #-1 \override Staff.KeySignature.layer = #-1 \override Staff.TimeSignature.whiteout = ##t \override Staff.KeySignature.whiteout = ##t b'2 b~ \time 3/4 \key a \major b r4 }
Predefined commands
\tieUp
,
\tieDown
,
\tieNeutral
,
\tieDotted
,
\tieDashed
,
\tieDashPattern
,
\tieHalfDashed
,
\tieHalfSolid
,
\tieSolid
.
Selected Snippets
Using ties with arpeggios
Ties are sometimes used to write out arpeggios. In this case, two tied
notes need not be consecutive. This can be achieved by setting the
tieWaitForNote
property to #t
. The same feature is also
useful, for example, to tie a tremolo to a chord, but in principle, it
can also be used for ordinary consecutive notes.
\relative c' { \set tieWaitForNote = ##t \grace { c16[ ~ e ~ g] ~ } <c, e g>2 \repeat tremolo 8 { c32 ~ c' ~ } <c c,>1 e8 ~ c ~ a ~ f ~ <e' c a f>2 \tieUp c8 ~ a \tieDown \tieDotted g8 ~ c g2 }
Engraving ties manually
Ties may be engraved manually by changing the tie-configuration
property of the TieColumn
object. The first number indicates the
distance from the center of the staff in half staff-spaces, and the
second number indicates the direction (1 = up, -1 = down).
Note that LilyPond makes a distinction between exact and inexact values
for the first number. If using an exact value (i.e., either an integer
or a fraction like (/ 4 5)
), the value serves as a rough
vertical position that gets further tuned by LilyPond to make the tie
avoid staff lines. If using an inexact value like a floating point
number, it is taken as the vertical position without further
adjustments.
\relative c' { <c e g>2~ <c e g> \override TieColumn.tie-configuration = #'((0.0 . 1) (-2.0 . 1) (-4.0 . 1)) <c e g>2~ <c e g> \override TieColumn.tie-configuration = #'((0 . 1) (-2 . 1) (-4 . 1)) <c e g>2~ <c e g> }
See also
Music Glossary: tie, laissez vibrer.
Notation Reference: Slurs, Automatic note splitting.
Snippets: Expressive marks, Rhythms.
Internals Reference: LaissezVibrerTie, LaissezVibrerTieColumn, TieColumn, Tie.
Known issues and warnings
Switching staves when a tie is active will not produce a slanted tie.
Changing clefs or ottavations during a tie is not really well-defined. In these cases, a slur may be preferable.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Ties ] | [ Up : Rhythms ] | [ Rests > ] |
1.2.2 Writing rests
Rests are entered as part of the music in music expressions.
Rests | ||
Invisible rests | ||
Full measure rests |
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Writing rests ] | [ Up : Writing rests ] | [ Invisible rests > ] |
Rests
Rests are entered like notes with the note name r
.
Durations longer than a whole rest use the following predefined
commands:
\new Staff { % These two lines are just to prettify this example \time 16/1 \omit Staff.TimeSignature % Print a maxima rest, equal to four breves r\maxima % Print a longa rest, equal to two breves r\longa % Print a breve rest r\breve r1 r2 r4 r8 r16 r32 r64 r128 }
Whole measure rests, centered in the middle of the measure, must be entered as multi-measure rests. They can be used for a single measure as well as many measures and are discussed in Full measure rests.
To explicitly specify a rest’s vertical position, write a note
followed by \rest
. A rest of the duration of the note will
be placed at the staff position where the note would appear. This
allows for precise manual formatting of polyphonic music, since the
automatic rest collision formatter will not move these rests.
\relative { a'4\rest d4\rest }
Selected Snippets
Rest styles
Rests may be used in various styles.
\new Staff \relative c { \omit Score.TimeSignature \cadenzaOn \override Staff.Rest.style = #'mensural r\maxima^\markup \typewriter { mensural } r\longa r\breve r1 r2 r4 r8 r16 s32 s64 s128 s128 \bar "" \break \override Staff.Rest.style = #'neomensural r\maxima^\markup \typewriter { neomensural } r\longa r\breve r1 r2 r4 r8 r16 s32 s64 s128 s128 \bar "" \break \override Staff.Rest.style = #'classical r\maxima^\markup \typewriter { classical } r\longa r\breve r1 r2 r4 r8 r16 r32 r64 r128 s128 \bar "" \break \override Staff.Rest.style = #'z r\maxima^\markup \typewriter { z-style } r\longa r\breve r1 r2 r4 r8 r16 r32 r64 r128 s128 \bar "" \break \override Staff.Rest.style = #'default r\maxima^\markup \typewriter { default } r\longa r\breve r1 r2 r4 r8 r16 r32 r64 r128 s128 }
See also
Music Glossary: breve, longa, maxima.
Notation Reference: Full measure rests.
Snippets: Rhythms.
Internals Reference: Rest.
Known issues and warnings
There is no fundamental limit to rest durations (both in terms of longest and shortest), but the number of glyphs is limited: there are rests from 1024th to maxima (8× whole).
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Rests ] | [ Up : Writing rests ] | [ Full measure rests > ] |
Invisible rests
An invisible rest (also called a ‘spacer rest’) can be entered
like a note with the note name s
:
\relative c'' { c4 c s c | s2 c | }
Spacer rests are available only in note mode and chord mode. In
other situations, for example, when entering lyrics, the
command \skip
is used to skip a musical moment.
\skip
requires an explicit duration, but this is ignored if
the lyrics derive their durations from the notes in an associated
melody through \addlyrics
or \lyricsto
.
<< { a'2 \skip2 a'2 a'2 } \new Lyrics { \lyricmode { foo2 \skip 1 bla2 } } >>
Because \skip
is a command, it does not affect the default
durations of following notes, unlike s
.
<< { \repeat unfold 8 { a'4 } } { a'4 \skip 2 a' | s2 a' } >>
A spacer rest implicitly causes Staff
and Voice
contexts to be created if none exist, just like notes and rests
do:
{ s1 s s }
\skip
simply skips musical time; it creates no output of
any kind.
% This is valid input, but does nothing { \skip 1 \skip1 \skip 1 }
See also
Learning Manual: Visibility and color of objects.
Notation Reference: Hidden notes, Visibility of objects.
Snippets: Rhythms.
Internals Reference: SkipMusic.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Invisible rests ] | [ Up : Writing rests ] | [ Displaying rhythms > ] |
Full measure rests
Rests for one or more full measures are entered like notes with the note name uppercase ‘R’. Their duration is entered identically to the duration notation used for notes, including the ability to use duration multipliers, as explained in Scaling durations:
% Rest measures contracted to single measure \compressMMRests { R1*4 R1*24 R1*4 b'2^"Tutti" b'4 a'4 }
The example above also demonstrates how to compress multiple empty measures, as explained in Compressing empty measures.
The duration of a multi-measure rest must always be equal to the length of one or several measures. Therefore, some time signatures require the use of augmentation dots or fractions:
\compressMMRests { \time 2/4 R1 | R2 | \time 3/4 R2. | R2.*2 | \time 13/8 R1*13/8 | R1*13/8*12 | \time 10/8 R4*5*4 | }
A full-measure rest is printed as either a whole or breve rest, centered in the measure, depending on the time signature.
\time 4/4 R1 | \time 6/4 R1*3/2 | \time 8/4 R1*2 |
Markups can be added to multi-measure rests.
\compressMMRests { \time 3/4 R2.*10^\markup { \italic "ad lib." } }
Note: Markups and articulations attached to multi-measure rests
are MultiMeasureRestText
and
MultiMeasureRestScript
types, not TextScript
and
Script
. Overrides must
be directed to the correct object, or they will be ignored. See the
following example:
% This fails, as the wrong object name is specified \override TextScript.padding = #5 \override Script.color = #blue R1^"wrong" R1\fermata % This is the correct object name to be specified \override MultiMeasureRestText.padding = #5 \override MultiMeasureRestScript.color = #blue R1^"right" R1\fermata
When a multi-measure rest immediately follows a \partial
setting, resulting bar-check warnings may not be displayed.
Predefined commands
\textLengthOn
,
\textLengthOff
,
\compressMMRests
.
Selected Snippets
Multi-measure rest length control
Multi-measure rests have length according to their total duration which
is under the control of MultiMeasureRest.space-increment
. Note that
the default value is 2.0
.
\relative c' { \compressEmptyMeasures R1*2 R1*4 R1*64 R1*16 \override Staff.MultiMeasureRest.space-increment = 2.5 R1*2 R1*4 R1*64 R1*16 }
Positioning multi-measure rests
Unlike ordinary rests, there is no predefined command to change the staff position of a multi-measure rest symbol of either form by attaching it to a note. However, in polyphonic music multi-measure rests in odd-numbered and even-numbered voices are vertically separated. The positioning of multi-measure rests can be controlled as follows:
\relative c'' { % Multi-measure rests by default are set under the fourth line R1 % They can be moved using an override \override MultiMeasureRest.staff-position = #-2 R1 \override MultiMeasureRest.staff-position = #0 R1 \override MultiMeasureRest.staff-position = #2 R1 \override MultiMeasureRest.staff-position = #3 R1 \override MultiMeasureRest.staff-position = #6 R1 \revert MultiMeasureRest.staff-position \break % In two Voices, odd-numbered voices are under the top line << { R1 } \\ { a1 } >> % Even-numbered voices are under the bottom line << { a1 } \\ { R1 } >> % Multi-measure rests in both voices remain separate << { R1 } \\ { R1 } >> % Separating multi-measure rests in more than two voices % requires an override << { R1 } \\ { R1 } \\ \once \override MultiMeasureRest.staff-position = #0 { R1 } >> % Using compressed bars in multiple voices requires another override % in all voices to avoid multiple instances being printed \compressMMRests << \revert MultiMeasureRest.direction { R1*3 } \\ \revert MultiMeasureRest.direction { R1*3 } >> }
Multi-measure rest markup
Markups attached to a multi-measure rest will be centered above or below it. Long markups attached to multi-measure rests do not cause the measure to expand. To expand a multi-measure rest to fit the markup, use an empty chord with an attached markup before the multi-measure rest.
Text attached to a spacer rest in this way is left-aligned to the position where the note would be placed in the measure, but if the measure length is determined by the length of the text, the text will appear to be centered.
\relative c' { \compressMMRests { \textLengthOn <>^\markup { [MAJOR GENERAL] } R1*19 <>_\markup { \italic { Cue: ... it is yours } } <>^\markup { A } R1*30^\markup { [MABEL] } \textLengthOff c4^\markup { CHORUS } d f c } }
See also
Music Glossary: multi-measure rest.
Notation Reference: Durations, Scaling durations, Compressing empty measures, Text, Formatting text, Text scripts.
Snippets: Rhythms.
Internals Reference: MultiMeasureRest, MultiMeasureRestNumber, MultiMeasureRestScript, MultiMeasureRestText.
Known issues and warnings
Fingerings over multi-measure rests (e.g., R1*10-4
) may result
in the fingering numeral colliding with the bar counter
numeral.
There is no way to automatically condense multiple ordinary rests into a single multi-measure rest.
Multi-measure rests do not take part in rest collisions.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Full measure rests ] | [ Up : Rhythms ] | [ Time signature > ] |
1.2.3 Displaying rhythms
Time signature | ||
Metronome marks | ||
Upbeats | ||
Unmetered music | ||
Polymetric notation | ||
Automatic note splitting | ||
Showing melody rhythms |
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Displaying rhythms ] | [ Up : Displaying rhythms ] | [ Metronome marks > ] |
Time signature
The time signature is set as follows:
\time 2/4 c''2 \time 3/4 c''2.
Mid-measure time signature changes are covered in Upbeats.
Time signatures are printed at the beginning of a piece and whenever the time signature changes. If a change takes place at the end of a line a warning time signature sign is printed there. This default behavior may be changed, see Visibility of objects.
\relative c'' { \time 2/4 c2 c \break c c \break \time 4/4 c c c c }
The time signature symbol that is used in 2/2 and 4/4 time can be changed to a numeric style:
\relative c'' { % Default style \time 4/4 c1 \time 2/2 c1 % Change to numeric style \numericTimeSignature \time 4/4 c1 \time 2/2 c1 % Revert to default style \defaultTimeSignature \time 4/4 c1 \time 2/2 c1 }
Mensural time signatures are covered in Mensural time signatures.
In addition to setting the printed time signature, the \time
command also sets the values of the time-signature-based properties
baseMoment
, beatStructure
, and beamExceptions
.
The predefined default values for these properties can be found in
‘scm/time-signature-settings.scm’.
The default value of beatStructure
can be overridden in the
\time
command itself by supplying it as the optional first
argument:
\score { \new Staff { \relative { \time 2,2,3 7/8 \repeat unfold 7 { c'8 } | \time 3,2,2 7/8 \repeat unfold 7 { c8 } | } } }
Alternatively, the default values of all these time-signature-based
variables, including baseMoment
and beamExceptions
,
can be set together. The values can be set independently for several
different time signatures. The new values take effect when a
subsequent \time
command with the same value of the time
signature is executed:
\score { \new Staff { \relative c' { \overrideTimeSignatureSettings 4/4 % timeSignatureFraction 1/4 % baseMomentFraction 3,1 % beatStructure #'() % beamExceptions \time 4/4 \repeat unfold 8 { c8 } | } } }
\overrideTimeSignatureSettings
takes four arguments:
-
timeSignatureFraction
, a fraction describing the time signature to which these values apply. -
baseMomentFraction
, a fraction containing the numerator and denominator of the basic timing unit for the time signature. -
beatStructure
, a Scheme list indicating the structure of the beats in the measure, in units of the base moment. -
beamExceptions
, an alist containing any beaming rules for the time signature that go beyond ending at every beat, as described in Setting automatic beam behavior.
Changed values of default time signature properties can be restored to the original values:
\score { \relative { \repeat unfold 8 { c'8 } | \overrideTimeSignatureSettings 4/4 % timeSignatureFraction 1/4 % baseMomentFraction 3,1 % beatStructure #'() % beamExceptions \time 4/4 \repeat unfold 8 { c8 } | \revertTimeSignatureSettings 4/4 \time 4/4 \repeat unfold 8 { c8 } | } }
Different values of default time signature properties can be established
for different staves by moving the Timing_translator
and the
Default_bar_line_engraver
from the Score
context to the
Staff
context.
\score { \new StaffGroup << \new Staff { \overrideTimeSignatureSettings 4/4 % timeSignatureFraction 1/4 % baseMomentFraction 3,1 % beatStructure #'() % beamExceptions \time 4/4 \repeat unfold 8 {c''8} } \new Staff { \overrideTimeSignatureSettings 4/4 % timeSignatureFraction 1/4 % baseMomentFraction 1,3 % beatStructure #'() % beamExceptions \time 4/4 \repeat unfold 8 {c''8} } >> \layout { \context { \Score \remove "Timing_translator" \remove "Default_bar_line_engraver" } \context { \Staff \consists "Timing_translator" \consists "Default_bar_line_engraver" } } }
A further method of changing these time-signature-related variables, which avoids reprinting the time signature at the time of the change, is shown in Setting automatic beam behavior.
Predefined commands
\numericTimeSignature
,
\defaultTimeSignature
.
Selected Snippets
Time signature printing only the numerator as a number (instead of the fraction)
Sometimes, a time signature should not print the whole fraction (e.g.
7/4), but only the numerator (7 in this case). This can be easily done
by using \override Staff.TimeSignature.style = #'single-digit
to change the style permanently. By using
\revert Staff.TimeSignature.style
, this setting can be
reversed. To apply the single-digit style to only one time signature,
use the \override
command and prefix it with a \once
.
\relative c'' { \time 3/4 c4 c c % Change the style permanently \override Staff.TimeSignature.style = #'single-digit \time 2/4 c4 c \time 3/4 c4 c c % Revert to default style: \revert Staff.TimeSignature.style \time 2/4 c4 c % single-digit style only for the next time signature \once \override Staff.TimeSignature.style = #'single-digit \time 5/4 c4 c c c c \time 2/4 c4 c }
See also
Music Glossary: time signature
Notation Reference: Mensural time signatures, Setting automatic beam behavior, Time administration.
Installed Files: ‘scm/time-signature-settings.scm’.
Snippets: Rhythms.
Internals Reference: TimeSignature, Timing_translator.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Time signature ] | [ Up : Displaying rhythms ] | [ Upbeats > ] |
Metronome marks
A basic metronome mark is simple to write:
\relative { \tempo 4 = 120 c'2 d e4. d8 c2 }
Metronome marks may also be printed as a range of two numbers:
\relative { \tempo 4 = 40 - 46 c'4. e8 a4 g b,2 d4 r }
Tempo indications with text can be used instead:
\relative { \tempo "Allegretto" c''4 e d c b4. a16 b c4 r4 }
Combining a metronome mark and text will automatically place the metronome mark within parentheses:
\relative { \tempo "Allegro" 4 = 160 g'4 c d e d4 b g2 }
In general, the text can be any markup object:
\relative { \tempo \markup { \italic Faster } 4 = 132 a'8-. r8 b-. r gis-. r a-. r }
A parenthesized metronome mark with no textual indication may be written by including an empty string in the input:
\relative { \tempo "" 8 = 96 d''4 g e c }
In a part for an instrument with long periods of rests (see
Full measure rests),
tempo indications sometimes follow each other closely.
The command \markLengthOn
provides extra horizontal space
to prevent tempo indications from overlapping, and \markLengthOff
restores the default behavior of ignoring tempo marks
for horizontal spacing.
\compressMMRests { \markLengthOn \tempo "Molto vivace" R1*12 \tempo "Meno mosso" R1*16 \markLengthOff \tempo "Tranquillo" R1*20 }
Selected Snippets
Printing metronome and rehearsal marks below the staff
By default, metronome and rehearsal marks are printed above the
staff. To place them below the staff simply set the direction
property of MetronomeMark
or RehearsalMark
appropriately.
\layout { indent = 0 ragged-right = ##f } { % Metronome marks below the staff \override Score.MetronomeMark.direction = #DOWN \tempo 8. = 120 c''1 % Rehearsal marks below the staff \override Score.RehearsalMark.direction = #DOWN \mark \default c''1 }
Changing the tempo without a metronome mark
To change the tempo in MIDI output without printing anything, make the metronome mark invisible.
\score { \new Staff \relative c' { \tempo 4 = 160 c4 e g b c4 b d c \set Score.tempoHideNote = ##t \tempo 4 = 96 d,4 fis a cis d4 cis e d } \layout { } \midi { } }
Creating metronome marks in markup mode
New metronome marks can be created in markup mode, but they will not change the tempo in MIDI output.
\relative c' { \tempo \markup { \concat { ( \smaller \general-align #Y #DOWN \note {16.} #1 " = " \smaller \general-align #Y #DOWN \note {8} #1 ) } } c1 c4 c' c,2 }
For more details, see Formatting text.
See also
Music Glossary: metronome, metronomic indication, tempo indication, metronome mark.
Notation Reference: Formatting text, Creating MIDI output, Full measure rests.
Snippets: Staff notation.
Internals Reference: MetronomeMark.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Metronome marks ] | [ Up : Displaying rhythms ] | [ Unmetered music > ] |
Upbeats
Partial or pick-up measures, such as an anacrusis or an
upbeat, are entered using the \partial
command:
\partial duration
When \partial
is used at the beginning of a score,
duration
is the length of the music preceding the
first bar.
\relative { \time 3/4 \partial 4. r4 e'8 | a4 c8 b c4 | }
When \partial
is used after the beginning of a score,
duration
is the remaining length of the
current measure. It does not create a new numbered bar.
\relative { \set Score.barNumberVisibility = #all-bar-numbers-visible \override Score.BarNumber.break-visibility = #end-of-line-invisible \time 9/8 d''4.~ 4 d8 d( c) b | c4.~ 4. \bar "||" \time 12/8 \partial 4. c8( d) e | f2.~ 4 f8 a,( c) f | }
The \partial
command is required when the time
signature changes in mid measure, but it may also be used alone.
\relative { \set Score.barNumberVisibility = #all-bar-numbers-visible \override Score.BarNumber.break-visibility = #end-of-line-invisible \time 6/8 \partial 8 e'8 | a4 c8 b[ c b] | \partial 4 r8 e,8 | a4 \bar "||" \partial 4 r8 e8 | a4 c8 b[ c b] | }
The \partial
command sets the Timing.measurePosition
property, which is a rational number that indicates how much of
the measure has passed.
See also
Music Glossary: anacrusis.
Notation Reference: Grace notes.
Snippets: Rhythms.
Internal Reference: Timing_translator.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Upbeats ] | [ Up : Displaying rhythms ] | [ Polymetric notation > ] |
Unmetered music
In music such as cadenzas, it may be desirable to disable
automatic measure demarcation and all that it entails: numbering
bars, resetting accidentals, etc. Music between \cadenzaOn
and \cadenzaOff
does not count toward the length of a
measure.
\relative c'' { % Show all bar numbers \override Score.BarNumber.break-visibility = #all-visible c4 d e d \cadenzaOn c4 cis d8[ d d] f4 g4. \cadenzaOff d4 e d c }
To divide an unmetered passage into irregular measures,
temporarily re-enable timing and use \partial
to create a
tiny measure. The \bar
command alone does not start a new
measure.
cadenzaMeasure = { \cadenzaOff \partial 1024 s1024 \cadenzaOn } \relative c'' { % Show all bar numbers \override Score.BarNumber.break-visibility = #all-visible c4 d e d \cadenzaOn c4 cis \bar "!" d8[ d d] \cadenzaMeasure f4 g4. \cadenzaMeasure \cadenzaOff d4 e d c }
Automatic beaming is disabled by \cadenzaOn
. Therefore, all
beaming in cadenzas must be entered manually. See Manual beams.
\relative { \repeat unfold 8 { c''8 } \cadenzaOn cis8 c c c c \bar"|" c8 c c \cadenzaOff \repeat unfold 8 { c8 } }
These predefined commands affect all staves in the score, even when
placed in just one Voice
context. To change this, move the
Timing_translator
from the Score
context to the
Staff
context. See Polymetric notation.
Predefined commands
\cadenzaOn
,
\cadenzaOff
.
See also
Music Glossary: cadenza.
Notation Reference: Visibility of objects, Polymetric notation, Manual beams, Accidentals.
Snippets: Rhythms.
Known issues and warnings
Automatic line and page breaks are inserted only at bar lines, so ‘invisible’ bar lines will need to be inserted manually in long stretches of unmetered music to permit breaking:
\bar ""
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Unmetered music ] | [ Up : Displaying rhythms ] | [ Automatic note splitting > ] |
Polymetric notation
Polymetric notation is supported explicitly or by manually modifying the visible time signature symbol and/or scaling note durations.
Different time signatures with equal-length measures
Set a common time signature for each staff, and set the
timeSignatureFraction
to the desired fraction. Then use the
\scaleDurations
function to scale the durations of the notes in
each staff to the common time signature.
In the following 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 (because 2/3 * 9/8 = 3/4) and in the third staff, the shown durations are multiplied by 3/5 (because 3/5 * 10/8 = 3/4). It may be necessary to insert beams manually, as the duration scaling will affect the autobeaming rules.
\relative << \new Staff { \time 3/4 c'4 c c | c4 c c | } \new Staff { \time 3/4 \set Staff.timeSignatureFraction = 9/8 \scaleDurations 2/3 \repeat unfold 6 { c8[ c c] } } \new Staff { \time 3/4 \set Staff.timeSignatureFraction = 10/8 \scaleDurations 3/5 { \repeat unfold 2 { c8[ c c] } \repeat unfold 2 { c8[ c] } | c4. c \tuplet 3/2 { c8[ c c] } c4 } } >>
Different time signatures with unequal-length measures
Each staff can be given its own independent time signature by
moving the Timing_translator
and the
Default_bar_line_engraver
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" } } % Now each staff has its own time signature. \relative << \new Staff { \time 3/4 c'4 c c | c4 c c | } \new Staff { \time 2/4 c4 c | c4 c | c4 c | } \new Staff { \time 3/8 c4. | c8 c c | c4. | c8 c c | } >>
Compound time signatures
These are created using the \compoundMeter
function. The syntax
for this is:
\compoundMeter #'(list of lists)
The simplest construction is a single list, where the last number indicates the bottom number of the time signature and those that come before it, the top numbers.
\relative { \compoundMeter #'((2 2 2 8)) \repeat unfold 6 c'8 \repeat unfold 12 c16 }
More complex meters can be constructed using additional lists. Also, automatic beaming settings will be adjusted depending on the values.
\relative { \compoundMeter #'((1 4) (3 8)) \repeat unfold 5 c'8 \repeat unfold 10 c16 } \relative { \compoundMeter #'((1 2 3 8) (3 4)) \repeat unfold 12 c'8 }
See also
Music Glossary: polymetric, polymetric time signature, meter.
Notation Reference: Automatic beams, Manual beams, Time signature, Scaling durations.
Snippets: Rhythms.
Internals Reference: TimeSignature, Timing_translator, Default_bar_line_engraver, Staff.
Known issues and warnings
Although notes that occur at the same moment in each of the different staves will be placed at the same horizontal location, bar lines (in each staff) may cause inconsistent spacing within each of the different time signatures.
Using a midi
block with polymetric notation may cause unexpected
barcheck warnings. In this case move the Timing_translator
from
the Score
context to the Staff
context within the
midi
block.
\midi { \context { \Score \remove "Timing_translator" } \context { \Staff \consists "Timing_translator" } }
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Polymetric notation ] | [ Up : Displaying rhythms ] | [ Showing melody rhythms > ] |
Automatic note splitting
Long notes which overrun bar lines can be converted automatically to
tied notes. This is done by replacing the Note_heads_engraver
with the Completion_heads_engraver
. Similarly, long rests which
overrun bar lines are split automatically by replacing the
Rest_engraver
with the Completion_rest_engraver
. In the
following example, notes and rests crossing the bar lines are split,
notes are also tied.
\new Voice \with { \remove "Note_heads_engraver" \consists "Completion_heads_engraver" \remove "Rest_engraver" \consists "Completion_rest_engraver" } \relative { c'2. c8 d4 e f g a b c8 c2 b4 a g16 f4 e d c8. c2 r1*2 }
These engravers split all running notes and rests at the bar line, and inserts ties for notes. One of its uses is to debug complex scores: if the measures are not entirely filled, then the ties show exactly how much each measure is off.
The property completionUnit
sets a preferred duration for
the split notes.
\new Voice \with { \remove "Note_heads_engraver" \consists "Completion_heads_engraver" } \relative { \time 9/8 g\breve. d''4. \bar "||" \set completionUnit = #(ly:make-moment 3 8) g\breve. d4. }
These engravers split notes with scaled duration, such as those in tuplets, into notes with the same scale-factor as in the input note.
\new Voice \with { \remove "Note_heads_engraver" \consists "Completion_heads_engraver" } \relative { \time 2/4 r4 \tuplet 3/2 {g'4 a b} \scaleDurations 2/3 {g a b} g4*2/3 a b \tuplet 3/2 {g4 a b} r4 }
See also
Music Glossary: tie
Learning Manual: Engravers explained, Adding and removing engravers.
Snippets: Rhythms.
Internals Reference: Note_heads_engraver, Completion_heads_engraver, Rest_engraver, Completion_rest_engraver, Forbid_line_break_engraver.
Known issues and warnings
For consistency with previous behavior, notes and rests with
duration longer than a measure, such as c1*2
, are split into
notes without any scale factor, { c1 c1 }
. The property
completionFactor
controls this behavior, and setting it to
#f
cause split notes and rests to have the scale factor
of the input durations.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Automatic note splitting ] | [ Up : Displaying rhythms ] | [ Beams > ] |
Showing melody rhythms
Sometimes you might want to show only the rhythm of a melody. This can be done with the rhythmic staff. All pitches of notes on such a staff are squashed, and the staff itself has a single line
<< \new RhythmicStaff { \new Voice = "myRhythm" \relative { \time 4/4 c'4 e8 f g2 r4 g g f g1 } } \new Lyrics { \lyricsto "myRhythm" { This is my song I like to sing } } >>
Guitar chord charts often show the strumming rhythms. This can
be done with the Pitch_squash_engraver
and
\improvisationOn
.
<< \new ChordNames { \chordmode { c1 f g c } } \new Voice \with { \consists "Pitch_squash_engraver" } \relative c'' { \improvisationOn c4 c8 c c4 c8 c f4 f8 f f4 f8 f g4 g8 g g4 g8 g c4 c8 c c4 c8 c } >>
Music containing chords can also be used as input to RhythmicStaff
and for use with the Pitch_squash_engraver
if the chords are first
reduced to single notes with the \reduceChords
music function:
\new RhythmicStaff { \time 4/4 \reduceChords { <c>2 <e>2 <c e g>2 <c e g>4 <c e g>4 } }
Predefined commands
\improvisationOn
,
\improvisationOff
,
\reduceChords
.
Selected Snippets
Guitar strum rhythms
For guitar music, it is possible to show strum rhythms, along with melody notes, chord names and fret diagrams.
\include "predefined-guitar-fretboards.ly" << \new ChordNames { \chordmode { c1 | f | g | c } } \new FretBoards { \chordmode { c1 | f | g | c } } \new Voice \with { \consists "Pitch_squash_engraver" } { \relative c'' { \improvisationOn c4 c8 c c4 c8 c f4 f8 f f4 f8 f g4 g8 g g4 g8 g c4 c8 c c4 c8 c } } \new Voice = "melody" { \relative c'' { c2 e4 e4 f2. r4 g2. a4 e4 c2. } } \new Lyrics { \lyricsto "melody" { This is my song. I like to sing. } } >>
See also
Snippets: Rhythms.
Internals Reference: RhythmicStaff, Pitch_squash_engraver.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Showing melody rhythms ] | [ Up : Rhythms ] | [ Automatic beams > ] |
1.2.4 Beams
Automatic beams | ||
Setting automatic beam behavior | ||
Manual beams | ||
Feathered beams |
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Beams ] | [ Up : Beams ] | [ Setting automatic beam behavior > ] |
Automatic beams
By default, beams are inserted automatically:
\relative c'' { \time 2/4 c8 c c c \time 6/8 c8 c c c8. c16 c8 }
If these automatic decisions are not satisfactory, beaming can be entered explicitly; see Manual beams. Beams must be entered manually if beams are to be extended over rests.
If automatic beaming is not required, it may be turned off with
\autoBeamOff
and on with \autoBeamOn
:
\relative c' { c4 c8 c8. c16 c8. c16 c8 \autoBeamOff c4 c8 c8. c16 c8. \autoBeamOn c16 c8 }
Note: If beams are used to indicate melismata in songs, then
automatic beaming should be switched off with autoBeamOff
and the beams indicated manually. Using partCombine
with
autoBeamOff
can produce unintended results. See the
snippets for more information.
Beaming patterns that differ from the automatic defaults can be created; see Setting automatic beam behavior.
Predefined commands
\autoBeamOff
,
\autoBeamOn
.
Selected Snippets
Beams across line breaks
Line breaks are normally forbidden when beams cross bar lines. This behavior can be changed as shown:
\relative c'' { \override Beam.breakable = ##t c8 c[ c] c[ c] c[ c] c[ \break c8] c[ c] c[ c] c[ c] c }
Changing beam knee gap
Kneed beams are inserted automatically when a large gap is detected
between the note heads. This behavior can be tuned through the
auto-knee-gap
property. A kneed beam is drawn if the gap is
larger than the value of auto-knee-gap
plus the width of the
beam object (which depends on the duration of the notes and the slope
of the beam). By default auto-knee-gap
is set to 5.5 staff
spaces.
{ f8 f''8 f8 f''8 \override Beam.auto-knee-gap = #6 f8 f''8 f8 f''8 }
Partcombine and autoBeamOff
The function of \autoBeamOff
when used with
\partCombine
can be difficult to understand.
It may be preferable to use
\set Staff.autoBeaming = ##f
instead, to ensure that autobeaming will be turned off for the entire staff.
\partCombine
apparently works with 3 voices – stem up single,
stem down single, stem up combined.
An \autoBeamOff
call in the first argument to partcombine will
apply to the voice that is active at the time the call is processed,
either stem up single or stem up combined. An \autoBeamOff
call
in the second argument will apply to the voice that is stem down
single.
In order to use \autoBeamOff
to stop all autobeaming when used
with \partCombine
, it will be necessary to use three
calls to \autoBeamOff
.
{ %\set Staff.autoBeaming = ##f % turns off all autobeaming \partCombine { \autoBeamOff % applies to split up stems \repeat unfold 4 a'16 %\autoBeamOff % applies to combined up stems \repeat unfold 4 a'8 \repeat unfold 4 a'16 } { \autoBeamOff % applies to down stems \repeat unfold 4 f'8 \repeat unfold 8 f'16 | } }
See also
Notation Reference: Manual beams, Setting automatic beam behavior.
Installed Files: ‘scm/auto-beam.scm’.
Snippets: Rhythms.
Internals Reference: Auto_beam_engraver, Beam_engraver, Beam, BeamEvent, BeamForbidEvent, beam-interface, unbreakable-spanner-interface.
Known issues and warnings
The properties of a beam are determined at the start of its construction and any additional beam-property changes that occur before the beam has been completed will not take effect until the next, new beam starts.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Automatic beams ] | [ Up : Beams ] | [ Manual beams > ] |
Setting automatic beam behavior
When automatic beaming is enabled, the placement of automatic beams
is determined by three context properties:
baseMoment
, beatStructure
, and beamExceptions
.
The default values of these variables may be overridden as described
below, or alternatively the default values themselves may be changed
as explained in Time signature.
If a beamExceptions
rule is defined for the time signature in
force, that rule alone is used to determine the beam placement; the
values of baseMoment
and beatStructure
are ignored.
If no beamExceptions
rule is defined for the time signature
in force, the beam placement is determined by the values of
baseMoment
and beatStructure
.
Beaming based on baseMoment
and beatStructure
By default, beamExceptions
rules are defined for most common
time signatures, so the beamExceptions
rules must be disabled
if automatic beaming is to be based on baseMoment
and
beatStructure
. The beamExceptions
rules are disabled
by
\set Timing.beamExceptions = #'()
When beamExceptions
is set to #'()
, either due to an
explicit setting or because no beamExceptions
rules are defined
internally for the time signature in force, the ending points for
beams are on beats as specified by the context properties
baseMoment
and beatStructure
. beatStructure
is
a scheme list that defines the length of each beat in the measure in
units of baseMoment
. By default, baseMoment
is one
over the denominator of the time signature. By default, each unit of
length baseMoment
is a single beat.
Note that there are separate beatStructure
and baseMoment
values for each time signature. Changes to these variables apply only
to the time signature that is currently in force, hence those changes
must be placed after the \time
command which starts a new time
signature section, not before it. New values given to a particular
time signature are retained and reinstated whenever that time signature
is re-established.
\relative c'' { \time 5/16 c16^"default" c c c c | % beamExceptions are unlikely to be defined for 5/16 time, % but let's disable them anyway to be sure \set Timing.beamExceptions = #'() \set Timing.beatStructure = 2,3 c16^"(2+3)" c c c c | \set Timing.beatStructure = 3,2 c16^"(3+2)" c c c c | }
\relative { \time 4/4 a'8^"default" a a a a a a a % Disable beamExceptions because they are definitely % defined for 4/4 time \set Timing.beamExceptions = #'() \set Timing.baseMoment = #(ly:make-moment 1/4) \set Timing.beatStructure = 1,1,1,1 a8^"changed" a a a a a a a }
Beam setting changes can be limited to specific contexts. If no setting is included in a lower-level context, the setting of the enclosing context will apply.
\new Staff { \time 7/8 % No need to disable beamExceptions % as they are not defined for 7/8 time \set Staff.beatStructure = 2,3,2 << \new Voice = one { \relative { a'8 a a a a a a } } \new Voice = two { \relative { \voiceTwo \set Voice.beatStructure = 1,3,3 f'8 f f f f f f } } >> }
When multiple voices are used the Staff
context must be
specified if the beaming is to be applied to all voices in the
staff:
\time 7/8 % rhythm 3-1-1-2 % Change applied to Voice by default -- does not work correctly % Because of autogenerated voices, all beating will % be at baseMoment (1 . 8) \set beatStructure = 3,1,1,2 << \relative {a'8 a a a16 a a a a8 a} \\ \relative {f'4. f8 f f f} >> % Works correctly with context Staff specified \set Staff.beatStructure = 3,1,1,2 << \relative {a'8 a a a16 a a a a8 a} \\ \relative {f'4. f8 f f f} >>
The value of baseMoment
can be adjusted to change
the beaming behavior, if desired. When this is done,
the value of beatStructure
must be set to be
compatible with the new value of baseMoment
.
\time 5/8 % No need to disable beamExceptions % as they are not defined for 5/8 time \set Timing.baseMoment = #(ly:make-moment 1/16) \set Timing.beatStructure = 7,3 \repeat unfold 10 { a'16 }
baseMoment
is a moment; a unit of musical duration. A
quantity of type moment is created by the scheme function
ly:make-moment
. For more information about this function,
see Time administration.
By default baseMoment
is set to one over the denominator of
the time signature. Any exceptions to this default can be found in
‘scm/time-signature-settings.scm’.
Beaming based on beamExceptions
Special autobeaming rules (other than ending a beam on a beat)
are defined in the beamExceptions
property.
The value for beamExceptions
, a somewhat complex Scheme
data structure, is easiest generated with the
\beamExceptions
function. This function is given one or
more manually beamed measure-length rhythmic patterns (measures
have to be separated by a bar check |
since the
function has no other way to discern the measure length). Here is
a simple example:
\relative c'' { \time 3/16 \set Timing.beatStructure = 2,1 \set Timing.beamExceptions = \beamExceptions { 32[ 32] 32[ 32] 32[ 32] } c16 c c | \repeat unfold 6 { c32 } | }
Note: A beamExceptions
value must be complete
exceptions list. That is, every exception that should be applied
must be included in the setting. It is not possible to add, remove,
or change only one of the exceptions. While this may seem cumbersome,
it means that the current beaming settings need not be known in order
to specify a new beaming pattern.
When the time signature is changed, default values of
Timing.baseMoment
, Timing.beatStructure
,
and Timing.beamExceptions
are set. Setting the time signature
will reset the automatic beaming settings for the Timing
context to the default behavior.
\relative a' { \time 6/8 \repeat unfold 6 { a8 } % group (4 + 2) \set Timing.beatStructure = 4,2 \repeat unfold 6 { a8 } % go back to default behavior \time 6/8 \repeat unfold 6 { a8 } }
The default automatic beaming settings for a time signature are determined in ‘scm/time-signature-settings.scm’. Changing the default automatic beaming settings for a time signature is described in Time signature.
Many automatic beaming settings for a time signature contain an
entry for beamExceptions
. For example, 4/4 time tries to
beam the measure in two if there are only eighth notes. The
beamExceptions
rule can override the beatStructure
setting
if beamExceptions
is not reset.
\time 4/4 \set Timing.baseMoment = #(ly:make-moment 1/8) \set Timing.beatStructure = 3,3,2 % This won't beam (3 3 2) because of beamExceptions \repeat unfold 8 {c''8} | % This will beam (3 3 2) because we clear beamExceptions \set Timing.beamExceptions = #'() \repeat unfold 8 {c''8}
In a similar fashion, eighth notes in 3/4 time are beamed as a full
measure by default. To beam eighth notes in 3/4 time on the beat,
reset beamExceptions
.
\time 3/4 % by default we beam in (6) due to beamExceptions \repeat unfold 6 {a'8} | % This will beam (1 1 1) due to default baseMoment and beatStructure \set Timing.beamExceptions = #'() \repeat unfold 6 {a'8}
In engraving from the Romantic and Classical periods,
beams often begin midway through the measure in 3/4 time,
but modern practice is to avoid the false impression of 6/8 time
(see Gould, p. 153). Similar situations arise in 3/8 time.
This behavior is controlled by the context property beamHalfMeasure
,
which has effect only in time signatures with 3 in the numerator:
\relative a' { \time 3/4 r4. a8 a a | \set Timing.beamHalfMeasure = ##f r4. a8 a a | }
How automatic beaming works
When automatic beaming is enabled, the placement of automatic beams
is determined by the context properties
baseMoment
, beatStructure
, and beamExceptions
.
The following rules, in order of priority, apply when determining the appearance of beams:
-
If a manual beam is specified with
[…]
set the beam as specified, otherwise -
if a beam-ending rule is defined in
beamExceptions
for the beam-type, use it to determine the valid places where beams may end, otherwise -
if a beam-ending rule is defined in
beamExceptions
for a longer beam-type, use it to determine the valid places where beams may end, otherwise -
use the values of
baseMoment
andbeatStructure
to determine the ends of the beats in the measure, and end beams at the end of beats.
In the rules above, the beam-type is the duration of the shortest note in the beamed group.
The default beaming rules can be found in ‘scm/time-signature-settings.scm’.
Selected Snippets
Subdividing beams
The beams of consecutive 16th (or shorter) notes are, by default, not
subdivided. That is, the three (or more) beams stretch unbroken over
entire groups of notes. This behavior can be modified to subdivide the
beams into sub-groups by setting the property subdivideBeams
.
When set, multiple beams will be subdivided at intervals defined by the
current value of baseMoment
by reducing the multiple beams to
the number of beams that indicates the metric value of the subdivision.
If the group following the division is shorter than the current metric
value (usually because the beam is incomplete) the number of beams
reflects the longest possible subdivision group. However, if there is
only one note left after the division this restriction isn’t applied.
Note that baseMoment
defaults to one over the denominator of the
current time signature if not set explicitly. It must be set to a
fraction giving the duration of the beam sub-group using the
ly:make-moment
function, as shown in this snippet. Also, when
baseMoment
is changed, beatStructure
should also be
changed to match the new baseMoment
:
\relative c'' { c32[ c c c c c c c] \set subdivideBeams = ##t c32[ c c c c c c c] % Set beam sub-group length to an eighth note \set baseMoment = #(ly:make-moment 1/8) \set beatStructure = 2,2,2,2 c32[ c c c c c c c] % Set beam sub-group length to a sixteenth note \set baseMoment = #(ly:make-moment 1/16) \set beatStructure = 4,4,4,4 c32[ c c c c c c c] % Shorten beam by 1/32 \set baseMoment = #(ly:make-moment 1/8) \set beatStructure = 2,2,2,2 c32[ c c c c c c] r32 % Shorten beam by 3/32 \set baseMoment = #(ly:make-moment 1/8) \set beatStructure = 2,2,2,2 c32[ c c c c] r16. r2 }
Strict beat beaming
Beamlets can be set to point in the direction of the beat to which they belong. The first beam avoids sticking out flags (the default); the second beam strictly follows the beat.
\relative c'' { \time 6/8 a8. a16 a a \set strictBeatBeaming = ##t a8. a16 a a }
Conducting signs, measure grouping signs
Beat grouping within a measure is controlled by the
beatStructure
context property. Values of beatStructure
are established for many time signatures in
scm/time-signature-settings.scm
. Values of beatStructure
can be changed or set with \set
. Alternatively, \time
can be used to both set the time signature and establish the beat
structure. For this, you specify the internal grouping of beats in a
measure as a list of numbers (in Scheme syntax) before the time
signature.
\time
applies to the Timing
context, so it will not
reset values of beatStructure
or baseMoment
that are set
in other lower-level contexts, such as Voice
.
If the Measure_grouping_engraver
is included in one of the
display contexts, measure grouping signs will be created. Such signs
ease reading rhythmically complex modern music. In the example, the 9/8
measure is grouped in two different patterns using the two different
methods, while the 5/8 measure is grouped according to the default
setting in scm/time-signature-settings.scm
:
\score { \new Voice \relative c'' { \time 9/8 g8 g d d g g a( bes g) | \set Timing.beatStructure = 2,2,2,3 g8 g d d g g a( bes g) | \time 4,5 9/8 g8 g d d g g a( bes g) | \time 5/8 a4. g4 | } \layout { \context { \Staff \consists "Measure_grouping_engraver" } } }
Beam endings in Score context
Beam-ending rules specified in the Score
context apply to all
staves, but can be modified at both Staff
and Voice
levels:
\relative c'' { \time 5/4 % Set default beaming for all staves \set Score.baseMoment = #(ly:make-moment 1/8) \set Score.beatStructure = 3,4,3 << \new Staff { c8 c c c c c c c c c } \new Staff { % Modify beaming for just this staff \set Staff.beatStructure = 6,4 c8 c c c c c c c c c } \new Staff { % Inherit beaming from Score context << { \voiceOne c8 c c c c c c c c c } % Modify beaming for this voice only \new Voice { \voiceTwo \set Voice.beatStructure = 6,4 a8 a a a a a a a a a } >> } >> }
See also
Notation Reference: Time signature.
Installed Files: ‘scm/time-signature-settings.scm’.
Snippets: Rhythms.
Internals Reference: Auto_beam_engraver, Beam, BeamForbidEvent, beam-interface.
Known issues and warnings
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 for polyphonic voices, entered with
<< … \\ … >>
. If a polyphonic voice ends while an
automatic beam is still accepting notes, it is not typeset.
The workaround for these problems is to manually beam the last
beam in the voice or score.
By default, the Timing
translator is aliased to the
Score
context. This means that setting the time signature
in one staff will affect the beaming of the other staves as well.
Thus, a time signature setting in a later staff will reset custom
beaming that was set in an earlier staff.
One way to avoid this problem is to set the time signature
in only one staff.
<< \new Staff { \time 3/4 \set Timing.baseMoment = #(ly:make-moment 1/8) \set Timing.beatStructure = 1,5 \set Timing.beamExceptions = #'() \repeat unfold 6 { a'8 } } \new Staff { \repeat unfold 6 { a'8 } } >>
The default beam settings for the time signature can also be changed, so that the desired beaming will always be used. Changes in automatic beaming settings for a time signature are described in Time signature.
<< \new Staff { \overrideTimeSignatureSettings 3/4 % timeSignatureFraction 1/8 % baseMomentFraction 1,5 % beatStructure #'() % beamExceptions \time 3/4 \repeat unfold 6 { a'8 } } \new Staff { \time 3/4 \repeat unfold 6 { a'8 } } >>
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Setting automatic beam behavior ] | [ Up : Beams ] | [ Feathered beams > ] |
Manual beams
In some cases it may be necessary to override the automatic
beaming algorithm. For example, the autobeamer will not put beams
over rests or bar lines, and in choral scores the beaming is
often set to follow the meter of the lyrics rather than the
notes. Such beams can be specified manually by
marking the begin and end point with [
and ]
.
\relative { r4 r8[ g' a r] r g[ | a] r }
Beaming direction can be set manually using direction indicators:
\relative { c''8^[ d e] c,_[ d e f g] }
Individual notes may be marked with \noBeam
to prevent them
from being beamed:
\relative { \time 2/4 c''8 c\noBeam c c }
Grace note beams and normal note beams can occur simultaneously. Unbeamed grace notes are not put into normal note beams.
\relative { c''4 d8[ \grace { e32 d c d } e8] e[ e \grace { f16 } e8 e] }
Even more strict manual control with the beams can be achieved by
setting the properties stemLeftBeamCount
and
stemRightBeamCount
. They specify the number of beams to
draw on the left and right side, respectively, of the next note.
If either property is set, its value will be used only once, and
then it is erased. In this example, the last f
is printed
with only one beam on the left side, i.e., the eighth-note beam of
the group as a whole.
\relative a' { a8[ r16 f g a] a8[ r16 \set stemLeftBeamCount = #2 \set stemRightBeamCount = #1 f16 \set stemLeftBeamCount = #1 g16 a] }
Predefined commands
\noBeam
.
Selected Snippets
Flat flags and beam nibs
Flat flags on lone notes and beam nibs at the ends of beamed figures
are both possible with a combination of stemLeftBeamCount
,
stemRightBeamCount
and paired []
beam indicators.
For right-pointing flat flags on lone notes, use paired []
beam
indicators and set stemLeftBeamCount
to zero (see Example 1).
For left-pointing flat flags, set stemRightBeamCount
instead
(Example 2).
For right-pointing nibs at the end of a run of beamed notes, set
stemRightBeamCount
to a positive value. And for left-pointing
nibs at the start of a run of beamed notes, set
stemLeftBeamCount
instead (Example 3).
Sometimes it may make sense for a lone note surrounded by rests to
carry both a left- and right-pointing flat flag. Do this with paired
[]
beam indicators alone (Example 4).
(Note that \set stemLeftBeamCount
is always equivalent to
\once \set
. In other words, the beam count settings are not
“sticky”, so the pair of flat flags attached to the lone
16[]
in the last example have nothing to do with the
\set
two notes prior.)
\score { << % Example 1 \new RhythmicStaff { \set stemLeftBeamCount = #0 c16[] r8. } % Example 2 \new RhythmicStaff { r8. \set stemRightBeamCount = #0 16[] } % Example 3 \new RhythmicStaff { 16 16 \set stemRightBeamCount = #2 16 r r \set stemLeftBeamCount = #2 16 16 16 } % Example 4 \new RhythmicStaff { 16 16 \set stemRightBeamCount = #2 16 r16 16[] r16 \set stemLeftBeamCount = #2 16 16 } >> }
See also
Notation Reference: Direction and placement, Grace notes.
Snippets: Rhythms.
Internals Reference: Beam, BeamEvent, Beam_engraver, beam-interface, Stem_engraver.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Manual beams ] | [ Up : Beams ] | [ Bars > ] |
Feathered beams
Feathered beams are used to indicate that a small group of notes
should be played at an increasing (or decreasing) tempo, without
changing the overall tempo of the piece. The extent of the
feathered beam must be indicated manually using [
and
]
, and the beam feathering is turned on by specifying a
direction to the Beam
property grow-direction
.
If the placement of the notes and the sound in the MIDI output is to
reflect the ritardando or accelerando indicated by the
feathered beam the notes must be grouped as a music expression delimited
by braces and preceded by a featherDurations
command which specifies
the ratio between the durations of the first and last notes in the
group.
The square brackets show the extent of the beam and the braces show which notes are to have their durations modified. Normally these would delimit the same group of notes, but this is not required: the two commands are independent.
In the following example the eight 16th notes occupy exactly the same time as a half note, but the first note is one half as long as the last one, with the intermediate notes gradually lengthening. The first four 32nd notes gradually speed up, while the last four 32nd notes are at a constant tempo.
\relative c' { \override Beam.grow-direction = #LEFT \featherDurations #(ly:make-moment 2/1) { c16[ c c c c c c c] } \override Beam.grow-direction = #RIGHT \featherDurations #(ly:make-moment 2/3) { c32[ d e f] } % revert to non-feathered beams \override Beam.grow-direction = #'() { g32[ a b c] } }
The spacing in the printed output represents the note durations only approximately, but the MIDI output is exact.
Predefined commands
\featherDurations
.
See also
Snippets: Rhythms.
Known issues and warnings
The \featherDurations
command only works with very short
music snippets, and when numbers in the fraction are small.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Feathered beams ] | [ Up : Rhythms ] | [ Bar lines > ] |
1.2.5 Bars
Bar lines | ||
Bar numbers | ||
Bar and bar number checks | ||
Rehearsal marks |
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Bars ] | [ Up : Bars ] | [ Bar numbers > ] |
Bar lines
Bar lines delimit measures, and are also used to indicate repeats. Normally, simple bar lines are automatically inserted into the printed output at places based on the current time signature.
The simple bar lines inserted automatically can be changed to
other types with the \bar
command. For example, a closing
double bar line is usually placed at the end of a piece:
\relative { e'4 d c2 \bar "|." }
It is not invalid if the final note in a measure does not end on the automatically entered bar line: the note is assumed to carry over into the next measure. But if a long sequence of such carry-over measures appears the music can appear compressed or even flowing off the page. This is because automatic line breaks happen only at the end of complete measures, i.e., where all notes end before the end of a measure.
Note: An incorrect duration can cause line breaks to be inhibited, leading to a line of highly compressed music or music that flows off the page.
Line breaks are also permitted at manually inserted bar lines even within incomplete measures. To allow a line break without printing a bar line, use the following:
\bar ""
This will insert an invisible bar line and allow (but not force) a line break to occur at this point. The bar number counter is not increased. To force a line break see Line breaking.
This and other special bar lines may be inserted manually at any point. When they coincide with the end of a measure they replace the simple bar line which would have been inserted there automatically. When they do not coincide with the end of a measure the specified bar line is inserted at that point in the printed output.
Note that manual bar lines are purely visual. They do not affect any of the properties that a normal bar line would affect, such as measure numbers, accidentals, line breaks, etc. They do not affect the calculation and placement of subsequent automatic bar lines. When a manual bar line is placed where a normal bar line already exists, the effects of the original bar line are not altered.
Two types of simple bar lines and five types of double bar lines are available for manual insertion:
\relative { f'1 \bar "|" f1 \bar "." g1 \bar "||" a1 \bar ".|" b1 \bar ".." c1 \bar "|.|" d1 \bar "|." e1 }
together with dotted and dashed bar lines:
\relative { f'1 \bar ";" g1 \bar "!" a1 }
and nine types of repeat bar lines:
\relative { f'1 \bar ".|:" g1 \bar ":..:" a1 \bar ":|.|:" b1 \bar ":|.:" c1 \bar ":.|.:" d1 \bar "[|:" e1 \bar ":|][|:" f1 \bar ":|]" g1 \bar ":|." a1 }
Additionally, a bar line can be printed as a simple tick:
f'1 \bar "'" g'1
However, as such ticks are typically used in Gregorian chant, it is
preferable to use \divisioMinima
there instead, described in
the section Divisiones in Gregorian chant.
LilyPond supports kievan notation and provides a special kievan bar line:
f'1 \bar "k"
Further details of this notation are explained in Typesetting Kievan square notation.
For in-line segno signs, there are three types of bar lines which differ in their behavior at line breaks:
\relative c'' { c4 c c c \bar "S-||" c4 c c c \break \bar "S-||" c4 c c c \bar "S" c4 c c c \break \bar "S" c4 c c c \bar "S-S" c4 c c c \break \bar "S-S" c1 }
Although the bar line types signifying repeats may be inserted manually they do not in themselves cause LilyPond to recognize a repeated section. Such repeated sections are better entered using the various repeat commands (see Repeats), which automatically print the appropriate bar lines.
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.
\relative c'' { c4 c c c \bar ".|:-||" c4 c c c \break \bar ".|:-||" c4 c c c }
For combinations of repeats with the segno sign, there are six different variations:
\relative c'' { c4 c c c \bar ":|.S" c4 c c c \break \bar ":|.S" c4 c c c \bar ":|.S-S" c4 c c c \break \bar ":|.S-S" c4 c c c \bar "S.|:-S" c4 c c c \break \bar "S.|:-S" c4 c c c \bar "S.|:" c4 c c c \break \bar "S.|:" c4 c c c \bar ":|.S.|:" c4 c c c \break \bar ":|.S.|:" c4 c c c \bar ":|.S.|:-S" c4 c c c \break \bar ":|.S.|:-S" c1 }
Additionally there is an \inStaffSegno
command which creates
a segno bar line in conjunction with an appropriate repeat bar line
when used with a \repeat volta
command, see
In-staff segno.
New bar line types can be defined with \defineBarLine
:
\defineBarLine bartype #'(end begin span)
In addition to bartype (the character string that will then be used to refer to that new bar line), it takes three values: the first two determine the bar line’s appearance when it occurs at a line break, in which case the first and second given glyphs are printed respectively at the end of the system and at the beginning of the next one. The third given glyph is only relevant in multi-staff systems (see Grouping staves), where it is used as span bar, printed between staves.
The \defineBarLine
variables can include the
‘empty’ string ""
, which is equivalent to an invisible
bar line being printed. Or they can be set to #f
which
prints no bar line at all.
After the definiton, the new bar line can be used by
\bar
bartype.
There are currently ten bar line elements available:
\defineBarLine ":" #'("" ":" "") \defineBarLine "=" #'("=" "" "") \defineBarLine "[" #'("" "[" "") \defineBarLine "]" #'("]" "" "") \new Staff { s1 \bar "|" s1 \bar "." s1 \bar "!" s1 \bar ";" s1 \bar ":" s1 \bar "k" s1 \bar "S" s1 \bar "=" s1 \bar "[" s1 \bar "]" s1 \bar "" }
The "="
bar line provides the double span bar line, used
in combination with the segno sign. Using it as a standalone
double thin bar line is not recommended; in most cases,
\bar
"||" is preferred.
The "-"
sign starts annotations to bar lines which
are useful to distinguish those with identical appearance
but different behavior at line breaks and/or different span bars.
The part following the "-"
sign is not used for building up
the bar line.
\defineBarLine "||-dashedSpan" #'("||" "" "!!") \new StaffGroup << \new Staff \relative c'' { c1 \bar "||" c1 \bar "||-dashedSpan" c1 } \new Staff \relative c'' { c1 c1 c1 } >>
Furthermore, the space character " "
serves as a placeholder
for defining span bars correctly aligned to the main bar lines:
\defineBarLine ":|.-wrong" #'(":|." "" "|.") \defineBarLine ":|.-right" #'(":|." "" " |.") \new StaffGroup << \new Staff \relative c'' { c1 \bar ":|.-wrong" c1 \bar ":|.-right" c1 } \new Staff \relative c'' { c1 c1 c1 } >>
New bar line types defined using \defineBarLine
may even,
in turn, be used in a second bar line definition. Such
‘nested’ definitions make it possible to use customized glyphs
in places where it would not be otherwise possible, such as
system ends:
\defineBarLine "||-dashEverywhere" #'("!!" "!!" "!!") \defineBarLine "||-advancedDashSpan" #'("||-dashEverywhere" "" "!!") \new StaffGroup << \new Staff \relative c'' { c1 \bar "||" c1 \bar "||-advancedDashSpan" c1 \bar "||-advancedDashSpan" } \new Staff \relative c'' { c1 c1 c1 } >>
If additional elements are needed, LilyPond provides a simple way to define them. For more information on modifying or adding bar lines, see file ‘scm/bar-line.scm’.
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 GrandStaff
.
<< \new StaffGroup << \new Staff \relative { e'4 d \bar "||" f4 e } \new Staff \relative { \clef bass c'4 g e g } >> \new Staff \relative { \clef bass c'2 c2 } >>
The command ‘\bar bartype’ is a shortcut for
‘\set Timing.whichBar = bartype’. A bar line is
created whenever the whichBar
property is set.
The default bar type used for automatically inserted bar lines is
"|"
. This may be changed at any time with
‘\set Timing.defaultBarType = bartype’.
See also
Notation Reference: Line breaking, Repeats, Grouping staves.
Installed Files: ‘scm/bar-line.scm’.
Snippets: Rhythms.
Internals Reference:
BarLine (created at Staff
level),
SpanBar (across staves),
Timing_translator (for Timing properties).
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Bar lines ] | [ Up : Bars ] | [ Bar and bar number checks > ] |
Bar numbers
Bar numbers are typeset by default at the start of every line except
the first line. The number itself is stored in the
currentBarNumber
property, which is normally updated
automatically for every measure. It may also be set manually:
\relative c' { c1 c c c \break \set Score.currentBarNumber = #50 c1 c c c }
Bar numbers can be typeset at regular intervals instead of just at the
beginning of every line. To do this the default behavior must be
overridden to permit bar numbers to be printed at places other than the
start of a line. This is controlled by the break-visibility
property of BarNumber
. This takes three values which may be set
to #t
or #f
to specify whether the corresponding bar
number is visible or not. The order of the three values is
end of line visible
, middle of line visible
,
beginning of line visible
. In the following example bar numbers
are printed at all possible places:
\relative c' { \override Score.BarNumber.break-visibility = ##(#t #t #t) \set Score.currentBarNumber = #11 % Permit first bar number to be printed \bar "" c1 | c | c | c | \break c1 | c | c | c | }
Selected Snippets
Printing the bar number for the first measure
By default, the first bar number in a score is suppressed if it is less
than or equal to ‘1’. By setting barNumberVisibility
to
all-bar-numbers-visible
, any bar number can be printed for the
first measure and all subsequent measures. Note that an empty bar line
must be inserted before the first note for this to work.
\layout { indent = 0 ragged-right = ##t } \relative c' { \set Score.barNumberVisibility = #all-bar-numbers-visible \bar "" c1 | d | e | f \break g1 | e | d | c }
Printing bar numbers at regular intervals
By setting the barNumberVisibility
property, bar numbers can be
printed at regular intervals. Here the bar numbers are printed every
two measures except at the end of the line.
\relative c' { \override Score.BarNumber.break-visibility = #end-of-line-invisible \set Score.currentBarNumber = #11 % Permit first bar number to be printed \bar "" % Print a bar number every second measure \set Score.barNumberVisibility = #(every-nth-bar-number-visible 2) c1 | c | c | c | c \break c1 | c | c | c | c }
Printing bar numbers with changing regular intervals
Using the set-bar-number-visibility
context function, bar number
intervals can be changed.
\relative c' { \override Score.BarNumber.break-visibility = #end-of-line-invisible \context Score \applyContext #(set-bar-number-visibility 4) \repeat unfold 10 c'1 \context Score \applyContext #(set-bar-number-visibility 2) \repeat unfold 10 c }
Printing bar numbers for broken measures
Per default a BarNumber
of a broken measure is not repeated at the
beginning of the new line. To get a parenthesized BarNumber
there,
use first-bar-number-invisible-save-broken-bars
for barNumberVisibility
.
\layout { \context { \Score barNumberVisibility = #first-bar-number-invisible-save-broken-bars \override BarNumber.break-visibility = ##(#f #t #t) } } \relative c' { c1 | d | e | f2 \bar "" \break fis | g1 | e2 \bar "" \break <>^"reenabled default" %% back to default, \unset Score.barNumberVisibility would do so as well. \set Score.barNumberVisibility = #first-bar-number-invisible-and-no-parenthesized-bar-numbers es | d1 | c }
Printing bar numbers using modulo-bar-number-visible
If the remainder of the division of the current BarNumber
by the
first argument of modulo-bar-number-visible
equals its second
argument print the BarNumber
.
Useful to print the BarNumber
at certain distances, p.e:
-
(modulo-bar-number-visible 3 2)
-> prints 2,5,8 -
(modulo-bar-number-visible 4 2)
-> prints 2,6,10 -
(modulo-bar-number-visible 3 1)
-> prints 3,5,7 -
(modulo-bar-number-visible 5 2)
-> prints 2,7,12
\layout { \context { \Score \override BarNumber.break-visibility = ##(#f #t #t) barNumberVisibility = #(modulo-bar-number-visible 3 2) } } \relative c' { \bar "" c1 | d | e | f \break g1 | e | d | c }
Printing bar numbers inside boxes or circles
Bar numbers can also be printed inside boxes or circles.
\relative c' { % Prevent bar numbers at the end of a line and permit them elsewhere \override Score.BarNumber.break-visibility = #end-of-line-invisible \set Score.barNumberVisibility = #(every-nth-bar-number-visible 4) % Increase the size of the bar number by 2 \override Score.BarNumber.font-size = #2 % Draw a box round the following bar number(s) \override Score.BarNumber.stencil = #(make-stencil-boxer 0.1 0.25 ly:text-interface::print) \repeat unfold 5 { c1 } % Draw a circle round the following bar number(s) \override Score.BarNumber.stencil = #(make-stencil-circler 0.1 0.25 ly:text-interface::print) \repeat unfold 4 { c1 } \bar "|." }
Alternative bar numbering
Two alternative methods for bar numbering can be set, especially for when using repeated music.
\relative c'{ \set Score.alternativeNumberingStyle = #'numbers \repeat volta 3 { c4 d e f | } \alternative { { c4 d e f | c2 d \break } { f4 g a b | f4 g a b | f2 a | \break } { c4 d e f | c2 d } } c1 \break \set Score.alternativeNumberingStyle = #'numbers-with-letters \repeat volta 3 { c,4 d e f | } \alternative { { c4 d e f | c2 d \break } { f4 g a b | f4 g a b | f2 a | \break } { c4 d e f | c2 d } } c1 }
Aligning bar numbers
Bar numbers by default are right-aligned to their parent object. This is usually the left edge of a line or, if numbers are printed within a line, the left hand side of a bar line. The numbers may also be positioned directly over the bar line or left-aligned to the bar line.
\relative c' { \set Score.currentBarNumber = #111 \override Score.BarNumber.break-visibility = #all-visible % Increase the size of the bar number by 2 \override Score.BarNumber.font-size = #2 % Print a bar number every second measure \set Score.barNumberVisibility = #(every-nth-bar-number-visible 2) c1 | c1 % Center-align bar numbers \override Score.BarNumber.self-alignment-X = #CENTER c1 | c1 % Left-align bar numbers \override Score.BarNumber.self-alignment-X = #LEFT c1 | c1 }
Removing bar numbers from a score
Bar numbers can be removed entirely by removing the
Bar_number_engraver
from the Score
context.
\layout { \context { \Score \omit BarNumber % or: %\remove "Bar_number_engraver" } } \relative c'' { c4 c c c \break c4 c c c }
See also
Snippets: Rhythms.
Internals Reference: BarNumber, Bar_number_engraver.
Known issues and warnings
Bar numbers may collide with the top of the StaffGroup
bracket,
if there is one. To solve this, the padding
property of
BarNumber
can be used to position the number correctly. See
StaffGroup and
BarNumber for more.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Bar numbers ] | [ Up : Bars ] | [ Rehearsal marks > ] |
Bar and bar number checks
Bar checks help detect errors in the entered durations. A bar check
may be entered using the bar symbol, |
, at any place where a
bar line is expected to fall. If bar check lines are encountered at
other places, a list of warnings is printed in the log file, showing
the line numbers and lines in which the bar checks failed. In the
next example, the second bar check will signal an error.
\time 3/4 c2 e4 | g2 |
An incorrect duration can result in a completely garbled score, especially if the score is polyphonic, so a good place to start correcting input is by scanning for failed bar checks and incorrect durations.
If successive bar checks are off by the same musical interval, only the first warning message is displayed. This allows the warning to focus on the source of the timing error.
Bar checks can also be inserted in lyrics:
\lyricmode { \time 2/4 Twin -- kle | Twin -- kle | }
Note that bar check marks in lyrics are evaluated at the musical moment when the syllable following the check mark is processed. If the lyrics are associated with the notes of a voice which has a rest at the beginning of a bar, then no syllable can be located at the start of that bar and a warning will be issued if a bar check mark is placed in the lyrics at that position.
It is also possible to redefine the action taken when a bar check
or pipe symbol, |
, is encountered in the input, so that
it does something other than a bar check. This is done by
assigning a music expression to "|"
.
In the following example |
is set to insert a double bar
line wherever it appears in the input, rather than checking
for end of bar.
"|" = \bar "||" { c'2 c' | c'2 c' c'2 | c' c'2 c' }
When copying large pieces of music, it can be helpful to check that
the LilyPond bar number corresponds to the original that you are
entering from. This can be checked with \barNumberCheck
, for
example,
\barNumberCheck #123
will print a warning if the currentBarNumber
is not 123
when it is processed.
See also
Snippets: Rhythms.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Bar and bar number checks ] | [ Up : Bars ] | [ Special rhythmic concerns > ] |
Rehearsal marks
To print a rehearsal mark, use the \mark
command.
\relative c'' { c1 \mark \default c1 \mark \default c1 \mark \default c1 \mark \default }
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
.
\relative c'' { c1 \mark \default c1 \mark \default c1 \mark #8 c1 \mark \default c1 \mark \default }
The letter ‘I’ is skipped in accordance with engraving traditions. If you wish to include the letter ‘I’, then use one of the following commands, depending on which style of rehearsal mark you want (letters only, letters in a hollow box, or letters in a hollow circle).
\set Score.markFormatter = #format-mark-alphabet \set Score.markFormatter = #format-mark-box-alphabet \set Score.markFormatter = #format-mark-circle-alphabet
\relative c'' { \set Score.markFormatter = #format-mark-box-alphabet c1 \mark \default c1 \mark \default c1 \mark #8 c1 \mark \default c1 \mark \default }
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 pre-defined
procedure. After a few measures, it is set to a procedure that
produces a boxed number.
\relative c'' { \set Score.markFormatter = #format-mark-numbers c1 \mark \default c1 \mark \default \set Score.markFormatter = #format-mark-box-numbers c1 \mark \default \set Score.markFormatter = #format-mark-circle-numbers c1 \mark \default \set Score.markFormatter = #format-mark-circle-letters c1 }
The file ‘scm/translation-functions.scm’ contains the
definitions of format-mark-letters
(the default format),
format-mark-box-letters
, format-mark-numbers
, and
format-mark-box-numbers
. These can be used as inspiration
for other formatting functions.
You may use format-mark-barnumbers
,
format-mark-box-barnumbers
, and
format-mark-circle-barnumbers
to get bar numbers instead of
incremented numbers or letters.
Other styles of rehearsal mark can be specified manually:
\mark "A1"
Note that Score.markFormatter
does not affect marks specified
in this manner. However, it is possible to apply a \markup
to the
string.
\mark \markup { \box A1 }
Music glyphs (such as the segno sign) may be printed inside a
\mark
\relative c' { c1 \mark \markup { \musicglyph "scripts.segno" } c1 \mark \markup { \musicglyph "scripts.coda" } c1 \mark \markup { \musicglyph "scripts.ufermata" } c1 }
See The Emmentaler font, for a list of symbols which may be
printed with \musicglyph
.
For common tweaks to the positioning of rehearsal marks, see
Formatting text. For more precise control, see
break-alignable-interface
in Aligning objects.
The file ‘scm/translation-functions.scm’ contains
the definitions of format-mark-numbers
and
format-mark-letters
. They can be used as inspiration for
other formatting functions.
See also
Notation Reference: The Emmentaler font, Formatting text, Aligning objects.
Installed Files: ‘scm/translation-functions.scm’.
Snippets: Rhythms.
Internals Reference: MarkEvent, Mark_engraver, RehearsalMark.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Rehearsal marks ] | [ Up : Rhythms ] | [ Grace notes > ] |
1.2.6 Special rhythmic concerns
Grace notes | ||
Aligning to cadenzas | ||
Time administration |
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Special rhythmic concerns ] | [ Up : Special rhythmic concerns ] | [ Aligning to cadenzas > ] |
Grace notes
Grace notes are musical ornaments, printed in a smaller font, that take up no additional logical time in a measure.
\relative { c''4 \grace b16 a4( \grace { b16 c16 } a2) }
There are three other types of grace notes possible; the
acciaccatura – an unmeasured grace note indicated by a slurred
note with a slashed stem – and the appoggiatura, which takes a
fixed fraction of the main note it is attached to and prints without the
slash. It is also possible to write a grace note with a slashed stem,
like the acciaccatura but without the slur, so as to place it
between notes that are slurred themselves, using the
\slashedGrace
function.
\relative { \acciaccatura d''8 c4 \appoggiatura e8 d4 \acciaccatura { g16 f } e2 \slashedGrace a,8 g4 \slashedGrace b16 a4( \slashedGrace b8 a2) }
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 \relative { e''2 \grace { c16 d e f } e2 } \new Staff \relative { c''2 \grace { g8 b } c2 } >>
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.
\relative { c''1 \afterGrace d1 { c16[ d] } c1 }
This will place the grace notes after the start of the main note. The point of time where the grace notes are placed is a given fraction of the main note’s duration. The default setting of
afterGraceFraction = 3/4
may be redefined at top level. Individual \afterGrace
commands may have the fraction specified right after the command
itself instead.
The following example shows the results from setting with the
default space, setting it at 15/16
, and finally at
1/2
of the main note.
<< \new Staff \relative { c''1 \afterGrace d1 { c16[ d] } c1 } \new Staff \relative { c''1 \afterGrace 15/16 d1 { c16[ d] } c1 } \new Staff \relative { c''1 \afterGrace 1/2 d1 { c16[ d] } c1 } >>
The effect of \afterGrace
can also be achieved using
spacers. The following example places the grace note after a
space lasting 7/8 of the main note.
\new Voice \relative { << { d''1^\trill_( } { s2 s4. \grace { c16 d } } >> c1) }
A \grace
music expression will introduce special
typesetting settings, for example, to produce smaller type, and
set directions. Hence, when introducing layout tweaks to
override the special settings, they should be placed inside
the grace expression. The overrides should also be reverted
inside the grace expression. Here, the grace note’s default stem
direction is overridden and then reverted.
\new Voice \relative { \acciaccatura { \stemDown f''16-> \stemNeutral } g4 e c2 }
Selected Snippets
Using grace note slashes with normal heads
The slash through the stem found in acciaccaturas can be applied in other situations.
\relative c'' { \override Flag.stroke-style = #"grace" c8( d2) e8( f4) }
Tweaking grace layout within music
The layout of grace expressions can be changed throughout the music
using the functions add-grace-property
and
remove-grace-property
.
The following example undefines the Stem
direction for this
grace, so that stems do not always point up, and changes the default
note heads to crosses.
\relative c'' { \new Staff { $(remove-grace-property 'Voice 'Stem 'direction) $(add-grace-property 'Voice 'NoteHead 'style 'cross) \new Voice { \acciaccatura { f16 } g4 \grace { d16 e } f4 \appoggiatura { f,32 g a } e2 } } }
Redefining grace note global defaults
The global defaults for grace notes are stored in the following identifiers.
startGraceMusic stopGraceMusic startAcciaccaturaMusic stopAcciaccaturaMusic startAppoggiaturaMusic stopAppoggiaturaMusic
They are defined in file ly/grace-init.ly
. By redefining them
other effects may be obtained.
startAcciaccaturaMusic = { <>( \override Flag.stroke-style = #"grace" \slurDashed } stopAcciaccaturaMusic = { \revert Flag.stroke-style \slurSolid <>) } \relative c'' { \acciaccatura d8 c1 }
Positioning grace notes with floating space
Setting the property 'strict-grace-spacing
makes the musical
columns for grace notes ’floating’, i.e., decoupled from the non-grace
notes: first the normal notes are spaced, then the (musical columns of
the) graces are put left of the musical columns for the main notes.
\relative c'' { << \override Score.SpacingSpanner.strict-grace-spacing = ##t \new Staff \new Voice { \afterGrace c4 { c16[ c8 c16] } c8[ \grace { b16 d } c8] c4 r } \new Staff { c16 c c c c c c c c4 r } >> }
See also
Music Glossary: grace notes, acciaccatura, appoggiatura.
Notation Reference: Scaling durations, Manual beams.
Installed Files: ‘ly/grace-init.ly’.
Snippets: Rhythms.
Internals Reference: GraceMusic, Grace_beam_engraver, Grace_auto_beam_engraver, Grace_engraver, Grace_spacing_engraver.
Known issues and warnings
A multi-note beamed acciaccatura is printed without a slash, and looks exactly the same as a multi-note beamed appoggiatura.
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 \relative { e''4 \bar ".|:" \grace c16 d2. } \new Staff \relative { c''4 \bar ".|:" d2. } >>
This can be remedied by inserting grace skips of the corresponding durations in the other staves. For the above example
<< \new Staff \relative { e''4 \bar ".|:" \grace c16 d2. } \new Staff \relative { c''4 \bar ".|:" \grace s16 d2. } >>
Please make sure that you use the \grace
command for the
spacer part, even if the visual part uses \acciaccatura
or
\appoggiatura
because otherwise an ugly slur fragment will
be printed, connecting the invisible grace note with the following
note.
Grace sections should only be used within sequential music expressions. Nesting or juxtaposing grace sections is not supported, and might produce crashes or other errors.
Each grace note in MIDI output has a length of 1/4 of its actual
duration. If the combined length of the grace notes is greater than the
length of the preceding note a “Going back in MIDI time
”
error will be generated. Either make the grace notes shorter in
duration, for example:
c'8 \acciaccatura { c'8[ d' e' f' g'] }
becomes:
c'8 \acciaccatura { c'16[ d' e' f' g'] }
Or explicitly change the musical duration:
c'8 \acciaccatura { \scaleDurations 1/2 { c'8[ d' e' f' g'] } }
See Scaling durations.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Grace notes ] | [ Up : Special rhythmic concerns ] | [ Time administration > ] |
Aligning to cadenzas
In an orchestral context, cadenzas present a special problem: when constructing a score that includes a measured cadenza or other solo passage, all other instruments should skip just as many notes as the length of the cadenza, otherwise they will start too soon or too late.
One solution to this problem is to use the functions
mmrest-of-length
and skip-of-length
. These Scheme
functions take a defined piece of music as an argument and generate a
multi-measure rest or \skip
exactly as long as the piece.
MyCadenza = \relative { c'4 d8 e f g g4 f2 g4 g } \new GrandStaff << \new Staff { \MyCadenza c'1 \MyCadenza c'1 } \new Staff { #(mmrest-of-length MyCadenza) c'1 #(skip-of-length MyCadenza) c'1 } >>
See also
Music Glossary: cadenza.
Snippets: Rhythms.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Aligning to cadenzas ] | [ Up : Special rhythmic concerns ] | [ Expressive marks > ] |
Time administration
Time is administered by the Timing_translator
, which by
default is to be found in the Score
context. An alias,
Timing
, is added to the context in which the
Timing_translator
is placed. To ensure that the
Timing
alias is available, you may need to explicitly
instantiate the containing context (such as Voice
or
Staff
).
The following properties of Timing
are used
to keep track of timing within the score.
-
currentBarNumber
The current measure number. For an example showing the use of this property see Bar numbers.
-
measureLength
The length of the measures in the current time signature. For a 4/4 time this is 1, and for 6/8 it is 3/4. Its value determines when bar lines are inserted and how automatic beams should be generated.
-
measurePosition
The point within the measure where we currently are. This quantity is reset by subtracting
measureLength
whenevermeasureLength
is reached or exceeded. When that happens,currentBarNumber
is incremented.-
timing
If set to true, the above variables are updated for every time step. When set to false, the engraver stays in the current measure indefinitely.
Timing can be changed by setting any of these variables
explicitly. In the next example, the default 4/4 time
signature is printed, but measureLength
is set to 5/4.
At 4/8 through the third measure, the measurePosition
is
advanced by 1/8 to 5/8, shortening that bar by 1/8.
The next bar line then falls at 9/8 rather than 5/4.
\new Voice \relative { \set Timing.measureLength = #(ly:make-moment 5/4) c'1 c4 | c1 c4 | c4 c \set Timing.measurePosition = #(ly:make-moment 5/8) b4 b b8 | c4 c1 | }
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.
See also
Notation Reference: Bar numbers, Unmetered music.
Snippets: Rhythms.
Internals Reference: Timing_translator, Score.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Time administration ] | [ Up : Musical notation ] | [ Expressive marks attached to notes > ] |
1.3 Expressive marks
This section lists various expressive marks that can be created in a score.
1.3.1 Expressive marks attached to notes | ||
1.3.2 Expressive marks as curves | ||
1.3.3 Expressive marks as lines |
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Expressive marks ] | [ Up : Expressive marks ] | [ Articulations and ornamentations > ] |
1.3.1 Expressive marks attached to notes
This section explains how to create expressive marks that are attached to notes: articulations, ornamentations, and dynamics. Methods to create new dynamic markings are also discussed.
Articulations and ornamentations | ||
Dynamics | ||
New dynamic marks |
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Expressive marks attached to notes ] | [ Up : Expressive marks attached to notes ] | [ Dynamics > ] |
Articulations and ornamentations
A variety of symbols that denote articulations, ornamentations, and other performance indications can be attached to a note using this syntax:
note\name
The possible values for name
are listed in
List of articulations. For example:
\relative { c''4\staccato c\mordent b2\turn c1\fermata }
Some of these articulations have shorthands for easier entry.
Shorthands are appended to the note name, and their syntax
consists of a dash -
followed by a symbol signifying the
articulation. Predefined shorthands exist for marcato,
stopped, tenuto, staccatissimo,
accent, staccato, and portato.
Their corresponding output appears as follows:
\relative { c''4-^ c-+ c-- c-! c4-> c-. c2-_ }
The rules for the default placement of articulations are defined in ‘scm/script.scm’. Articulations and ornamentations may be manually placed above or below the staff; see Direction and placement.
Articulations are Script
objects. Their properties are
described more fully in
Script.
Articulations can be attached to rests and multi-measure rests as
well as notes. Attaching an articulation to a multi-measure rest
creates a MultiMeasureRestScript
object.
\override Script.color = #red \override MultiMeasureRestScript.color = #blue a'2\fermata r\fermata R1\fermata
In addition to articulations, text and markups can be attached to notes. See Text scripts.
For more information about the ordering of Scripts and TextScripts that are attached to the notes, see Placement of objects.
Selected Snippets
Modifying default values for articulation shorthand notation
The shorthands are defined in ‘ly/script-init.ly’, where the
variables dashHat
, dashPlus
, dashDash
,
dashBang
, dashLarger
, dashDot
, and
dashUnderscore
are assigned default values. The default values
for the shorthands can be modified. For example, to associate the
-+
(dashPlus
) shorthand with the trill symbol
instead of the default + symbol, assign the value trill
to the variable dashPlus
:
\relative c'' { c1-+ } dashPlus = "trill" \relative c'' { c1-+ }
Controlling the vertical ordering of scripts
The vertical ordering of scripts is controlled with the
'script-priority
property. The lower this number, the closer it
will be put to the note. In this example, the TextScript
(the
sharp symbol) first has the lowest priority, so it is put lowest
in the first example. In the second, the prall trill (the
Script
) has the lowest, so it is on the inside. When two objects
have the same priority, the order in which they are entered determines
which one comes first.
\relative c''' { \once \override TextScript.script-priority = #-100 a2^\prall^\markup { \sharp } \once \override Script.script-priority = #-100 a2^\prall^\markup { \sharp } }
Creating a delayed turn
Creating a delayed turn, where the lower note of the turn uses the
accidental, requires several overrides. The
outside-staff-priority
property must be set to #f
, as
otherwise this would take precedence over the
avoid-slur property
. Changing the fractions 2/3
and
1/3
adjusts the horizontal position.
\relative c'' { c2*2/3 ( s2*1/3\turn d4) r << { c4.( d8) } { s4 s\turn } >> \transpose c d \relative c'' << { c4.( d8) } { s4 \once \set suggestAccidentals = ##t \once \override AccidentalSuggestion.outside-staff-priority = ##f \once \override AccidentalSuggestion.avoid-slur = #'inside \once \override AccidentalSuggestion.font-size = -3 \once \override AccidentalSuggestion.script-priority = -1 \single \hideNotes b8-\turn \noBeam s8 } >> }
See also
Music Glossary: tenuto, accent, staccato, portato.
Learning Manual: Placement of objects.
Notation Reference: Text scripts, Direction and placement, List of articulations, Trills.
Installed Files: ‘scm/script.scm’.
Snippets: Expressive marks.
Internals Reference: Script, TextScript.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Articulations and ornamentations ] | [ Up : Expressive marks attached to notes ] | [ New dynamic marks > ] |
Dynamics
Absolute dynamic marks are specified using a command after a note,
such as c4\ff
. The available dynamic marks are
\ppppp
, \pppp
, \ppp
, \pp
, \p
,
\mp
, \mf
, \f
, \ff
, \fff
,
\ffff
, \fffff
, \fp
, \sf
, \sff
,
\sp
, \spp
, \sfz
, \rfz
, and \n
.
Dynamic marks may be manually placed above or below the staff; see
Direction and placement.
\relative c'' { c2\ppp c\mp c2\rfz c^\mf c2_\spp c^\ff }
A crescendo mark is started with \<
and
terminated with \!
, an absolute dynamic, or an additional
crescendo or decrescendo mark. A decrescendo mark is
started with \>
and is also terminated with \!
, an
absolute dynamic, or another crescendo or decrescendo mark.
\cr
and \decr
may be used instead of \<
and
\>
; \endcr
and \enddecr
maybe used instead of
\!
to end a crescendo or decrescendo mark, respectively.
Hairpins are engraved by default using this notation.
\relative c'' { c2\< c\! d2\< d\f e2\< e\> f2\> f\! e2\> e\mp d2\> d\> c1\! }
A hairpin that is terminated with \!
will end at the
right edge of the note that has the \!
assigned to it. In the
case where it is terminated with the start of another crescendo
or decrescendo mark, it will end at the centre of the note
that has the next \<
or \>
assigned to it. The next
hairpin will then start at the right edge of the same note
instead of the usual left edge had it been terminated with \!
before. A hairpin ending on a downbeat will stop at the preceding bar line.
\relative { c''1\< | c4 a c\< a | c4 a c\! a\< | c4 a c a\! }
Hairpins that are terminated with absolute dynamic marks instead of
\!
will also be engraved in a similar way. However, the length
of the absolute dynamic itself can alter where the preceding hairpin
ends.
\relative { c''1\< | c4 a c\mf a | c1\< | c4 a c\ffff a }
Spacer rests are needed to engrave multiple marks on one note. This is particularly useful when adding a crescendo and decrescendo to the same note:
\relative { c''4\< c\! d\> e\! << f1 { s4 s4\< s4\> s4\! } >> }
The \espressivo
command can be used to indicate a crescendo
and decrescendo on the same note. However, be warned that this is
implemented as an articulation, not a dynamic.
\relative { c''2 b4 a g1\espressivo }
Textual crescendo marks begin with \cresc
.
Textual decrescendos begin with \decresc
or \dim
.
Extender lines are engraved as required.
\relative { g'8\cresc a b c b c d e\mf | f8\decresc e d c e\> d c b | a1\dim ~ | a2. r4\! | }
Textual marks for dynamic changes can also replace hairpins:
\relative c'' { \crescTextCresc c4\< d e f\! | \dimTextDecresc g4\> e d c\! | \dimTextDecr e4\> d c b\! | \dimTextDim d4\> c b a\! | \crescHairpin \dimHairpin c4\< d\! e\> d\! | }
To create new absolute dynamic marks or text that should be aligned with dynamics, see New dynamic marks.
Vertical positioning of dynamics is handled by DynamicLineSpanner.
A Dynamics
context is available to engrave dynamics on
their own horizontal line. Use spacer rests to indicate timing.
(Notes in a Dynamics
context will also take up
musical time, but will not be engraved.)
The Dynamics
context can usefully contain some other
items such as text scripts, text spanners, and piano pedal marks.
<< \new Staff \relative { c'2 d4 e | c4 e e,2 | g'4 a g a | c1 | } \new Dynamics { s1\< | s1\f | s2\dim s2-"rit." | s1\p | } >>
Predefined commands
\dynamicUp
,
\dynamicDown
,
\dynamicNeutral
,
\crescTextCresc
,
\dimTextDim
,
\dimTextDecr
,
\dimTextDecresc
,
\crescHairpin
,
\dimHairpin
.
Selected Snippets
Setting hairpin behavior at bar lines
If the note which ends a hairpin falls on a downbeat, the hairpin stops
at the bar line immediately preceding. This behavior can be controlled
by overriding the 'to-barline
property.
\relative c'' { e4\< e2. e1\! \override Hairpin.to-barline = ##f e4\< e2. e1\! }
Setting the minimum length of hairpins
If hairpins are too short, they can be lengthened by modifying the
minimum-length
property of the Hairpin
object.
\relative c'' { c4\< c\! d\> e\! << f1 { s4 s\< s\> s\! } >> \override Hairpin.minimum-length = #5 << f1 { s4 s\< s\> s\! } >> }
Aligning the ends of hairpins to NoteColumn directions
The ends of hairpins may be aligned to the LEFT
, CENTER
or RIGHT
of NoteColumn
grobs by overriding the property
endpoint-alignments
, which is a pair of numbers representing
the left and right ends of the hairpin. endpoint-alignments
are expected to be directions (either -1, 0 or 1). Other values
will be transformed with a warning. The right end of a hairpin
terminating at a rest is not affected, always ending at the left edge
of the rest.
{ c'2\< <c' d'>\! | \override Hairpin.endpoint-alignments = #'(1 . -1) c'2\< <c' d'>\! | \override Hairpin.endpoint-alignments = #`(,LEFT . ,CENTER) c'2\< <c' d'>\! | }
Moving the ends of hairpins
The ends of hairpins may be offset by setting the shorten-pair
property of the Hairpin
object. Positive values move endpoints
to the right, negative to the left. Unlike the minimum-length
property, this property only affects the appearance of the hairpin; it
does not adjust horizontal spacing (including the position of bounding
dynamics). This method is thus suitable for fine-tuning a hairpin
within its allotted space.
{ c'1~\< c'2~ c'\! \once \override Hairpin.shorten-pair = #'(2 . 2) c'1~\< c'2~ c'\! \once \override Hairpin.shorten-pair = #'(-2 . -2) c'1~\< c'2~ c'\! c'1~\p-\tweak shorten-pair #'(2 . 0)\< c'2~ c'\ffff }
Printing hairpins using al niente notation
Hairpin dynamics may be printed with a circled tip (“al niente”
notation) by setting the circled-tip
property of the
Hairpin
object to #t
.
\relative c'' { \override Hairpin.circled-tip = ##t c2\< c\! c4\> c\< c2\! }
Printing hairpins in various styles
Hairpin dynamics may be created in a variety of styles.
\relative c'' { \override Hairpin.stencil = #flared-hairpin a4\< a a a\f a4\p\< a a a\ff a4\sfz\< a a a\! \override Hairpin.stencil = #constante-hairpin a4\< a a a\f a4\p\< a a a\ff a4\sfz\< a a a\! \override Hairpin.stencil = #flared-hairpin a4\> a a a\f a4\p\> a a a\ff a4\sfz\> a a a\! \override Hairpin.stencil = #constante-hairpin a4\> a a a\f a4\p\> a a a\ff a4\sfz\> a a a\! }
Vertically aligned dynamics and textscripts
All DynamicLineSpanner
objects (hairpins and dynamic texts) are
placed with their reference line at least 'staff-padding
from
the staff, unless other notation forces them to be farther. Setting
'staff-padding
to a sufficiently large value aligns the
dynamics.
The same idea, together with \textLengthOn
, is used to align
the text scripts along their baseline.
music = \relative c' { a'2\p b\f e4\p f\f\> g, b\p c2^\markup { \huge gorgeous } c^\markup { \huge fantastic } } { \music \break \override DynamicLineSpanner.staff-padding = #3 \textLengthOn \override TextScript.staff-padding = #1 \music }
Hiding the extender line for text dynamics
Text style dynamic changes (such as cresc. and dim.) are printed with a dashed line showing their extent. This line can be suppressed in the following way:
\relative c'' { \override DynamicTextSpanner.style = #'none \crescTextCresc c1\< | d | b | c\! }
Changing text and spanner styles for text dynamics
The text used for crescendos and decrescendos can be
changed by modifying the context properties crescendoText
and
decrescendoText
.
The style of the spanner line can be changed by modifying the
'style
property of DynamicTextSpanner
. The default value
is 'dashed-line
, and other possible values include 'line
,
'dotted-line
and 'none
.
\relative c'' { \set crescendoText = \markup { \italic { cresc. poco } } \set crescendoSpanner = #'text \override DynamicTextSpanner.style = #'dotted-line a2\< a a2 a a2 a a2 a\mf }
See also
Music Glossary: al niente, crescendo, decrescendo, hairpin.
Learning Manual: Articulations and dynamics.
Notation Reference: Direction and placement, New dynamic marks, Enhancing MIDI output, Controlling MIDI dynamics.
Snippets: Expressive marks.
Internals Reference: DynamicText, Hairpin, DynamicLineSpanner, Dynamics.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Dynamics ] | [ Up : Expressive marks attached to notes ] | [ Expressive marks as curves > ] |
New dynamic marks
The easiest way to create dynamic indications is to use
\markup
objects.
moltoF = \markup { molto \dynamic f } \relative { <d' e>16_\moltoF <d e> <d e>2.. }
In markup mode, editorial dynamics (within parentheses or square brackets) can be created. The syntax for markup mode is described in Formatting text.
roundF = \markup { \center-align \concat { \bold { \italic ( } \dynamic f \bold { \italic ) } } } boxF = \markup { \bracket { \dynamic f } } \relative { c'1_\roundF c1_\boxF }
Simple, centered dynamic marks are easily created with the
make-dynamic-script
function.
sfzp = #(make-dynamic-script "sfzp") \relative { c'4 c c\sfzp c }
In general, make-dynamic-script
takes any markup object as its
argument. The dynamic font only contains the characters
f,m,p,r,s
and z
, so if a dynamic mark that includes
plain text or punctuation symbols is desired, markup commands that
reverts font family and font encoding to normal text should be used,
for example \normal-text
. The interest of using
make-dynamic-script
instead of an ordinary markup is ensuring
the vertical alignment of markup objects and hairpins that are
attached to the same note head.
roundF = \markup { \center-align \concat { \normal-text { \bold { \italic ( } } \dynamic f \normal-text { \bold { \italic ) } } } } boxF = \markup { \bracket { \dynamic f } } mfEspress = \markup { \center-align \line { \hspace #3.7 mf \normal-text \italic espress. } } roundFdynamic = #(make-dynamic-script roundF) boxFdynamic = #(make-dynamic-script boxF) mfEspressDynamic = #(make-dynamic-script mfEspress) \relative { c'4_\roundFdynamic\< d e f g,1~_\boxFdynamic\> g1 g'1~\mfEspressDynamic g1 }
The Scheme form of markup mode may be used instead. Its syntax is explained in Markup construction in Scheme.
moltoF = #(make-dynamic-script (markup #:normal-text "molto" #:dynamic "f")) \relative { <d' e>16 <d e> <d e>2..\moltoF }
To left-align the dynamic text rather than centering it on a note
use a \tweak
:
moltoF = \tweak DynamicText.self-alignment-X #LEFT #(make-dynamic-script (markup #:normal-text "molto" #:dynamic "f")) \relative { <d' e>16 <d e> <d e>2..\moltoF <d e>1 }
Font settings in markup mode are described in Selecting font and font size.
See also
Notation Reference: Formatting text, Selecting font and font size, Enhancing MIDI output, Controlling MIDI dynamics.
Extending LilyPond: Markup construction in Scheme.
Snippets: Expressive marks.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < New dynamic marks ] | [ Up : Expressive marks ] | [ Slurs > ] |
1.3.2 Expressive marks as curves
This section explains how to create various expressive marks that are curved: normal slurs, phrasing slurs, breath marks, falls, and doits.
Slurs | ||
Phrasing slurs | ||
Breath marks | ||
Falls and doits |
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Expressive marks as curves ] | [ Up : Expressive marks as curves ] | [ Phrasing slurs > ] |
Slurs
Slurs are entered using parentheses:
Note: In polyphonic music, a slur must be terminated in the same voice it began.
\relative { f''4( g a) a8 b( a4 g2 f4) <c e>2( <b d>2) }
Slurs may be manually placed above or below the staff; see Direction and placement.
Simultaneous or overlapping slurs require special attention. Most
occurences of outer slurs actually indicate phrasing, and phrasing
slurs may overlap a regular slur, see Phrasing slurs. When
multiple regular slurs are needed in a single Voice
,
matching slur starts and ends need to be labelled by preceding
them with \=
followed by an identifying key (a symbol or
non-negative integer).
\fixed c' { <c~ f\=1( g\=2( >2 <c e\=1) a\=2) > }
Slurs can be solid, dotted, or dashed. Solid is the default slur style:
\relative { c'4( e g2) \slurDashed g4( e c2) \slurDotted c4( e g2) \slurSolid g4( e c2) }
Slurs can also be made half-dashed (the first half dashed, the second half solid) or half-solid (the first half solid, the second half dashed):
\relative { c'4( e g2) \slurHalfDashed g4( e c2) \slurHalfSolid c4( e g2) \slurSolid g4( e c2) }
Custom dash patterns for slurs can be defined:
\relative { c'4( e g2) \slurDashPattern #0.7 #0.75 g4( e c2) \slurDashPattern #0.5 #2.0 c4( e g2) \slurSolid g4( e c2) }
Predefined commands
\slurUp
,
\slurDown
,
\slurNeutral
,
\slurDashed
,
\slurDotted
,
\slurHalfDashed
,
\slurHalfSolid
,
\slurDashPattern
,
\slurSolid
.
Selected Snippets
Using double slurs for legato chords
Some composers write two slurs when they want legato
chords. This can be achieved by setting doubleSlurs
.
\relative c' { \set doubleSlurs = ##t <c e>4( <d f> <c e> <d f>) }
Positioning text markups inside slurs
Text markups need to have the outside-staff-priority
property
set to false in order to be printed inside slurs.
\relative c'' { \override TextScript.avoid-slur = #'inside \override TextScript.outside-staff-priority = ##f c2(^\markup { \halign #-10 \natural } d4.) c8 }
Making slurs with complex dash structure
Slurs can be made with complex dash patterns by defining the
dash-definition
property. dash-definition
is a list of
dash-elements
. A dash-element
is a list of parameters
defining the dash behavior for a segment of the slur.
The slur is defined in terms of the bezier parameter t which ranges
from 0 at the left end of the slur to 1 at the right end of the slur.
dash-element
is a list
(start-t stop-t dash-fraction dash-period)
. The region of the
slur from start-t
to stop-t
will have a fraction
dash-fraction
of each dash-period
black. dash-period
is defined in terms of staff
spaces. dash-fraction
is set to 1 for a solid slur.
\relative c' { \once \override Slur.dash-definition = #'((0 0.3 0.1 0.75) (0.3 0.6 1 1) (0.65 1.0 0.4 0.75)) c4( d e f) \once \override Slur.dash-definition = #'((0 0.25 1 1) (0.3 0.7 0.4 0.75) (0.75 1.0 1 1)) c4( d e f) }
See also
Music Glossary: slur.
Learning Manual: On the un-nestedness of brackets and ties.
Notation Reference: Direction and placement, Phrasing slurs.
Snippets: Expressive marks.
Internals Reference: Slur.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Slurs ] | [ Up : Expressive marks as curves ] | [ Breath marks > ] |
Phrasing slurs
Phrasing slurs (or phrasing marks) that indicate a
musical sentence are written using the commands \(
and
\)
respectively:
\relative { c''4\( d( e) f( e2) d\) }
Typographically, a 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. Phrasing
may be manually placed above or below the staff; see
Direction and placement.
Simultaneous or overlapping phrasing slurs are entered using
\=
as with regular slurs, see Slurs.
Phrasing slurs can be solid, dotted, or dashed. Solid is the default style for phrasing slurs:
\relative { c'4\( e g2\) \phrasingSlurDashed g4\( e c2\) \phrasingSlurDotted c4\( e g2\) \phrasingSlurSolid g4\( e c2\) }
Phrasing slurs can also be made half-dashed (the first half dashed, the second half solid) or half-solid (the first half solid, the second half dashed):
\relative { c'4\( e g2\) \phrasingSlurHalfDashed g4\( e c2\) \phrasingSlurHalfSolid c4\( e g2\) \phrasingSlurSolid g4\( e c2\) }
Custom dash patterns for phrasing slurs can be defined:
\relative { c'4\( e g2\) \phrasingSlurDashPattern #0.7 #0.75 g4\( e c2\) \phrasingSlurDashPattern #0.5 #2.0 c4\( e g2\) \phrasingSlurSolid g4\( e c2\) }
Dash pattern definitions for phrasing slurs have the same structure as dash pattern definitions for slurs. For more information about complex dash patterns, see the snippets under Slurs.
Predefined commands
\phrasingSlurUp
,
\phrasingSlurDown
,
\phrasingSlurNeutral
,
\phrasingSlurDashed
,
\phrasingSlurDotted
,
\phrasingSlurHalfDashed
,
\phrasingSlurHalfSolid
,
\phrasingSlurDashPattern
,
\phrasingSlurSolid
.
See also
Learning Manual: On the un-nestedness of brackets and ties.
Notation Reference: Direction and placement, Slurs.
Snippets: Expressive marks.
Internals Reference: PhrasingSlur.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Phrasing slurs ] | [ Up : Expressive marks as curves ] | [ Falls and doits > ] |
Breath marks
Breath marks are entered using \breathe
:
{ c''2. \breathe d''4 }
Unlike other expressive marks, a breath mark is not associated with
the preceding note but is a separate music event. So all the
expressive marks which are attached to the preceding note, any square
brackets indicating manual beams, and any brackets indicating slurs
and phrasing slurs must be placed before \breathe
.
A breath mark will end an automatic beam; to override this behavior, see Manual beams.
\relative { c''8 \breathe d e f g2 }
Musical indicators for breath marks in ancient notation, divisiones, are supported. For details, see Divisiones.
Selected Snippets
Changing the breath mark symbol
The glyph of the breath mark can be tuned by overriding the text
property of the BreathingSign
layout object with any markup
text.
\relative c'' { c2 \override BreathingSign.text = \markup { \musicglyph "scripts.rvarcomma" } \breathe d2 }
Using a tick as the breath mark symbol
Vocal and wind music frequently uses a tick mark as a breathing sign. This indicates a breath that subtracts a little time from the previous note rather than causing a short pause, which is indicated by the comma breath mark. The mark can be moved up a little to take it away from the stave.
\relative c'' { c2 \breathe d2 \override BreathingSign.Y-offset = #2.6 \override BreathingSign.text = \markup { \musicglyph "scripts.tickmark" } c2 \breathe d2 }
Inserting a caesura
Caesura marks can be created by overriding the 'text
property of
the BreathingSign
object.
A curved caesura mark is also available.
\relative c'' { \override BreathingSign.text = \markup { \musicglyph "scripts.caesura.straight" } c8 e4. \breathe g8. e16 c4 \override BreathingSign.text = \markup { \musicglyph "scripts.caesura.curved" } g8 e'4. \breathe g8. e16 c4 }
See also
Music Glossary: caesura.
Notation Reference: Divisiones.
Snippets: Expressive marks.
Internals Reference: BreathingEvent, BreathingSign, Breathing_sign_engraver.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Breath marks ] | [ Up : Expressive marks as curves ] | [ Expressive marks as lines > ] |
Falls and doits
Falls and doits can be added to notes using
the \bendAfter
command. The direction of the fall or doit
is indicated with a plus or minus (up or down). The number
indicates the pitch interval that the fall or doit will extend
beyond the main note.
\relative c'' { c2\bendAfter #+4 c2\bendAfter #-4 c2\bendAfter #+6.5 c2\bendAfter #-6.5 c2\bendAfter #+8 c2\bendAfter #-8 }
Selected Snippets
Adjusting the shape of falls and doits
The shortest-duration-space
property may be tweaked to adjust
the shape of falls and doits.
\relative c'' { \override Score.SpacingSpanner.shortest-duration-space = #4.0 c2-\bendAfter #5 c2-\bendAfter #-4.75 c2-\bendAfter #8.5 c2-\bendAfter #-6 }
See also
Snippets: Expressive marks.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Falls and doits ] | [ Up : Expressive marks ] | [ Glissando > ] |
1.3.3 Expressive marks as lines
This section explains how to create various expressive marks that follow a linear path: glissandos, arpeggios, and trills.
Glissando | ||
Arpeggio | ||
Trills |
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Expressive marks as lines ] | [ Up : Expressive marks as lines ] | [ Arpeggio > ] |
Glissando
A glissando is created by appending \glissando
to a note:
\relative { g'2\glissando g' c2\glissando c, \afterGrace f,1\glissando f'16 }
A glissando can connect notes across staves:
\new PianoStaff << \new Staff = "right" { e'''2\glissando \change Staff = "left" a,,4\glissando \change Staff = "right" b''8 r | } \new Staff = "left" { \clef bass s1 } >>
A glissando can connect notes in chords. If anything other than a
direct one-to-one pairing of the notes in the two chords is required
the connections between the notes are defined by setting
\glissandoMap
, where the notes of a chord are assumed to be
numbered from zero in the order in which they appear in the input
‘.ly’ file.
\relative { <c' e>1\glissando g' | <c, e>1\glissando | <g' b> | \break \set glissandoMap = #'((0 . 1) (1 . 0)) <c, g'>1\glissando | <d a'> | \set glissandoMap = #'((0 . 0) (0 . 1) (0 . 2)) c1\glissando | <d f a> | \set glissandoMap = #'((2 . 0) (1 . 0) (0 . 1)) <f d a'>1\glissando | <c c'> | }
Different styles of glissandi can be created. For details, see Line styles.
Selected Snippets
Contemporary glissando
A contemporary glissando without a final note can be typeset using a hidden note and cadenza timing.
\relative c'' { \time 3/4 \override Glissando.style = #'zigzag c4 c \cadenzaOn c4\glissando \hideNotes c,,4 \unHideNotes \cadenzaOff \bar "|" }
Adding timing marks to long glissandi
Skipped beats in very long glissandi are sometimes indicated by timing marks, often consisting of stems without noteheads. Such stems can also be used to carry intermediate expression markings.
If the stems do not align well with the glissando, they may need to be repositioned slightly.
glissandoSkipOn = { \override NoteColumn.glissando-skip = ##t \hide NoteHead \override NoteHead.no-ledgers = ##t } glissandoSkipOff = { \revert NoteColumn.glissando-skip \undo \hide NoteHead \revert NoteHead.no-ledgers } \relative c'' { r8 f8\glissando \glissandoSkipOn f4 g a a8\noBeam \glissandoSkipOff a8 r8 f8\glissando \glissandoSkipOn g4 a8 \glissandoSkipOff a8 | r4 f\glissando \< \glissandoSkipOn a4\f \> \glissandoSkipOff b8\! r | }
Making glissandi breakable
Setting the breakable
property to #t
in combination with
after-line-breaking
allows a glissando to break if it occurs at
a line break:
glissandoSkipOn = { \override NoteColumn.glissando-skip = ##t \hide NoteHead \override NoteHead.no-ledgers = ##t } \relative c'' { \override Glissando.breakable = ##t \override Glissando.after-line-breaking = ##t f1\glissando | \break a4 r2. | f1\glissando \once \glissandoSkipOn \break a2 a4 r4 | }
Extending glissandi across repeats
A glissando which extends into several \alternative
blocks can
be simulated by adding a hidden grace note with a glissando at the
start of each \alternative
block. The grace note should be at
the same pitch as the note which starts the initial glissando. This is
implemented here with a music function which takes the pitch of the
grace note as its argument.
Note that in polyphonic music the grace note must be matched with corresponding grace notes in all other voices.
repeatGliss = #(define-music-function (grace) (ly:pitch?) #{ % the next two lines ensure the glissando is long enough % to be visible \once \override Glissando.springs-and-rods = #ly:spanner::set-spacing-rods \once \override Glissando.minimum-length = #3.5 \once \hideNotes \grace $grace \glissando #}) \score { \relative c'' { \repeat volta 3 { c4 d e f\glissando } \alternative { { g2 d } { \repeatGliss f g2 e } { \repeatGliss f e2 d } } } } music = \relative c' { \voiceOne \repeat volta 2 { g a b c\glissando } \alternative { { d1 } { \repeatGliss c \once \omit StringNumber e1\2 } } } \score { \new StaffGroup << \new Staff << \new Voice { \clef "G_8" \music } >> \new TabStaff << \new TabVoice { \clef "moderntab" \music } >> >> }
See also
Music Glossary: glissando.
Notation Reference: Line styles.
Snippets: Expressive marks.
Internals Reference: Glissando.
Known issues and warnings
Printing text over the line (such as gliss.) is not supported.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Glissando ] | [ Up : Expressive marks as lines ] | [ Trills > ] |
Arpeggio
An arpeggio on a chord (also known as a broken chord)
is denoted by appending \arpeggio
to the chord construct:
\relative { <c' e g c>1\arpeggio }
Different types of arpeggios may be written.
\arpeggioNormal
reverts to a normal arpeggio:
\relative { <c' e g c>2\arpeggio \arpeggioArrowUp <c e g c>2\arpeggio \arpeggioArrowDown <c e g c>2\arpeggio \arpeggioNormal <c e g c>2\arpeggio }
These predefined commands internally modify the
'arpeggio-direction
property; see their full
definition in the ‘ly/property-init.ly’ file.
Special bracketed arpeggio symbols can be created:
\relative { <c' e g c>2 \arpeggioBracket <c e g c>2\arpeggio \arpeggioParenthesis <c e g c>2\arpeggio \arpeggioParenthesisDashed <c e g c>2\arpeggio \arpeggioNormal <c e g c>2\arpeggio }
These predefined commands internally override the Arpeggio
object’s 'stencil
property, and may also adapt its
'X-extent
(that is, the horizontal dimension it takes
not to collide with other objects).
The dash properties of the parenthesis arpeggio are controlled
with the 'dash-definition
property, which is described at
Slurs.
Arpeggios can be explicitly written out with ties. For more information, see Ties.
Predefined commands
\arpeggio
,
\arpeggioArrowUp
,
\arpeggioArrowDown
,
\arpeggioNormal
,
\arpeggioBracket
,
\arpeggioParenthesis
,
\arpeggioParenthesisDashed
.
Selected Snippets
Creating cross-staff arpeggios in a piano staff
In a PianoStaff
, it is possible to let an arpeggio cross
between the staves by setting the property
PianoStaff.connectArpeggios
.
\new PianoStaff \relative c'' << \set PianoStaff.connectArpeggios = ##t \new Staff { <c e g c>4\arpeggio <g c e g>4\arpeggio <e g c e>4\arpeggio <c e g c>4\arpeggio } \new Staff { \clef bass \repeat unfold 4 { <c,, e g c>4\arpeggio } } >>
Creating cross-staff arpeggios in other contexts
Cross-staff arpeggios can be created in contexts other than
GrandStaff
, PianoStaff
and StaffGroup
if the
Span_arpeggio_engraver
is included in the Score
context.
\score { \new ChoirStaff { \set Score.connectArpeggios = ##t << \new Voice \relative c' { <c e>2\arpeggio <d f>2\arpeggio <c e>1\arpeggio } \new Voice \relative c { \clef bass <c g'>2\arpeggio <b g'>2\arpeggio <c g'>1\arpeggio } >> } \layout { \context { \Score \consists "Span_arpeggio_engraver" } } }
Creating arpeggios across notes in different voices
An arpeggio can be drawn across notes in different voices on the
same staff if the Span_arpeggio_engraver
is added to the
Staff
context:
\new Staff \with { \consists "Span_arpeggio_engraver" } \relative c' { \set Staff.connectArpeggios = ##t << { <e' g>4\arpeggio <d f> <d f>2 } \\ { <d, f>2\arpeggio <g b>2 } >> }
See also
Music Glossary: arpeggio.
Notation Reference: Slurs, Ties.
Installed Files: ‘ly/property-init.ly’.
Snippets: Expressive marks.
Internals Reference: Arpeggio, Slur, PianoStaff.
Known issues and warnings
Predefined commands such as \arpeggioArrowUp
only
apply to the current context, and thus will not affect
arpeggios spanning several voices or staves. In such cases,
these commands need to be used in a \context
block within
\layout
, or in a \with
block, as explained in
Changing context default settings.
Alternatively, rather than using predefined shortcuts, it may be
advisable to directly override the relevant properties for the
Arpeggio
object in the appropriate context; for example:
\override Staff.Arpeggio.stencil = #ly:arpeggio::brew-chord-bracket
to print cross-voice arpeggio brackets at the Staff
level, or
\override PianoStaff.Arpeggio.arpeggio-direction = #UP
to print cross-staff arrowed arpeggios (pointing upwards) in a
PianoStaff
context.
It is not possible to mix connected arpeggios and unconnected
arpeggios in one PianoStaff
at the same point in
time.
The simple way of setting parenthesis-style arpeggio brackets does not work for cross-staff arpeggios; see Cross-staff stems.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Arpeggio ] | [ Up : Expressive marks as lines ] | [ Repeats > ] |
Trills
Short trills without an extender line are printed with
\trill
; see Articulations and ornamentations.
Longer trills with an extender line are made with
\startTrillSpan
and \stopTrillSpan
:
\relative { d''1\startTrillSpan d1 c2\stopTrillSpan r2 }
A trill spanner crossing a line break will restart exactly above the first note on the new line.
\relative { d''1\startTrillSpan \break d1 c2\stopTrillSpan r2 }
Consecutive trill spans will work without explicit
\stopTrillSpan
commands, since successive trill spanners will
automatically become the right bound of the previous trill.
\relative { d''1\startTrillSpan d1 b1\startTrillSpan d2\stopTrillSpan r2 }
Trills can also be combined with grace notes. The syntax of this construct and the method to precisely position the grace notes are described in Grace notes.
\relative { d''1~\afterGrace d1\startTrillSpan { c32[ d]\stopTrillSpan } c2 r2 }
Trills that require an auxiliary note with an explicit pitch can
be typeset with the \pitchedTrill
command. The first
argument is the main note, and the second is the trilled
note, printed as a stemless note head in parentheses.
\relative { \pitchedTrill d''2\startTrillSpan fis d2 c2\stopTrillSpan r2 }
The Accidental of the first pitched trill in a measure is always printed, even for naturals.
{ \key d \major \pitchedTrill d'2\startTrillSpan cis d\stopTrillSpan \pitchedTrill d2\startTrillSpan c d\stopTrillSpan \pitchedTrill d2\startTrillSpan e d\stopTrillSpan }
Subsequent accidentals (of the same note in the same measure) will need to be added manually.
\relative { \pitchedTrill eis''4\startTrillSpan fis eis4\stopTrillSpan \pitchedTrill eis4\startTrillSpan cis eis4\stopTrillSpan \pitchedTrill eis4\startTrillSpan fis eis4\stopTrillSpan \pitchedTrill eis4\startTrillSpan fis! eis4\stopTrillSpan }
Predefined commands
\startTrillSpan
,
\stopTrillSpan
.
See also
Music Glossary: trill.
Notation Reference: Articulations and ornamentations, Grace notes.
Snippets: Expressive marks.
Internals Reference: TrillSpanner.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Trills ] | [ Up : Musical notation ] | [ Long repeats > ] |
1.4 Repeats
Repetition is a central concept in music, and multiple notations exist for repetitions. LilyPond supports the following kinds of repeats:
-
volta
This is the standard notation for repeats with or without alternative endings. The repeated section is framed between repeat bar lines, but the starting bar line is omitted when the repeated section begins the piece. Alternative endings are printed in sequence, bracketed, and numbered with the volte to which they apply.
-
unfold
The repeated music is written out in full a specified number of times.
-
percent
These are beat or measure repeats. They look like single slashes or percent signs.
-
tremolo
This is used to write tremolo beams.
Chord constructs can be repeated using the chord repetition
symbol, q
. See Chord repetition.
1.4.1 Long repeats | ||
1.4.2 Short repeats |
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Repeats ] | [ Up : Repeats ] | [ Written-out repeats > ] |
1.4.1 Long repeats
This section discusses how to input long (usually multi-measure) repeats.
Written-out repeats | ||
Simple repeats | ||
Alternative endings | ||
Other variation in repeated sections | ||
In-staff segno | ||
Manual repeat marks |
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Long repeats ] | [ Up : Long repeats ] | [ Simple repeats > ] |
Written-out repeats
The \repeat unfold
command repeats music by writing it out
a number of times. The syntax is the same as the \repeat
volta
command, which is documented in following sections.
To avoid redundancy, unfolding is not demonstrated in detail here;
however, some of the examples in following sections illustrate
features in both volta
and unfold
forms using the
\unfoldRepeats
command to convert the volta
form to
the unfold
form. For another important use of the
\unfoldRepeats
command, see Using repeats with MIDI.
There are some points of interest specific to the \repeat
unfold
command.
In some cases, especially in a \relative
context, the
outcome of unfolding is not the same as of writing the input music
expression multiple times, e.g.,
\repeat unfold 2 { a'4 b c d | }
differs from the following by an octave change:
a'4 b c d | a'4 b c d |
Also, nesting \repeat unfold
can be practical in ways that
nesting \repeat volta
would not be.
Note: If you include relative
inside a repeat
without explicitly instantiating the Voice
context, extra
(unwanted) staves will appear. See
An extra staff appears.
See also
Snippets: Repeats.
Internals Reference: RepeatedMusic, UnfoldedRepeatedMusic.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Written-out repeats ] | [ Up : Long repeats ] | [ Alternative endings > ] |
Simple repeats
This is the syntax for a repeat without variation:
\repeat volta repeatcount musicexpr
where musicexpr
is the music expression to be
repeated.
\fixed c'' { \repeat volta 2 { c2 f } R1 \repeat volta 2 { g2 c } }
A starting bar line is not automatically printed at the beginning
of a piece; however, it is possible to add one with
\bar ".|:"
.
\fixed c'' { \repeat volta 2 { \bar ".|:" c2 f } }
A repeated section that starts in the middle of a measure usually
ends at the same position in a later measure so that the two ends
make a complete measure. The repeat bar lines are not measure
boundaries in such cases, so no bar checks should be placed there.
Likewise, no \partial
command should be placed within the
repeated music, because the measures are complete; however, a
\partial
command should be placed before the repeat when
there is a truly incomplete measure the first time through.
\fixed c'' { \partial 4 \repeat volta 2 { c4 c2 d g4 g g } \repeat volta 2 { e4 f2 g c2. } }
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Simple repeats ] | [ Up : Long repeats ] | [ Other variation in repeated sections > ] |
Alternative endings
This is the syntax for a repeat with alternative endings:
\repeat volta repeatcount musicexpr \alternative { \volta numberlist musicexpr \volta numberlist musicexpr … }
where musicexpr
is a music expression and
numberlist
is a comma-separated list of volta numbers
chosen from the range 1 to repeatcount
.
\fixed c'' { \repeat volta 6 { c4 d e f } \alternative { \volta 1,2,3 { c2 e } \volta 4,5 { f2 d } \volta 6 { e2 f } } c1 }
\volta
specifications within an \alternative
block
are optional on an all-or-none basis. If they are omitted,
alternatives are used once each, but the first is repeated as
needed to satisfy the repeat count.
\fixed c'' { \repeat volta 6 { c4 d e f } \alternative { { c2 e } { f2 d } { e2 f } } c1 }
Note: Every element in an alternative
block is
treated as an alternative ending. Something as simple as a bar
check on the wrong side of a bracket can produce unexpected
results.
Note: If you include relative
inside a
repeat
without explicitly instantiating the
Voice
context, extra (unwanted) staves will appear. See
An extra staff appears.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Alternative endings ] | [ Up : Long repeats ] | [ In-staff segno > ] |
Other variation in repeated sections
An \alternative
block can be used within a \repeat
block to produce notation similar to alternative endings; however,
it can not be used in this manner for alternative endings
themselves (see Alternative endings).
\fixed c'' { \repeat volta 2 { R1 \alternative { \volta 1 { c1 } \volta 2 { d1 } } R1 } }
The \volta
command is not limited to use within
\alternative
blocks. It can be used anywhere within a
\repeat
to designate music that applies to particular
volte. If the volta-specific music has a duration, it is by
default printed under a bracket as if it were in an
\alternative
block; the bracket may need to be hidden (see
Visibility of objects) or customized to suit other purposes.
When a \repeat
is unfolded, volta-specific music is omitted
from every volta to which it does not apply. Providing an empty
Scheme list in place of volta numbers removes the music entirely.
music = \repeat volta 3 { \volta 1 { s1*0_\markup { \italic dolce } } a''1 \volta #'() { \mark "3×" } } \new Score { \music } \new Score { \unfoldRepeats \music }
When a \repeat
is unfolded, it may be desirable not only to
filter out volta-specific music, but also to add music that was
not present in the volta
form. The \unfolded
command designates music to be ignored until the enclosing
\repeat
is unfolded.
music = \fixed c' { \repeat volta 2 { c1 \once \override Score.VoltaBracket.text = "1st time only" \once \override Score.VoltaBracket.font-name = "TeX Gyre Schola" << \volta 1 { g4 g g g } \volta 2 { \unfolded { R1 } } >> c'1 \volta 2 { \unfolded { \bar "|." } } } } \new Score { \music } \new Score { \unfoldRepeats \music }
Note: The volta
and unfolded
commands
function with respect to the innermost repeat enclosing them.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Other variation in repeated sections ] | [ Up : Long repeats ] | [ Manual repeat marks > ] |
In-staff segno
The \inStaffSegno
command can be used to generate a composite
bar line incorporating the segno symbol with the appropriate repeat
bar line when used with the \repeat volta
command. The
correct type of repeat bar line, viz. start repeat, end repeat or
double repeat, is selected automatically. Note that the
corresponding “D.S.” mark must be added manually.
Away from a repeat:
\relative { e'1 \inStaffSegno f2 g a b c1_"D.S." \bar "|." }
At the start of a repeat:
\relative { e'1 \repeat volta 2 { \inStaffSegno % start repeat f2 g a b } c1_"D.S." \bar "|." }
At the end of a repeat:
\relative { e'1 \repeat volta 2 { f2 g a b \inStaffSegno % end repeat } f2 g a b c1_"D.S." \bar "|." }
Between two repeats:
\relative { e'1 \repeat volta 2 { f2 g a b } \inStaffSegno % double repeat \repeat volta 2 { f2 g a b } c1_"D.S." \bar "|." }
Alternative bar line symbols can be obtained by setting (in the Score
context) the properties segnoType
, startRepeatSegnoType
,
endRepeatSegnoType
or doubleRepeatSegnoType
to the
required bar line type. The alternative bar line types must be
selected from the pre-defined types or types previously defined
with the \defineBarLine
command (see Bar lines).
\defineBarLine ":|.S[" #'(":|." "S[" "") \defineBarLine "]" #'("]" "" "") \relative { e'1 \repeat volta 2 { f2 g a b \once \set Score.endRepeatSegnoType = ":|.S[" \inStaffSegno } f2 g \bar "]" a b c1_"D.S." \bar "|." }
Selected Snippets
Shortening volta brackets
By default, the volta brackets will be drawn over all of the
alternative music, but it is possible to shorten them by setting
voltaSpannerDuration
. In the next example, the bracket only
lasts one measure, which is a duration of 3/4.
\relative c'' { \time 3/4 c4 c c \set Score.voltaSpannerDuration = #(ly:make-moment 3/4) \repeat volta 5 { d4 d d } \alternative { { e4 e e f4 f f } { g4 g g } } }
Adding volta brackets to additional staves
The Volta_engraver
by default resides in the Score
context, and brackets for the repeat are thus normally only printed
over the topmost staff. This can be adjusted by adding the
Volta_engraver
to the Staff
context where the brackets
should appear; see also the “Volta multi staff” snippet.
<< \new Staff { \repeat volta 2 { c'1 } \alternative { c' } } \new Staff { \repeat volta 2 { c'1 } \alternative { c' } } \new Staff \with { \consists "Volta_engraver" } { c'2 g' e' a' } \new Staff { \repeat volta 2 { c'1 } \alternative { c' } } >>
Setting the double repeat default for volte
There are three different styles of double repeats for volte, that can
be set using doubleRepeatType
.
\relative c'' { \repeat volta 1 { c1 } \set Score.doubleRepeatType = #":..:" \repeat volta 1 { c1 } \set Score.doubleRepeatType = #":|.|:" \repeat volta 1 { c1 } \set Score.doubleRepeatType = #":|.:" \repeat volta 1 { c1 } }
Alternative bar numbering
Two alternative methods for bar numbering can be set, especially for when using repeated music.
\relative c'{ \set Score.alternativeNumberingStyle = #'numbers \repeat volta 3 { c4 d e f | } \alternative { { c4 d e f | c2 d \break } { f4 g a b | f4 g a b | f2 a | \break } { c4 d e f | c2 d } } c1 \break \set Score.alternativeNumberingStyle = #'numbers-with-letters \repeat volta 3 { c,4 d e f | } \alternative { { c4 d e f | c2 d \break } { f4 g a b | f4 g a b | f2 a | \break } { c4 d e f | c2 d } } c1 }
See also
Music Glossary: repeat, volta.
Notation Reference: Bar lines, Modifying context plug-ins, Modifying ties and slurs, Time administration.
Installed Files: ‘ly/engraver-init.ly’.
Snippets: Repeats.
Internals Reference: VoltaBracket, RepeatedMusic, VoltaRepeatedMusic, UnfoldedRepeatedMusic.
Known issues and warnings
For repeats in volta
form, spanners (slurs, etc.) that
cross into alternatives work for the first alternative only. They
likewise cannot wrap around from the end of an alternative back to
the beginning of the repeated section.
The visual appearance of a continuing slur or tie in subsequent
alternatives can be achieved with \repeatTie
if the slur
extends into only one note in the alternative block, although this
method does not work in TabStaff
; see Repeat tie.
Other methods which may be tailored to indicate continuing slurs
over several notes in alternative blocks, and which also work in
TabStaff
contexts, are shown in Modifying ties and slurs.
The visual appearance of a continuing glissando in subsequent alternatives can be achieved by coding a glissando starting on a hidden grace note. See Extending glissandi across repeats.
If a repeat that begins with an incomplete measure has an
\alternative
block that contains modifications to the
measureLength
property, using \unfoldRepeats
will
result in wrongly-placed bar lines and bar check warnings.
A nested repeat like
\repeat … \repeat … \alternative
is ambiguous, since it 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.
An \alternative
block end-justified within the body of a
\repeat
block (as opposed to following it) does not print
the repeat bar lines that are expected of alternative endings.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < In-staff segno ] | [ Up : Long repeats ] | [ Short repeats > ] |
Manual repeat marks
Note: These methods are only used for displaying unusual repeat
constructs, and may produce unexpected behavior. In most cases,
repeats should be created using the standard repeat
command
or by printing the relevant bar lines. For more information, see
Bar lines.
The property repeatCommands
can be used to control the
layout of repeats. Its value is a Scheme list of repeat commands.
-
start-repeat
Print a
.|:
bar line.\relative { c''1 \set Score.repeatCommands = #'(start-repeat) d4 e f g c1 }
As per standard engraving practice, repeat signs are not printed at the beginning of a piece.
-
end-repeat
Print a
:|.
bar line:\relative { c''1 d4 e f g \set Score.repeatCommands = #'(end-repeat) c1 }
-
(volta number) … (volta #f)
Create a new volta with the specified number. The volta bracket must be explicitly terminated, or it will not be printed.
\relative { f''4 g a b \set Score.repeatCommands = #'((volta "2")) g4 a g a \set Score.repeatCommands = #'((volta #f)) c1 }
Multiple repeat commands may occur at the same point:
\relative { f''4 g a b \set Score.repeatCommands = #'((volta "2, 5") end-repeat) g4 a g a c1 \set Score.repeatCommands = #'((volta #f) (volta "95") end-repeat) b1 \set Score.repeatCommands = #'((volta #f)) }
Text can be included with the volta bracket. The text can be a number or numbers or markup text, see Formatting text. The simplest way to use markup text is to define the markup first, then include the markup in a Scheme list.
voltaAdLib = \markup { 1. 2. 3... \text \italic { ad lib. } } \relative { c''1 \set Score.repeatCommands = #(list(list 'volta voltaAdLib) 'start-repeat) c4 b d e \set Score.repeatCommands = #'((volta #f) (volta "4.") end-repeat) f1 \set Score.repeatCommands = #'((volta #f)) }
See also
Notation Reference: Bar lines, Formatting text.
Snippets: Repeats.
Internals Reference: VoltaBracket, RepeatedMusic, VoltaRepeatedMusic.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Manual repeat marks ] | [ Up : Repeats ] | [ Percent repeats > ] |
1.4.2 Short repeats
This section discusses how to input short repeats. Short repeats can take two forms: slashes or percent signs to represent repeats of a single note, a single measure or two measures, and tremolos otherwise.
Percent repeats | ||
Tremolo repeats |
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Short repeats ] | [ Up : Short repeats ] | [ Tremolo repeats > ] |
Percent repeats
Repeated short patterns are printed once, and the repeated pattern is replaced with a special sign.
The syntax is
\repeat percent number musicexpr
where musicexpr
is a music expression.
Patterns that are shorter than one measure are replaced by slashes.
\relative c'' { \repeat percent 4 { c128 d e f } \repeat percent 4 { c64 d e f } \repeat percent 5 { c32 d e f } \repeat percent 4 { c16 d e f } \repeat percent 4 { c8 d } \repeat percent 4 { c4 } \repeat percent 2 { c2 } }
Patterns of one or two measures are replaced by percent-like symbols.
\relative c'' { \repeat percent 2 { c4 d e f } \repeat percent 2 { c2 d } \repeat percent 2 { c1 } }
\relative { \repeat percent 3 { c''4 d e f | c2 g' } }
Patterns that are shorter than one measure but contain mixed durations use a double-percent symbol.
\relative { \repeat percent 4 { c''8. <d f>16 } \repeat percent 2 { \tuplet 3/2 { r8 c d } e4 } }
Selected Snippets
Percent repeat counter
Measure repeats of more than two repeats can get a counter when the convenient property is switched, as shown in this example:
\relative c'' { \set countPercentRepeats = ##t \repeat percent 4 { c1 } }
Percent repeat count visibility
Percent repeat counters can be shown at regular intervals by setting
the context property repeatCountVisibility
.
\relative c'' { \set countPercentRepeats = ##t \set repeatCountVisibility = #(every-nth-repeat-count-visible 5) \repeat percent 10 { c1 } \break \set repeatCountVisibility = #(every-nth-repeat-count-visible 2) \repeat percent 6 { c1 d1 } }
Isolated percent repeats
Isolated percents can also be printed.
makePercent = #(define-music-function (note) (ly:music?) "Make a percent repeat the same length as NOTE." (make-music 'PercentEvent 'length (ly:music-length note))) \relative c'' { \makePercent s1 }
See also
Music Glossary: percent repeat, simile.
Snippets: Repeats.
Internals Reference: RepeatSlash, RepeatSlashEvent, DoubleRepeatSlash, PercentRepeat, PercentRepeatCounter, PercentRepeatedMusic, Percent_repeat_engraver, DoublePercentEvent, DoublePercentRepeat, DoublePercentRepeatCounter, Double_percent_repeat_engraver, Slash_repeat_engraver.
Known issues and warnings
Percent repeats will not contain anything else apart from the percent sign itself; in particular, timing changes will not be repeated.
\repeat percent 3 { \time 5/4 c2. 2 \time 4/4 2 2 }
Any meter changes or \partial
commands need to occur in parallel
passages outside of any percent repeat, e.g in a separate
timing track.
<< \repeat percent 3 { c2. 2 2 2 } \repeat unfold 3 { \time 5/4 s4*5 \time 4/4 s1 } >>
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Percent repeats ] | [ Up : Short repeats ] | [ Simultaneous notes > ] |
Tremolo repeats
Tremolos can take two forms: alternation between two chords or two notes, and rapid repetition of a single note or chord. Tremolos consisting of an alternation are indicated by adding beams between the notes or chords being alternated, while tremolos consisting of the rapid repetition of a single note are indicated by adding beams or slashes to a single note.
To place tremolo marks between notes, use \repeat
with
tremolo style:
\relative c'' { \repeat tremolo 8 { c16 d } \repeat tremolo 6 { c16 d } \repeat tremolo 2 { c16 d } }
The \repeat tremolo
syntax expects exactly two notes within
the braces, and the number of repetitions must correspond to a
note value that can be expressed with plain or dotted notes. Thus,
\repeat tremolo 7
is valid and produces a double dotted
note, but \repeat tremolo 9
is not.
The duration of the tremolo equals the duration of the
braced expression multiplied by the number of repeats:
\repeat tremolo 8 { c16 d16 }
gives a whole note tremolo,
notated as two whole notes joined by tremolo beams.
There are two ways to put tremolo marks on a single note. The
\repeat tremolo
syntax is also used here, in which case
the note should not be surrounded by braces:
\repeat tremolo 4 c'16
The same output can be obtained by adding :N
after
the note, where N
indicates the duration of the
subdivision (it must be at least 8). If N
is 8, one
beam is added to the note’s stem. If N
is omitted,
the last value is used:
\relative { c''2:8 c:32 c: c: }
Selected Snippets
Cross-staff tremolos
Since \repeat tremolo
expects exactly two musical arguments for
chord tremolos, the note or chord which changes staff within a
cross-staff tremolo should be placed inside curly braces together with
its \change Staff
command.
\new PianoStaff << \new Staff = "up" \relative c'' { \key a \major \time 3/8 s4. } \new Staff = "down" \relative c'' { \key a \major \time 3/8 \voiceOne \repeat tremolo 6 { <a e'>32 { \change Staff = "up" \voiceTwo <cis a' dis>32 } } } >>
See also
Snippets: Repeats.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Tremolo repeats ] | [ Up : Musical notation ] | [ Single voice > ] |
1.5 Simultaneous notes
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.
1.5.1 Single voice | ||
1.5.2 Multiple voices |
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Simultaneous notes ] | [ Up : Simultaneous notes ] | [ Chorded notes > ] |
1.5.1 Single voice
This section discusses simultaneous notes inside the same voice.
Chorded notes | ||
Chord repetition | ||
Simultaneous expressions | ||
Clusters |
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Single voice ] | [ Up : Single voice ] | [ Chord repetition > ] |
Chorded notes
A chord is formed by enclosing a set of pitches between <
and >
. A chord may be followed by a duration just like simple
notes.
\relative { <a' c e>1 <a c e>2 <f a c e>4 <a c>8. <g c e>16 }
Chords may also be followed by articulations, again just like simple notes.
\relative { <a' c e>1\fermata <a c e>2-> <f a c e>4\prall <a c>8.^! <g c e>16-. }
The notes within the chord themselves can also be followed by articulation and ornamentation.
\relative { <a' c\prall e>1 <a-> c-^ e>2 <f-. a c-. e-.>4 <a-+ c-->8. <g\fermata c e\turn>16 }
However some notation, such as dynamics and hairpins must be attached to the chord rather than to notes within the chord, otherwise they will not print. Other notation like fingerings and slurs will get placed markedly different when attached to notes within a chord rather than to whole chords or single notes.
\relative { <a'\f c( e>1 <a c) e>\f <a\< c e>( <a\! c e>) <a c e>\< <a c e> <a c e>\! }
A chord acts merely as a container for its notes, its articulations and other attached elements. Consequently, a chord without notes inside does not actually have a duration. Any attached articulations will happen at the same musical time as the next following note or chord and be combined with them (for more complex possibilities of combining such elements, see Simultaneous expressions):
\relative { \grace { g'8( a b } <> ) \p \< -. -\markup \italic "sempre staccato" \repeat unfold 4 { c4 e } c1\f }
Relative mode can be used for pitches in chords. The first note of each chord is always relative to the first note of the chord that came before it, or in the case where no preceding chord exists, the pitch of the last note that came before the chord. All remaining notes in the chord are relative to the note that came before it within the same chord.
\relative { <a' c e>1 <f a c> <a c e> <f' a c> <b, e b,> }
For more information about chords, see Chord notation.
See also
Music Glossary: chord.
Learning Manual: Combining notes into chords.
Notation Reference: Chord notation, Articulations and ornamentations, Relative octave entry, Multiple voices.
Snippets: Simultaneous notes.
Known issues and warnings
Chords containing more than two pitches within a staff space, such as ‘<e f! fis!>’, create overlapping noteheads. Depending on the situation, better representations might involve
- temporary use of Multiple voices, ‘<< f! \\ <e fis!> >>’,
- enharmonic transcription of one or more pitches, ‘<e f ges>’, or
- Clusters.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Chorded notes ] | [ Up : Single voice ] | [ Simultaneous expressions > ] |
Chord repetition
In order to save typing, a shortcut can be used to repeat the preceding
chord. The chord repetition symbol is q
:
\relative { <a' c e>1 q <f a c>2 q }
As with regular chords, the chord repetition symbol can be used with durations, articulations, markups, slurs, beams, etc., as only the pitches of the previous chord are duplicated.
\relative { <a' c e>1\p^"text" q2\<( q8)[-! q8.]\! q16-1-2-3 q8\prall }
The chord repetition symbol always remembers the last instance of a chord so it is possible to repeat the most recent chord even if other non-chorded notes or rests have been added since.
\relative { <a' c e>1 c'4 q2 r8 q8 | q2 c, | }
However, the chord repetition symbol does not retain any dynamics, articulation or ornamentation within, or attached to, the previous chord.
\relative { <a'-. c\prall e>1\sfz c'4 q2 r8 q8 | q2 c, | }
To have some of them retained, the \chordRepeats
function can be
be called explicitly with an extra argument specifying a list of
event types to keep unless events of that type are already
present on the q
chord itself.
\relative { \chordRepeats #'(articulation-event) { <a'-. c\prall e>1\sfz c'4 q2 r8 q8-. } | q2 c, | }
Here using \chordRepeats
inside of a \relative
construction
produces unexpected results: once chord events have been expanded, they
are indistinguishable from having been entered as regular chords, making
\relative
assign an octave based on their current context.
Since nested instances of \relative
don’t affect one another,
another \relative
inside of \chordRepeats
can be used for
establishing the octave relations before expanding the repeat chords.
In that case, the whole content of the inner \relative
does not
affect the outer one; hence the different octave entry of the final note
in this example.
\relative { \chordRepeats #'(articulation-event) \relative { <a'-. c\prall e>1\sfz c'4 q2 r8 q8-. } | q2 c'' | }
Interactions with \relative
occur only with explicit calls of
\chordRepeats
: the implicit expansion at the start of typesetting
is done at a time where all instances of \relative
have already
been processed.
See also
Notation Reference: Chord notation, Articulations and ornamentations.
Installed Files: ‘ly/chord-repetition-init.ly’.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Chord repetition ] | [ Up : Single voice ] | [ Clusters > ] |
Simultaneous expressions
One or more music expressions enclosed in double angle brackets are taken to be simultaneous. If the first expression begins with a single note or if the whole simultaneous expression appears explicitly within a single voice, the whole expression is placed on a single staff; otherwise the elements of the simultaneous expression are placed on separate staves.
The following examples show simultaneous expressions on one staff:
\new Voice { % explicit single voice << \relative { a'4 b g2 } \relative { d'4 g c,2 } >> }
\relative { % single first note a' << \relative { a'4 b g } \relative { d'4 g c, } >> }
This can be useful if the simultaneous sections have identical rhythms, but attempts to attach notes with different durations to the same stem will cause errors. Notes, articulations, and property changes in a single ‘Voice’ are collected and engraved in musical order:
\relative { <a' c>4-. <>-. << c a >> << { c-. <c a> } { a s-. } >> }
Multiple stems or beams or different note durations or properties at the same musical time require the use of multiple voices.
The following example shows how simultaneous expressions can generate multiple staves implicitly:
% no single first note << \relative { a'4 b g2 } \relative { d'4 g2 c,4 } >>
Here different rhythms cause no problems because they are interpreted in different voices.
Known issues and warnings
If notes from two or more voices, with no shifts specified, have stems in the same direction, the message
warning: This voice needs a \voiceXx or \shiftXx setting
will appear during compilation. This message can be suppressed by:
\override NoteColumn.ignore-collision = ##t
However, this not only suppresses the warning but will prevent any collision resolution whatsover and may have other unintended effects (also see Known Issues in Collision resolution).
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Simultaneous expressions ] | [ Up : Single voice ] | [ Multiple voices > ] |
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.,
\relative \makeClusters { <g' b>2 <c g'> }
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
Music Glossary: cluster.
Snippets: Simultaneous notes.
Internals Reference: ClusterSpanner, ClusterSpannerBeacon, Cluster_spanner_engraver.
Known issues and warnings
Clusters look good only if they span at least two chords; otherwise they appear too narrow.
Clusters do not have a stem and cannot indicate durations by themselves, but the length of the printed cluster is determined by the durations of the defining chords. Separate clusters need a separating rest between them.
Clusters do not produce MIDI output.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Clusters ] | [ Up : Simultaneous notes ] | [ Single-staff polyphony > ] |
1.5.2 Multiple voices
This section discusses simultaneous notes in multiple voices or multiple staves.
Single-staff polyphony | ||
Voice styles | ||
Collision resolution | ||
Merging rests | ||
Automatic part combining | ||
Writing music in parallel |
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Multiple voices ] | [ Up : Multiple voices ] | [ Voice styles > ] |
Single-staff polyphony
Explicitly instantiating voices
The basic structure needed to achieve multiple independent voices in a single staff is illustrated in the following example:
\new Staff << \new Voice = "first" \relative { \voiceOne r8 r16 g'' e8. f16 g8[ c,] f e16 d } \new Voice= "second" \relative { \voiceTwo d''16 c d8~ 16 b c8~ 16 b c8~ 16 b8. } >>
Here, voices are instantiated explicitly and are given names. The
\voiceOne
… \voiceFour
commands set up the voices
so that first and third voices get stems up, second and fourth
voices get stems down, third and fourth voice note heads are
horizontally shifted, and rests in the respective voices are
automatically moved to avoid collisions. The \oneVoice
command returns all the voice settings to the neutral default
directions.
Temporary polyphonic passages
A temporary polyphonic passage can be created with the following construct:
<< { \voiceOne … } \new Voice { \voiceTwo … } >> \oneVoice
Here, the first expression within a temporary polyphonic passage is
placed into the Voice
context which was in use immediately
before the polyphonic passage, and that same Voice
context
continues after the temporary section. Other expressions within
the angle brackets are assigned to distinct temporary voices.
This allows lyrics to be assigned to one continuing voice before,
during and after a polyphonic section:
\relative << \new Voice = "melody" { a'4 << { \voiceOne g f } \new Voice { \voiceTwo d2 } >> \oneVoice e4 } \new Lyrics \lyricsto "melody" { This is my song. } >>
Here, the \voiceOne
and \voiceTwo
commands are
required to define the settings of each voice.
The double backslash construct
The << {…} \\ {…} >>
construct, where the two (or
more) expressions are separated by double backslashes, behaves
differently to the similar construct without the double backslashes:
all the expressions within this construct are assigned
to new Voice
contexts. These new Voice
contexts
are created implicitly and are given the fixed names "1"
,
"2"
, etc.
The first example could be typeset as follows:
<< \relative { r8 r16 g'' e8. f16 g8[ c,] f e16 d } \\ \relative { d''16 c d8~ 16 b c8~ 16 b c8~ 16 b8. } >>
This syntax can be used where it does not matter that temporary
voices are created and then discarded. These implicitly created
voices are given the settings equivalent to the effect of the
\voiceOne
… \voiceFour
commands, in the order in
which they appear in the code.
In the following example, the intermediate voice has stems up, therefore we enter it in the third place, so it becomes voice three, which has the stems up as desired. Spacer rests are used to avoid printing doubled rests.
<< \relative { r8 g'' g g g f16 ees f8 d } \\ \relative { ees'8 r ees r d r d r } \\ \relative { d''8 s c s bes s a s } >>
In all but the simplest works it is advisable to create explicit
Voice
contexts as explained in
Contexts and engravers and
Explicitly instantiating voices.
Voice order
When entering multiple voices in the input file, use the following order:
Voice 1: highest Voice 2: lowest Voice 3: second highest Voice 4: second lowest Voice 5: third highest Voice 6: third lowest etc.
Though this may seem counterintuitive, it simplifies the automatic layout process. Note that the odd-numbered voices are given upstems, and the even-numbered voices are given downstems:
\new Staff << \time 2/4 { f''2 } % 1: highest \\ { c'2 } % 2: lowest \\ { d''2 } % 3: second-highest \\ { e'2 } % 4: second-lowest \\ { b'2 } % 5: third-highest \\ { g'2 } % 6: third-lowest >>
When a different voice entry order is desired, the command
\voices
may be convenient:
\new Staff \voices 1,3,5,6,4,2 << \time 2/4 { f''2 } % 1: highest \\ { d''2 } % 3: second-highest \\ { b'2 } % 5: third-highest \\ { g'2 } % 6: third-lowest \\ { e'2 } % 4: second-lowest \\ { c'2 } % 2: lowest >>
Note: Lyrics and spanners (such as slurs, ties, hairpins, etc.) cannot be created ‘across’ voices.
Identical rhythms
In the special case that we want to typeset parallel pieces of music
that have the same rhythm, we can combine them into a single
Voice
context, thus forming chords. To achieve this, enclose
them in a simple simultaneous music construct within an explicit voice:
\new Voice << \relative { e''4 f8 d e16 f g8 d4 } \relative { c''4 d8 b c16 d e8 b4 } >>
This method leads to strange beamings and warnings if the pieces of music do not have the same rhythm.
Predefined commands
\voiceOne
,
\voiceTwo
,
\voiceThree
,
\voiceFour
,
\oneVoice
.
See also
Learning Manual: Voices contain music, Explicitly instantiating voices.
Notation Reference: Percussion staves, Invisible rests, Stems.
Snippets: Simultaneous notes.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Single-staff polyphony ] | [ Up : Multiple voices ] | [ Collision resolution > ] |
Voice styles
Voices may be given distinct colors and shapes, allowing them to be easily identified:
<< \relative { \voiceOneStyle d''4 c2 b4 } \\ \relative { \voiceTwoStyle e'2 e } \\ \relative { \voiceThreeStyle b2. c4 } \\ \relative { \voiceFourStyle g'2 g } >>
The \voiceNeutralStyle
command is used to revert to the
standard presentation.
Predefined commands
\voiceOneStyle
,
\voiceTwoStyle
,
\voiceThreeStyle
,
\voiceFourStyle
,
\voiceNeutralStyle
.
See also
Learning Manual: I'm hearing Voices, Other sources of information.
Snippets: Simultaneous notes.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Voice styles ] | [ Up : Multiple voices ] | [ Merging rests > ] |
Collision resolution
The note heads of notes in different voices with the same pitch, same note head and opposite stem direction are automatically merged, but notes with different note heads or the same stem direction are not. Rests opposite a stem in a different voice are shifted vertically. The following example shows three different circumstances, on beats 1 and 3 in bar 1 and beat 1 in bar 2, where the automatic merging fails.
<< \relative { c''8 d e d c d c4 g'2 fis } \\ \relative { c''2 c8. b16 c4 e,2 r } \\ \relative { \oneVoice s1 e'8 a b c d2 } >>
Notes with different note heads may be merged as shown below. In this example the note heads on beat 1 of bar 1 are now merged:
<< \relative { \mergeDifferentlyHeadedOn c''8 d e d c d c4 g'2 fis } \\ \relative { c''2 c8. b16 c4 e,2 r } \\ \relative { \oneVoice s1 e'8 a b c d2 } >>
Quarter and half notes are not merged in this way, since it would be difficult to tell them apart.
Note heads with different dots as shown in beat 3 of bar 1 may be also be merged:
<< \relative { \mergeDifferentlyHeadedOn \mergeDifferentlyDottedOn c''8 d e d c d c4 g'2 fis } \\ \relative { c''2 c8. b16 c4 e,2 r } \\ \relative { \oneVoice s1 e'8 a b c d2 } >>
The half note and eighth note at the start of the second measure
are incorrectly merged because the automatic merge cannot
successfully complete the merge when three or more notes line up in
the same note column, and in this case the merged note head is
incorrect. To allow the merge to select the correct note head
a \shift
must be applied to the note that should not be
merged. Here, \shiftOn
is applied to move the top
g out of the column, and \mergeDifferentlyHeadedOn
then works properly.
<< \relative { \mergeDifferentlyHeadedOn \mergeDifferentlyDottedOn c''8 d e d c d c4 \shiftOn g'2 fis } \\ \relative { c''2 c8. b16 c4 e,2 r } \\ \relative { \oneVoice s1 e'8 a b c d2 } >>
The \shiftOn
command allows (but does not force) the notes
in a voice to be shifted. When \shiftOn
is applied to a
voice, a note or chord in that voice is shifted only if its stem
would otherwise collide with a stem from another voice, and only
if the colliding stems point in the same direction. The
\shiftOff
command prevents this type of shifting from
occurring.
By default, the outer voices (normally voices one and two) have
\shiftOff
specified, while the inner voices (three and
above) have \shiftOn
specified. When a shift is applied,
voices with upstems (odd-numbered voices) are shifted to the
right, and voices with downstems (even-numbered voices) are
shifted to the left.
Here is an example to help you visualize how an abbreviated polyphonic expression would be expanded internally.
Note: Note that with three or more voices, the vertical order of voices in your input file should not be the same as the vertical order of voices on the staff!
\new Staff \relative { %% abbreviated entry << { f''2 } % 1: highest \\ { g,2 } % 2: lowest \\ { d'2 } % 3: upper middle \\ { b2 } % 4: lower middle >> %% internal expansion of the above << \new Voice = "1" { \voiceOne \shiftOff f'2 } \new Voice = "2" { \voiceTwo \shiftOff g,2 } \new Voice = "3" { \voiceThree \shiftOn d'2 } % shifts right \new Voice = "4" { \voiceFour \shiftOn b2 } % shifts left >> }
Two additional commands, \shiftOnn
and \shiftOnnn
provide further shift levels which may be specified temporarily to
resolve collisions in complex situations – see
Real music example.
Notes are only merged if they have opposing stem directions (as they have, for example, in voices one and two by default or when the stems are explicitly set in opposite directions).
Predefined commands
\mergeDifferentlyDottedOn
,
\mergeDifferentlyDottedOff
,
\mergeDifferentlyHeadedOn
,
\mergeDifferentlyHeadedOff
.
\shiftOn
,
\shiftOnn
,
\shiftOnnn
,
\shiftOff
.
Selected Snippets
Additional voices to avoid collisions
In some instances of complex polyphonic music, additional voices are
necessary to prevent collisions between notes. If more than four
parallel voices are needed, additional voices can be added by defining
a variable using the Scheme function context-spec-music
.
voiceFive = #(context-spec-music (make-voice-props-set 4) 'Voice) \relative c'' { \time 3/4 \key d \minor \partial 2 << \new Voice { \voiceOne a4. a8 e'4 e4. e8 f4 d4. c8 } \new Voice { \voiceTwo d,2 d4 cis2 d4 bes2 } \new Voice { \voiceThree f'2 bes4 a2 a4 s2 } \new Voice { \voiceFive s2 g4 g2 f4 f2 } >> }
Moving dotted notes in polyphony
When a dotted note in the upper voice is moved to avoid a collision
with a note in another voice, the default is to move the upper note to
the right. This behaviour can be over-ridden by using the
prefer-dotted-right
property of NoteCollision
.
\new Staff \relative c' << { f2. f4 \override Staff.NoteCollision.prefer-dotted-right = ##f f2. f4 \override Staff.NoteCollision.prefer-dotted-right = ##t f2. f4 } \\ { e4 e e e e e e e e e e e } >>
Forcing horizontal shift of notes
When the typesetting engine cannot cope, the following syntax can be used to override typesetting decisions. The units of measure used here are staff spaces.
\relative c' << { <d g>2 <d g> } \\ { <b f'>2 \once \override NoteColumn.force-hshift = #1.7 <b f'>2 } >>
See also
Music Glossary: polyphony.
Learning Manual: Multiple notes at once, Voices contain music, Real music example.
Snippets: Simultaneous notes.
Internals Reference: NoteColumn, NoteCollision, RestCollision.
Known issues and warnings
Using \override NoteColumn.ignore-collision = ##t
will cause
differently headed notes in different voices to merge incorrectly.
\mergeDifferentlyHeadedOn << \relative { c'16 a' b a } \\ \relative { c'2 } >> \override NoteColumn.ignore-collision = ##t << \relative { c'16 a' b a } \\ \relative { c'2 } >>
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Collision resolution ] | [ Up : Multiple voices ] | [ Automatic part combining > ] |
Merging rests
When using multiple voices it is common to merge rests which occur in both
parts. This can be accomplished using Merge_rests_engraver
.
voiceA = \relative { d''4 r d2 | R1 | } voiceB = \relative { fis'4 r g2 | R1 | } \score { << \new Staff \with { instrumentName = "unmerged" } << \new Voice { \voiceOne \voiceA } \new Voice { \voiceTwo \voiceB } >> \new Staff \with { instrumentName = "merged" \consists "Merge_rests_engraver" } << \new Voice { \voiceOne \voiceA } \new Voice { \voiceTwo \voiceB } >> >> }
Setting the context property suspendRestMerging
to ##t
allows for
turning off rest merging temporarily.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Merging rests ] | [ Up : Multiple voices ] | [ Writing music in parallel > ] |
Automatic part combining
Automatic part combining is used to merge two separate parts of music
onto a single staff. This can be especially helpful when typesetting
orchestral scores. A single Voice
is printed while the two parts
of music are the same, but in places where they differ, a second
Voice
is printed. Stem directions are set up & down accordingly
while Solo and a due parts are also identified and marked
appropriately.
The syntax for automatic part combining is:
\partCombine musicexpr1 musicexpr2
The following example demonstrates the basic functionality, putting parts on a single staff as polyphony and setting stem directions accordingly. The same variables are used for the independent parts and the combined staff.
instrumentOne = \relative { c'4 d e f | R1 | d'4 c b a | b4 g2 f4 | e1 | } instrumentTwo = \relative { R1 | g'4 a b c | d4 c b a | g4 f( e) d | e1 | } << \new Staff \instrumentOne \new Staff \instrumentTwo \new Staff \partCombine \instrumentOne \instrumentTwo >>
Both parts have identical notes in the third measure, so only one
instance of the notes is printed. Stem, slur, and tie directions are
set automatically, depending on whether the parts are playing solo or in
unison. When needed in polyphony situations, the first part (with
context called one
) gets “up” stems, while the second (called
two
) always gets “down” stems. In solo situations, the first
and second parts get marked with “Solo” and “Solo II”,
respectively. The unison (a due) parts are marked with the
text “a2”.
By default, the partCombiner merges two notes of the same pitch as an
a due note, combines notes with the same
rhythm less than a ninth apart as chords and separates notes more than
a ninth apart (or when the voices cross) into
separate voices. This can be overridden with an optional argument of a pair
of numbers after the \partCombine
command: the first specifies
the interval where notes start to be combined (the default is zero) and the
second where the notes are split into separate voices. Setting the second
argument to zero means that the partCombiner splits notes with an interval of
a second or more, setting it to one splits notes of a third or more, and so on.
instrumentOne = \relative { a4 b c d | e f g a | b c d e | } instrumentTwo = \relative { c'4 c c c | c c c c | c c c c | } << \new Staff \partCombine \instrumentOne \instrumentTwo \new Staff \partCombine #'(2 . 3) \instrumentOne \instrumentTwo >>
Both arguments to \partCombine
will be interpreted as separate
Voice
contexts, so if the music is being specified in relative
mode then both parts must contain a \relative
function,
i.e.,
\partCombine \relative … musicexpr1 \relative … musicexpr2
A \relative
section that encloses a \partCombine
has no
effect on the pitches of musicexpr1
or
musicexpr2
.
In professional scores, voices are often kept apart from each other for
long passages of music even if some of the notes are the same in both
voices, and could just as easily be printed as unison. Combining notes
into a chord, or showing one voice as solo is, therefore, not ideal as
the \partCombine
function considers each note separately. In this
case the \partCombine
function can be overridden with one of the
following commands. All of the commands may be preceded with
\once
in order to have them only apply to the next note in
the music expression.
-
\partCombineApart
keeps the notes as two separate voices, even if they can be combined into a chord or unison. -
\partCombineChords
combines the notes into a chord. -
\partCombineUnisono
combines both voices as “unison”. -
\partCombineSoloI
prints only voice one, and marks it as a “Solo”. -
\partCombineSoloII
prints only voice two and marks it as a “Solo”. -
\partCombineAutomatic
ends the functions of the commands above, and reverts back to the standard\partCombine
functionality.
instrumentOne = \relative c' { \partCombineApart c2^"apart" e | \partCombineAutomatic e2^"auto" e | \partCombineChords e'2^"chord" e | \partCombineAutomatic c2^"auto" c | \partCombineApart c2^"apart" \once \partCombineChords e^"chord once" | c2 c | } instrumentTwo = \relative { c'2 c | e2 e | a,2 c | c2 c' | c2 c | c2 c | } << \new Staff { \instrumentOne } \new Staff { \instrumentTwo } \new Staff { \partCombine \instrumentOne \instrumentTwo } >>
Using \partCombine
with lyrics
The \partCombine
command is not designed to work with
lyrics; if one of the voices is explicitly named in order to
attach lyrics to it, the partCombiner will stop working. However,
this effect can be achieved using a NullVoice
context. See
Polyphony with shared lyrics.
Selected Snippets
Combining two parts on the same staff
The part combiner tool ( \partCombine
command ) allows the
combination of several different parts on the same staff. Text
directions such as “solo” or “a2” are added by default; to remove
them, simply set the property printPartCombineTexts
to f
.
For vocal scores (hymns), there is no need to add “solo/a2” texts,
so they should be switched off. However, it might be better not to use
it if there are any solos, as they won’t be indicated. In such cases,
standard polyphonic notation may be preferable.
This snippet presents the three ways two parts can be printed on a same
staff: standard polyphony, \partCombine
without texts, and
\partCombine
with texts.
%% Combining pedal notes with clef changes musicUp = \relative c'' { \time 4/4 a4 c4.( g8) a4 | g4 e' g,( a8 b) | c b a2. } musicDown = \relative c'' { g4 e4.( d8) c4 | r2 g'4( f8 e) | d2 \stemDown a } \score { << \new Staff \with { instrumentName = "Standard polyphony" } << \musicUp \\ \musicDown >> \new Staff \with { instrumentName = "PartCombine without text" printPartCombineTexts = ##f } \partCombine \musicUp \musicDown \new Staff \with { instrumentName = "PartCombine with text" } \partCombine \musicUp \musicDown >> \layout { indent = 6.0\cm \context { \Score \override SystemStartBar.collapse-height = #30 } } }
Changing partcombine texts
When using the automatic part combining feature, the printed text for the solo and unison sections may be changed:
\new Staff << \set Staff.soloText = #"girl" \set Staff.soloIIText = #"boy" \set Staff.aDueText = #"together" \partCombine \relative c'' { g4 g r r a2 g } \relative c'' { r4 r a( b) a2 g } >>
See also
Notation Reference: Writing parts.
Snippets: Simultaneous notes.
Internals Reference: PartCombineMusic, Voice.
Known issues and warnings
All \partCombine…
functions can only accept two voices.
\partCombine…
functions cannot be placed inside a \tuplet
or \relative
block.
If printPartCombineTexts
is set and the two voices play the same
notes “on and off”, in the same measure, the part combiner may
typeset a2
more than once in that measure.
\partCombine
only knows when a note starts in a Voice
; it
cannot, for example, remember if a note in one Voice
has already
started when combining notes that have just started in the other
Voice
. This can lead to a number of unexpected issues including
“Solo” or “Unison” marks being printed incorrectly.
\partCombine
keeps all spanners (slurs, ties, hairpins, etc.) in
the same Voice
so that if any such spanners start or end in a
different Voice
, they may not be printed properly or at all.
If the \partCombine
function cannot combine both music
expressions (i.e., when both voices have different durations), it will
give the voices, internally, its own custom names: one
and
two
respectively. This means if there is any “switch” to a
differently named Voice
context, the events in that differently
named Voice
will be ignored.
Refer also to Known issues and warnings when using
\partCombine
with tablature in Default tablatures and the
Note in Automatic beams when using automatic beaming.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Automatic part combining ] | [ Up : Multiple voices ] | [ Staff notation > ] |
Writing music in parallel
Music for multiple parts can be interleaved in input code. The
function \parallelMusic
accepts a list with the names of a
number of variables to be created, and a musical expression. The
content of alternate measures from the expression become the value
of the respective variables, so you can use them afterwards to
print the music.
Note: Bar checks |
must be used, and the measures must
be of the same length.
\parallelMusic voiceA,voiceB,voiceC { % Bar 1 r8 g'16 c'' e'' g' c'' e'' r8 g'16 c'' e'' g' c'' e'' | r16 e'8.~ 4 r16 e'8.~ 4 | c'2 c'2 | % Bar 2 r8 a'16 d'' f'' a' d'' f'' r8 a'16 d'' f'' a' d'' f'' | r16 d'8.~ 4 r16 d'8.~ 4 | c'2 c'2 | } \new StaffGroup << \new Staff << \voiceA \\ \voiceB >> \new Staff { \clef bass \voiceC } >>
Relative mode may be used. Note that the \relative
command
is not used inside \parallelMusic
itself. The notes are
relative to the preceding note in the voice, not to the previous
note in the input – in other words, relative notes for
voiceA
ignore the notes in voiceB
.
\parallelMusic voiceA,voiceB,voiceC { % Bar 1 r8 g16 c e g, c e r8 g,16 c e g, c e | r16 e8.~ 4 r16 e8.~ 4 | c2 c | % Bar 2 r8 a,16 d f a, d f r8 a,16 d f a, d f | r16 d8.~ 4 r16 d8.~ 4 | c2 c | } \new StaffGroup << \new Staff << \relative c'' \voiceA \\ \relative c' \voiceB >> \new Staff \relative c' { \clef bass \voiceC } >>
This works quite well for piano music. This example maps four consecutive measures to four variables:
global = { \key g \major \time 2/4 } \parallelMusic voiceA,voiceB,voiceC,voiceD { % Bar 1 a8 b c d | d4 e | c16 d e fis d e fis g | a4 a | % Bar 2 e8 fis g a | fis4 g | e16 fis g a fis g a b | a4 a | % Bar 3 ... } \score { \new PianoStaff << \new Staff { \global << \relative c'' \voiceA \\ \relative c' \voiceB >> } \new Staff { \global \clef bass << \relative c \voiceC \\ \relative c \voiceD >> } >> }
See also
Learning Manual: Organizing pieces with variables.
Snippets: Simultaneous notes.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Writing music in parallel ] | [ Up : Musical notation ] | [ Displaying staves > ] |
1.6 Staff notation
This section explains how to influence the appearance of staves, how to print scores with more than one staff, and how to add tempo indications and cue notes to staves.
1.6.1 Displaying staves | ||
1.6.2 Modifying single staves | ||
1.6.3 Writing parts |
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Staff notation ] | [ Up : Staff notation ] | [ Instantiating new staves > ] |
1.6.1 Displaying staves
This section describes the different methods of creating and grouping staves.
Instantiating new staves | ||
Grouping staves | ||
Nested staff groups | ||
Separating systems |
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Displaying staves ] | [ Up : Displaying staves ] | [ Grouping staves > ] |
Instantiating new staves
Staves (singular: staff) are created with
the \new
or \context
commands. For details, see
Creating and referencing contexts.
The basic staff context is Staff
:
\new Staff \relative { c''4 d e f }
The DrumStaff
context creates a five-line staff set up for
a typical drum set. Each instrument is shown with a different
symbol. The instruments are entered in drum mode following a
\drummode
command, with each instrument specified by name.
For details, see Percussion staves.
\new DrumStaff { \drummode { cymc hh ss tomh } }
RhythmicStaff
creates a single-line staff that only
displays the rhythmic values of the input. Real durations are
preserved. For details, see Showing melody rhythms.
\new RhythmicStaff { c4 d e f }
TabStaff
creates a tablature with six strings in standard
guitar tuning. For details, see Default tablatures.
\new TabStaff \relative { c''4 d e f }
There are two staff contexts specific for the notation of ancient
music: MensuralStaff
and VaticanaStaff
. They are
described in Pre-defined contexts.
The GregorianTranscriptionStaff
context creates a staff to
notate modern Gregorian chant. It does not show bar lines.
\new GregorianTranscriptionStaff \relative { c''4 d e f e d }
New single staff contexts may be defined. For details, see Defining new contexts.
See also
Music Glossary: staff, staves.
Notation Reference: Creating and referencing contexts, Percussion staves, Showing melody rhythms, Default tablatures, Pre-defined contexts, Staff symbol, Gregorian chant contexts, Mensural contexts, Defining new contexts.
Snippets: Staff notation.
Internals Reference: Staff, DrumStaff, GregorianTranscriptionStaff, RhythmicStaff, TabStaff, MensuralStaff, VaticanaStaff, StaffSymbol.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Instantiating new staves ] | [ Up : Displaying staves ] | [ Nested staff groups > ] |
Grouping staves
Various contexts exist to group single staves together in order to form multi-staff systems. Each grouping context sets the style of the system start delimiter and the behavior of bar lines.
If no context is specified, the default properties will be used: the group is started with a vertical line, and the bar lines are not connected.
<< \new Staff \relative { c''1 c } \new Staff \relative { c''1 c } >>
In the StaffGroup
context, the group is started with a
bracket and bar lines are drawn through all the staves.
\new StaffGroup << \new Staff \relative { c''1 c } \new Staff \relative { c''1 c } >>
In a ChoirStaff
, the group starts with a bracket, but bar
lines are not connected.
\new ChoirStaff << \new Staff \relative { c''1 c } \new Staff \relative { c''1 c } >>
In a GrandStaff
, the group begins with a brace, and bar
lines are connected between the staves.
\new GrandStaff << \new Staff \relative { c''1 c } \new Staff \relative { c''1 c } >>
The PianoStaff
is identical to a GrandStaff
, except
that it supports printing the instrument name directly. For
details, see Instrument names.
\new PianoStaff \with { instrumentName = "Piano" } << \new Staff \relative { c''1 c } \new Staff \relative { \clef bass c1 c } >>
Each staff group context sets the property
systemStartDelimiter
to one of the following values:
SystemStartBar
, SystemStartBrace
, or
SystemStartBracket
. A fourth delimiter,
SystemStartSquare
, is also available, but it must be
explicitly specified.
New staff group contexts may be defined. For details, see Defining new contexts.
Selected Snippets
Use square bracket at the start of a staff group
The system start delimiter SystemStartSquare
can be used by
setting it explicitly in a StaffGroup
or ChoirStaff
context.
\score { \new StaffGroup { << \set StaffGroup.systemStartDelimiter = #'SystemStartSquare \new Staff { c'4 d' e' f' } \new Staff { c'4 d' e' f' } >> } }
Display bracket with only one staff in a system
If there is only one staff in one of the staff types ChoirStaff
or StaffGroup
, by default the bracket and the starting bar line
will not be displayed. This can be changed by overriding
collapse-height
to set its value to be less than the number of
staff lines in the staff.
Note that in contexts such as PianoStaff
and GrandStaff
where the systems begin with a brace instead of a bracket, another
property has to be set, as shown on the second system in the example.
\score { \new StaffGroup << % Must be lower than the actual number of staff lines \override StaffGroup.SystemStartBracket.collapse-height = #4 \override Score.SystemStartBar.collapse-height = #4 \new Staff { c'1 } >> } \score { \new PianoStaff << \override PianoStaff.SystemStartBrace.collapse-height = #4 \override Score.SystemStartBar.collapse-height = #4 \new Staff { c'1 } >> }
Mensurstriche layout (bar lines between the staves)
The mensurstriche-layout where the bar lines do not show on the staves
but between staves can be achieved with a StaffGroup
instead of
a ChoirStaff
. The bar line on staves is blanked out using
\hide
.
global = { \hide Staff.BarLine s1 s % the final bar line is not interrupted \undo \hide Staff.BarLine \bar "|." } \new StaffGroup \relative c'' { << \new Staff { << \global { c1 c } >> } \new Staff { << \global { c c } >> } >> }
See also
Music Glossary: brace, bracket, grand staff.
Notation Reference: Instrument names, Defining new contexts.
Snippets: Staff notation.
Internals Reference: Staff, StaffGroup, ChoirStaff, GrandStaff, PianoStaff, SystemStartBar, SystemStartBrace, SystemStartBracket, SystemStartSquare.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Grouping staves ] | [ Up : Displaying staves ] | [ Separating systems > ] |
Nested staff groups
Staff-group contexts can be nested to arbitrary depths. In this case, each child context creates a new bracket adjacent to the bracket of its parent group.
\new StaffGroup << \new Staff \relative { c''2 c | c2 c } \new StaffGroup << \new Staff \relative { g'2 g | g2 g } \new StaffGroup \with { systemStartDelimiter = #'SystemStartSquare } << \new Staff \relative { e'2 e | e2 e } \new Staff \relative { c'2 c | c2 c } >> >> >>
New nested staff group contexts can be defined. For details, see Defining new contexts.
Selected Snippets
Nesting staves
The property systemStartDelimiterHierarchy
can be used to make
more complex nested staff groups. The command
\set StaffGroup.systemStartDelimiterHierarchy
takes an
alphabetical list of the number of staves produced. Before each staff a
system start delimiter can be given. It has to be enclosed in brackets
and takes as much staves as the brackets enclose. Elements in the list
can be omitted, but the first bracket takes always the complete number
of staves. The possibilities are SystemStartBar
,
SystemStartBracket
, SystemStartBrace
, and
SystemStartSquare
.
\new StaffGroup \relative c'' << \override StaffGroup.SystemStartSquare.collapse-height = #4 \set StaffGroup.systemStartDelimiterHierarchy = #'(SystemStartSquare (SystemStartBrace (SystemStartBracket a (SystemStartSquare b) ) c ) d) \new Staff { c1 } \new Staff { c1 } \new Staff { c1 } \new Staff { c1 } \new Staff { c1 } >>
See also
Notation Reference: Grouping staves, Instrument names, Defining new contexts.
Snippets: Staff notation.
Internals Reference: StaffGroup, ChoirStaff, SystemStartBar, SystemStartBrace, SystemStartBracket, SystemStartSquare.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Nested staff groups ] | [ Up : Displaying staves ] | [ Modifying single staves > ] |
Separating systems
If the number of systems per page changes from page to page it is
customary to separate the systems by placing a system separator mark
between them. By default the system separator is blank, but can be
turned on with a \paper
option.
\book { \score { \new StaffGroup << \new Staff { \relative { c''4 c c c \break c4 c c c } } \new Staff { \relative { c''4 c c c \break c4 c c c } } >> } \paper { system-separator-markup = \slashSeparator % following commands are needed only to format this documentation paper-width = 100\mm paper-height = 100\mm tagline = ##f } }
See also
Notation Reference: Page layout.
Snippets: Staff notation.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Separating systems ] | [ Up : Staff notation ] | [ Staff symbol > ] |
1.6.2 Modifying single staves
This section explains how to change specific attributes of one staff: for example, modifying the number of staff lines or the staff size. Methods to start and stop staves and set ossia sections are also described.
Staff symbol | ||
Ossia staves | ||
Hiding staves |
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Modifying single staves ] | [ Up : Modifying single staves ] | [ Ossia staves > ] |
Staff symbol
The \stopStaff
and \startStaff
commands can be used to
stop or (re)start the staff lines respectively, from being printed at
any point witin a score.
\relative { \stopStaff f''4 d \startStaff g, e f'4 d \stopStaff g, e f'4 d \startStaff g, e }
Predefined commands
\startStaff
,
\stopStaff
.
The lines of a staff belong to the StaffSymbol
grob (including
ledger lines) and can be modified using StaffSymbol
properties, but
these modifications must be made before the staff is (re)started.
The number of staff lines can be altered:
\relative { f''4 d \stopStaff \override Staff.StaffSymbol.line-count = #2 \startStaff g, e | f'4 d \stopStaff \revert Staff.StaffSymbol.line-count \startStaff g, e | }
The position of each staff line can also be altered. A list of
numbers sets each line’s position. 0
corresponds to the normal
center line, and the normal line positions are
(-4 -2 0 2 4)
. A single staff line is
printed for every value entered so that the number of staff lines, as
well as their position, can be changed with a single override.
\relative { f''4 d \stopStaff \override Staff.StaffSymbol.line-positions = #'(1 3 5 -1 -3) \startStaff g, e | f'4 d \stopStaff \override Staff.StaffSymbol.line-positions = #'(8 6.5 -6 -8 -0.5) \startStaff g, e | }
To preserve typical stem directions (in the bottom half of the staff stems point up, in the top half they point down), align the center line (or space) of the customized staff with the position of the normal center line (0). The clef position and the position of middle C may need to be adjusted accordingly to fit the new lines. See Clef.
Staff line thickness can be altered. Ledger lines and note stems, by default, are also affected.
\new Staff \with { \override StaffSymbol.thickness = #3 } \relative { f''4 d g, e }
It is also possible to set ledger line thickness independently of staff lines.
\new Staff \with { \override StaffSymbol.thickness = #2 \override StaffSymbol.ledger-line-thickness = #'(0.5 . 0.4) } \relative { f'''4 a, a,, f }
The first value is multiplied by the staff line thickness, the second by the staff space and then the two values are added together to give the new thickness of the ledger line.
The vertical positions of ledger lines can be altered,
\new Staff \with { \override StaffSymbol.ledger-positions = #'(-3 -2 -1 2 5 6) } \relative { f'''4 a, a,, f }
Additional ledger lines can be made to appear above or below note heads depending on the current position relative to other note heads that also have their own ledger lines.
\new Staff \with { \override StaffSymbol.ledger-extra = #4 } \relative { f'''4 a, d, f, }
Ledger lines can also be made to appear inside the staff where custom
staff lines are required. The example shows the default position of
ledger lines when the explicit ledger-position
is and is not set.
The \stopStaff
is needed in the example to revert the
\override
for the whole StaffSymbol
.
\relative d' { \override Staff.StaffSymbol.line-positions = #'(-8 0 2 4) d4 e f g \stopStaff \startStaff \override Staff.StaffSymbol.ledger-positions = #'(-8 -6 (-4 -2) 0) d4 e f g }
The distance between staff lines can be altered. This affects ledger line spacing as well.
\new Staff \with { \override StaffSymbol.staff-space = #1.5 } \relative { f'''4 d, g, e, }
Selected Snippets
Making some staff lines thicker than the others
For educational purposes, a staff line can be thickened (e.g., the
middle line, or to emphasize the line of the G clef). This can be
achieved by adding extra lines very close to the line that should be
emphasized, using the line-positions
property of the
StaffSymbol
object.
{ \override Staff.StaffSymbol.line-positions = #'(-4 -2 -0.2 0 0.2 2 4) d'4 e' f' g' }
See also
Music Glossary: line, ledger line, staff.
Notation Reference: Clef.
Snippets: Staff notation.
Internals Reference: StaffSymbol, staff-symbol-interface.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Staff symbol ] | [ Up : Modifying single staves ] | [ Hiding staves > ] |
Ossia staves
Ossia staves can be set by creating a new simultaneous staff in the appropriate location:
\new Staff \relative { c''4 b d c << { c4 b d c } \new Staff { e4 d f e } >> c4 b c2 }
However, the above example is not what is usually desired. To create ossia staves that are above the original staff, have no time signature or clef, and have a smaller font size, tweaks must be used. The Learning Manual describes a specific technique to achieve this goal, beginning with Nesting music expressions.
The following example uses the alignAboveContext
property
to align the ossia staff. This method is most appropriate when
only a few ossia staves are needed.
\new Staff = "main" \relative { c''4 b d c << { c4 b d c } \new Staff \with { \remove "Time_signature_engraver" alignAboveContext = "main" \magnifyStaff #2/3 firstClef = ##f } { e4 d f e } >> c4 b c2 }
If many isolated ossia staves are needed, creating an empty
Staff
context with a specific context id may be more
appropriate; the ossia staves may then be created by
calling this context and using \startStaff
and
\stopStaff
at the desired locations. The benefits of this
method are more apparent if the piece is longer than the following
example.
<< \new Staff = "ossia" \with { \remove "Time_signature_engraver" \hide Clef \magnifyStaff #2/3 } { \stopStaff s1*6 } \new Staff \relative { c'4 b c2 << { e4 f e2 } \context Staff = "ossia" { \startStaff e4 g8 f e2 \stopStaff } >> g4 a g2 \break c4 b c2 << { g4 a g2 } \context Staff = "ossia" { \startStaff g4 e8 f g2 \stopStaff } >> e4 d c2 } >>
Using the \RemoveAllEmptyStaves
command to create ossia
staves may be used as an alternative. This method is most
convenient when ossia staves occur immediately following a line
break. For more information about
\RemoveAllEmptyStaves
, see Hiding staves.
<< \new Staff = "ossia" \with { \remove "Time_signature_engraver" \hide Clef \magnifyStaff #2/3 \RemoveAllEmptyStaves } \relative { R1*3 c''4 e8 d c2 } \new Staff \relative { c'4 b c2 e4 f e2 g4 a g2 \break c4 b c2 g4 a g2 e4 d c2 } >>
Selected Snippets
Vertically aligning ossias and lyrics
This snippet demonstrates the use of the context properties
alignBelowContext
and alignAboveContext
to control the
positioning of lyrics and ossias.
\paper { ragged-right = ##t } \relative c' << \new Staff = "1" { c4 c s2 } \new Staff = "2" { c4 c s2 } \new Staff = "3" { c4 c s2 } { \skip 2 << \lyrics { \set alignBelowContext = #"1" lyrics4 below } \new Staff \with { alignAboveContext = #"3" fontSize = #-2 \override StaffSymbol.staff-space = #(magstep -2) \remove "Time_signature_engraver" } { \tuplet 6/4 { \override TextScript.padding = #3 c8[^"ossia above" d e d e f] } } >> } >>
See also
Music Glossary: ossia, staff, Frenched staff.
Learning Manual: Nesting music expressions, Size of objects, Length and thickness of objects.
Notation Reference: Hiding staves.
Snippets: Staff notation.
Internals Reference: StaffSymbol.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Ossia staves ] | [ Up : Modifying single staves ] | [ Writing parts > ] |
Hiding staves
Staff lines can be hidden by removing the
Staff_symbol_engraver
from the Staff
context. As an
alternative, \stopStaff
may be used.
\new Staff \with { \remove "Staff_symbol_engraver" } \relative { a''8 f e16 d c b a2 }
Empty staves can be hidden (for a so-called ‘Frenched Score’)
by applying the \RemoveEmptyStaves
command on a context, which
can be done globally (in a \layout
block) as well as for
specific staves only (in a \with
block). This command removes
all empty staves in a score except for those in the first system. If
you want those in the first system to be hidden also, use
\RemoveAllEmptyStaves
.
\layout { \context { \Staff \RemoveEmptyStaves } } \relative << \new Staff { e'4 f g a \break b1 \break a4 b c2 } \new Staff { c,4 d e f \break R1 \break f4 g c,2 } >>
A staff is considered empty when it contains only multi-measure rests,
rests, skips, or a combination of these elements. All other musical
objects (that cause a staff not to be considered as empty) are listed in the
keepAliveInterfaces
context property, as initially set in the
‘ly/engraver-init.ly’ file.
\RemoveEmptyStaves
and \RemoveAllEmptyStaves
are
both predefined shortcuts that set such properties as
remove-empty
and remove-first
for the
VerticalAxisGroup
object, as explained in
Context modification identifiers.
The Keep_alive_together_engraver
allows groups of staves
to only be removed together and not individually. By default,
it is part of the PianoStaff
context: a piano part will
only be hidden when both of its staves are empty.
Similarly, a common engraving practice in orchestral
scores is to remove empty groups of staves rather than individual
staves; that can be achieved by adding the
Keep_alive_together_engraver
to the relevant staff-grouping
context, as explained Modifying context plug-ins (see
Grouping staves for the context names).
\layout { \context { \StaffGroup \RemoveEmptyStaves \consists "Keep_alive_together_engraver" } }
In the following example, staves devoted to wind instruments are removed in the second system; however, the double bass is not, because it is part of the larger group of fretted strings, which is playing.
The Keep_alive_together_engraver
internally uses the
remove-layer
property of a staff’s VerticalAxisGroup
to decide whether to print it or not when it is considered empty.
That property may also be set directly, in which case it acts as
a priority index: values closest to zero take precedence over
higher numbers, and thus staves whose remove-layer
is
higher will be masked in favor of staves of a lower number.
This is particularly useful for ‘divisi’ staves, where some individual parts (see Writing parts) occasionally need to be expanded to more than one staff. In the following example, two parts are routed to three staves; however, all three staves are never printed at the same time:
-
in the first systems, only a single one of them is shown, as the
keepAliveInterfaces
property has been set to an empty list – therefore the other two staves are considered empty and thus hidden, regardless of what they may contain; -
when that property gets unset (and thus reverts to its default
setting), it is no longer preventing the two other staves from being
printed; however, as their
remove-layer
setting is lower than the single staff’s, these two staves are now printed in its place.
Such substitutions are applied not just to notes, chords and other musical events that occur immediately after the new setting, but to the whole system where it takes place.
\layout { short-indent = 2\cm indent = 3\cm \context { \Staff keepAliveInterfaces = #'() } } violI = { \repeat unfold 24 { d'4 } \once \unset Staff.keepAliveInterfaces <d' g''>2 \repeat unfold 14 { d'4 } \bar "|." } violII = { \repeat unfold 24 { g4 } <g d'>2 \repeat unfold 14 { g4 } \bar "|." } \new StaffGroup \with { \consists "Keep_alive_together_engraver" } << \new Staff \with { instrumentName = "Violins" shortInstrumentName = "V I & II" \override VerticalAxisGroup.remove-layer = 2 } << \violI \\ \violII >> \new Staff \with { instrumentName = "Violin I" shortInstrumentName = "V I" \RemoveAllEmptyStaves \override VerticalAxisGroup.remove-layer = 1 } \violI \new Staff \with { instrumentName = "Violin II" shortInstrumentName = "V II" \RemoveAllEmptyStaves \override VerticalAxisGroup.remove-layer = 1 } \violII >>
\RemoveAllEmptyStaves
can also be used to create ossia
sections for a staff. For details, see Ossia staves.
Predefined commands
\RemoveEmptyStaves
,
\RemoveAllEmptyStaves
.
See also
Music Glossary: Frenched staff.
Learning Manual: Visibility and color of objects.
Notation Reference: Changing context default settings, Staff symbol, Ossia staves, Hidden notes, Invisible rests, Visibility of objects, Context modification identifiers, Grouping staves, Modifying context plug-ins.
Installed Files: ‘ly/engraver-init.ly’.
Snippets: Staff notation.
Internals Reference: ChordNames, FiguredBass, Lyrics, Staff, VerticalAxisGroup, Staff_symbol_engraver, Axis_group_engraver, Keep_alive_together_engraver.
Known issues and warnings
Removing Staff_symbol_engraver
also hides bar lines. If
bar line visibility is forced, formatting errors may occur. In
this case, use the following overrides instead of removing the
engraver:
\omit StaffSymbol \override NoteHead.no-ledgers = ##t
For the Known issues and warnings associated with
\RemoveEmptyStaves
see
Changing context default settings.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Hiding staves ] | [ Up : Staff notation ] | [ Instrument names > ] |
1.6.3 Writing parts
This section explains how to prepare parts for orchestral or ensemble music, which often requires to insert instrument names into the score. Methods to quote other voices and to format cue notes are also described, as well as a way to contract multiple consecutive empty measures in individual parts.
Aditionally, a method for printing divisi staves, sometimes used in individual or desk parts, can be found in Hiding staves.
Instrument names | ||
Quoting other voices | ||
Formatting cue notes | ||
Compressing empty measures |
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Writing parts ] | [ Up : Writing parts ] | [ Quoting other voices > ] |
Instrument names
Instrument names can be printed on the left side of staves in the
Staff
, PianoStaff
, StaffGroup
, GrandStaff
and ChoirStaff
contexts. The value of
instrumentName
is used for the first staff, and the value
of shortInstrumentName
is used for all succeeding staves.
\new Staff \with { instrumentName = "Violin " shortInstrumentName = "Vln. " } \relative { c'4.. g'16 c4.. g'16 \break | c1 | }
\markup
can be used to create more complex instrument names:
\new Staff \with { instrumentName = \markup { \column { "Clarinetti" \line { "in B" \smaller \flat } } } } \relative { c''4 c,16 d e f g2 }
When two or more staff contexts are grouped together, the instrument
names and short instrument names are centered by default. To center
multi-line instrument names, \center-column
must be used:
<< \new Staff \with { instrumentName = "Flute" } \relative { f''2 g4 f } \new Staff \with { instrumentName = \markup { \center-column { "Clarinet" \line { "in B" \smaller \flat } } } } \relative { c''4 b c2 } >>
However, if the instrument names are longer, the instrument names in a
staff group may not be centered unless the indent
and
short-indent
settings are increased. For details about these
settings, see \paper
variables for shifts and indents.
<< \new Staff \with { instrumentName = "Alto Flute in G" shortInstrumentName = "Flt." } \relative { f''2 g4 f \break g4 f g2 } \new Staff \with { instrumentName = "Clarinet" shortInstrumentName = "Clar." } \relative { c''4 b c2 \break c2 b4 c } >> \layout { indent = 3.0\cm short-indent = 1.5\cm }
To add instrument names to other contexts (such as ChordNames
or
FiguredBass
), Instrument_name_engraver
must be added to
that context. For details, see Modifying context plug-ins.
The shortInstrumentName
may be changed in the middle of a piece,
along with other settings as needed for the new instrument.
However, only the first instance of instrumentName
will be
printed and subsequent changes will be ignored:
prepPiccolo = <>^\markup \italic { muta in Piccolo } prepFlute = <>^\markup \italic { muta in Flauto } setPiccolo = { <>^\markup \bold { Piccolo } \transposition c'' } setFlute = { <>^\markup \bold { Flute } \transposition c' } \new Staff \with { instrumentName = "Flute" shortInstrumentName = "Flt." } \relative { g'1 g g g \break g1 g \prepPiccolo R R \break \set Staff.instrumentName = "Piccolo" \set Staff.shortInstrumentName = "Picc." \setPiccolo g1 g g g \break g1 g \prepFlute R R \break \set Staff.instrumentName = "Flute" \set Staff.shortInstrumentName = "Flt." \setFlute g1 g g g }
See also
Notation Reference:
\paper
variables for shifts and indents,
Modifying context plug-ins.
Snippets: Staff notation.
Internals Reference: InstrumentName, PianoStaff, Staff.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Instrument names ] | [ Up : Writing parts ] | [ Formatting cue notes > ] |
Quoting other voices
It is very common for one voice to use the same notes as those from another voice. For example, first and second violins playing the same phrase during a particular passage of the music. This is done by letting one voice quote the other, without having to re-enter the music all over again for the second voice.
The \addQuote
command, used in the top level scope, defines a
stream of music from which fragments can be quoted.
The \quoteDuring
command is used to indicate the point where the
quotation begins. It is followed by two arguments: the name of the
quoted voice, as defined with \addQuote
, and a music expression
for the duration of the quote.
fluteNotes = \relative { a'4 gis g gis | b4^"quoted" r8 ais\p a4( f) } oboeNotes = \relative { c''4 cis c b \quoteDuring "flute" { s1 } } \addQuote "flute" { \fluteNotes } \score { << \new Staff \with { instrumentName = "Flute" } \fluteNotes \new Staff \with { instrumentName = "Oboe" } \oboeNotes >> }
If the music expression used in \quoteDuring
contains notes
instead of spacer or multimeasure rests then the quote will appear as
polyphony and may produce unexpected results.
fluteNotes = \relative { a'4 gis g gis | b4^"quoted" r8 ais\p a4( f) } oboeNotes = \relative { c''4 cis c b \quoteDuring "flute" { e4 r8 ais b4 a } } \addQuote "flute" { \fluteNotes } \score { << \new Staff \with { instrumentName = "Flute" } \fluteNotes \new Staff \with { instrumentName = "Oboe" } \oboeNotes >> }
If an \unfoldRepeats
command in a music expression is required to
be printed when using \quoteDuring
, then it too must also contain
its own \unfoldRepeats
command;
fluteNotes = \relative { \repeat volta 2 { a'4 gis g gis } } oboeNotesDW = \relative { \repeat volta 2 \quoteDuring "incorrect" { s1 } } oboeNotesW = \relative { \repeat volta 2 \quoteDuring "correct" { s1 } } \addQuote "incorrect" { \fluteNotes } \addQuote "correct" { \unfoldRepeats \fluteNotes } \score { \unfoldRepeats << \new Staff \with { instrumentName = "Flute" } \fluteNotes \new Staff \with { instrumentName = "Oboe (incorrect)" } \oboeNotesDW \new Staff \with { instrumentName = "Oboe (correct)" } \oboeNotesW >> }
The \quoteDuring
command uses the \transposition
settings
of both quoted and quoting parts to produce notes for the quoting part
that have the same sounding pitch as those in the quoted part.
clarinetNotes = \relative c'' { \transposition bes \key d \major b4 ais a ais | cis4^"quoted" r8 bis\p b4( f) } oboeNotes = \relative { c''4 cis c b \quoteDuring "clarinet" { s1 } } \addQuote "clarinet" { \clarinetNotes } \score { << \new Staff \with { instrumentName = "Clarinet" } \clarinetNotes \new Staff \with { instrumentName = "Oboe" } \oboeNotes >> }
By default quoted music will include all articulations, dynamics,
markups, etc., in the quoted expression. It is possible to choose which
of these objects from the quoted music are displayed by using the
quotedEventTypes
context property.
fluteNotes = \relative { a'2 g2 | b4\<^"quoted" r8 ais a4\f( c->) } oboeNotes = \relative { c''2. b4 | \quoteDuring "flute" { s1 } } \addQuote "flute" { \fluteNotes } \score { << \set Score.quotedEventTypes = #'(note-event articulation-event crescendo-event rest-event slur-event dynamic-event) \new Staff \with { instrumentName = "Flute" } \fluteNotes \new Staff \with { instrumentName = "Oboe" } \oboeNotes >> }
Quotes can also be tagged, see Using tags.
See also
Notation Reference: Instrument transpositions, Using tags.
Installed Files: ‘scm/define-event-classes.scm’.
Snippets: Staff notation.
Internals Reference: Music classes, QuoteMusic, Voice.
Known issues and warnings
Only the contents of the first Voice
occurring in an
\addQuote
command will be considered for quotation, so if the music
expression contains \new
or \context Voice
statements, their contents will not be quoted. Quoting grace notes
is unsupported and may cause LilyPond to crash whereas quoting nested
triplets may result in poor notation.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Quoting other voices ] | [ Up : Writing parts ] | [ Compressing empty measures > ] |
Formatting cue notes
The simplest way to format cue notes is to explicitly create a
CueVoice
context within the part.
\relative { R1 << { e'2\rest r4. e8 } \new CueVoice { \stemUp d'8^"flute" c d e fis2 } >> d,4 r a r }
The \cueClef
command can also be used with an explict
CueVoice
context if a change of clef is required and will print
an appropriately sized clef for the cue notes. The \cueClefUnset
command can then be used to switch back to the original clef, again with
an appropriately sized clef.
\relative { \clef "bass" R1 << { e'2\rest r4. \cueClefUnset e,8 } \new CueVoice { \cueClef "treble" \stemUp d''8^"flute" c d e fis2 } >> d,,4 r a r }
The \cueClef
and \cueClefUnset
command can also be used
without a CueVoice
if required.
\relative { \clef "bass" R1 \cueClef "treble" d''8^"flute" c d e fis2 \cueClefUnset d,,4 r a r }
For more complex cue note placement, e.g including transposition, or
inserting cue notes from multiple music sources the \cueDuring
or
\cueDuringWithClef
commands can be used. These are more
specialized form of \quoteDuring
, see Quoting other voices
in the previous section.
The syntax is:
\cueDuring quotename #direction music
and
\cueDuringWithClef quotename #direction #clef music
The music from the corresponding measures of the quote name
is added as a CueVoice
context and occurs simultaneously with the
music
, which then creates a polyphonic situation. The
direction
takes the argument UP
or DOWN
, and
corresponds to the first and second voices respectively, determining how
the cue notes are printed in relation to the other voice.
fluteNotes = \relative { r2. c''4 | d8 c d e fis2 | g2 d | } oboeNotes = \relative c'' { R1 <>^\markup \tiny { flute } \cueDuring "flute" #UP { R1 } g2 c, } \addQuote "flute" { \fluteNotes } \new Staff { \oboeNotes }
It is possible to adjust which aspects of the music are quoted with
\cueDuring
by setting the quotedCueEventTypes
property. Its default value is '(note-event rest-event
tie-event beam-event tuplet-span-event)
, which means that only
notes, rests, ties, beams and tuplets are quoted, but not
articulations, dynamic marks, markup, etc.
Note: When a Voice
starts with cueDuring
, as in the
following example, the Voice
context must be explicitly declared,
or else the entire music expression would belong to the CueVoice
context.
oboeNotes = \relative { r2 r8 d''16(\f f e g f a) g8 g16 g g2. } \addQuote "oboe" { \oboeNotes } \new Voice \relative c'' { \set Score.quotedCueEventTypes = #'(note-event rest-event tie-event beam-event tuplet-span-event dynamic-event slur-event) \cueDuring "oboe" #UP { R1 } g2 c, }
Markup can be used to show the name of the quoted instrument. If the cue notes require a change in clef, this can be done manually but the original clef should also be restored manually at the end of the cue notes.
fluteNotes = \relative { r2. c''4 d8 c d e fis2 g2 d2 } bassoonNotes = \relative c { \clef bass R1 \clef treble <>^\markup \tiny { flute } \cueDuring "flute" #UP { R1 } \clef bass g4. b8 d2 } \addQuote "flute" { \fluteNotes } \new Staff { \bassoonNotes }
Alternatively, the \cueDuringWithClef
function can be used
instead. This command takes an extra argument to specify the change of
clef that needs to be printed for the cue notes but will automatically
print the original clef once the cue notes have finished.
fluteNotes = \relative { r2. c''4 d8 c d e fis2 g2 d2 } bassoonNotes = \relative c { \clef bass R1 <>^\markup { \tiny "flute" } \cueDuringWithClef "flute" #UP "treble" { R1 } g4. b8 d2 } \addQuote "flute" { \fluteNotes } \new Staff { \bassoonNotes }
Like \quoteDuring
, \cueDuring
takes instrument
transpositions into account. Cue notes are produced at the
pitches that would be written for the instrument receiving the cue
to produce the sounding pitches of the source instrument.
To transpose cue notes differently, use
\transposedCueDuring
. This command takes an extra argument
to specify (in absolute mode) the printed pitch that you want to
represent the sound of a concert middle C. This is useful for
taking cues from an instrument in a completely different register.
piccoloNotes = \relative { \clef "treble^8" R1 c'''8 c c e g2 c4 g g2 } bassClarinetNotes = \relative c' { \key d \major \transposition bes, d4 r a r \transposedCueDuring "piccolo" #UP d { R1 } d4 r a r } \addQuote "piccolo" { \piccoloNotes } << \new Staff \piccoloNotes \new Staff \bassClarinetNotes >>
The \killCues
command removes cue notes from a music
expression, so the same music expression can be used to produce
the instrument part with cues and the score. The \killCues
command removes only the notes and events that were quoted by
\cueDuring
. Other markup associated with cues, such as clef
changes and a label identifying the source instrument, can be
tagged for selective inclusion in the score; see Using tags.
fluteNotes = \relative { r2. c''4 d8 c d e fis2 g2 d2 } bassoonNotes = \relative c { \clef bass R1 \tag #'part { \clef treble <>^\markup \tiny { flute } } \cueDuring "flute" #UP { R1 } \tag #'part \clef bass g4. b8 d2 } \addQuote "flute" { \fluteNotes } \new Staff { \bassoonNotes } \new StaffGroup << \new Staff { \fluteNotes } \new Staff { \removeWithTag #'part { \killCues { \bassoonNotes } } } >>
See also
Notation Reference: Quoting other voices, Instrument transpositions, Instrument names, Clef, Musical cues, Using tags.
Snippets: Staff notation.
Internals Reference: CueVoice, Voice.
Known issues and warnings
Collisions can occur with rests, when using \cueDuring
,
between Voice
and CueVoice
contexts. When using
\cueDuringWithClef
or \transposedCueDuring
the extra
argument required for each case must come after the quote and the
direction.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Formatting cue notes ] | [ Up : Writing parts ] | [ Editorial annotations > ] |
Compressing empty measures
By default, all measures are printed even if they are empty – which can happen if a rhythmic event (such as notes, rests or invisible rests) is so long as to span several measures. This behaviour can be changed by contracting all empty measures into a single one, as illustrated here (the second part of this example, with expanded measures, actually reverts back to the default behavior):
\override Score.BarNumber.break-visibility = ##(#f #t #t) \time 2/4 \compressEmptyMeasures c'1 d'1. e'\breve \bar "||" \expandEmptyMeasures c'1 d'1. e'\breve
Although that notation is syntactically correct, it may be confusing from a musical point of view, as illustrated in the previous example; hence the need for measure numbers to be explicitly printed, using the syntax described in Using break-visibility.
Where such a notation may become more useful is when applied to Full measure rests. A multi-measure rest will then be shown as a single measure containing a multi-measure rest symbol, with the number of measures of rest printed above the measure:
% Default behavior \time 3/4 r2. | R2.*2 | \time 2/4 R2 | \time 4/4 % Rest measures contracted to single measure \compressEmptyMeasures r1 | R1*17 | R1*4 | \expandEmptyMeasures % Rest measures expanded again \time 3/4 R2.*2 |
Unlike \compressEmptyMeasures
, the music function
\compressMMRests
will only apply to rests, leaving
any other events uncompressed. As a function rather than
a property setting, its syntax differs slightly in that
it must be followed by a music expression:
\compressMMRests { % Rests are compressed… R1*7 % … but notes can still span multiple measures. g'1 a'1*2 d'1 R1*2 }
All of the commands described in this section actually
rely on the skipBars
internal property, which is
set in the Score
context as explained in
The \set
command.
Predefined commands
\compressEmptyMeasures
,
\expandEmptyMeasures
,
\compressMMRests
.
Selected Snippets
Numbering single measure rests
Multi measure rests show their length by a number except for single
measures. This can be changed by setting restNumberThreshold
.
{ \compressEmptyMeasures R1 R1*10 R1*11 \bar "||" \set restNumberThreshold = 0 R1 R1*10 R1*11 \bar "||" \set restNumberThreshold = 10 R1 R1*10 R1*11 }
Changing form of multi-measure rests
If there are ten or fewer measures of rests, a series of longa and
breve rests (called in German “Kirchenpausen” - church rests) is
printed within the staff; otherwise a simple line is shown. This
default number of ten may be changed by overriding the
expand-limit
property.
\relative c'' { \compressMMRests { R1*2 | R1*5 | R1*9 \override MultiMeasureRest.expand-limit = #3 R1*2 | R1*5 | R1*9 } }
See also
Notation Reference:
Using break-visibility,
Full measure rests,
The \set
command.
Internals Reference: MultiMeasureRest, MultiMeasureRestNumber, MultiMeasureRestScript, MultiMeasureRestText.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Compressing empty measures ] | [ Up : Musical notation ] | [ Inside the staff > ] |
1.7 Editorial annotations
This section discusses the various ways to change the appearance of notes and add analysis or educational emphasis.
1.7.1 Inside the staff | ||
1.7.2 Outside the staff |
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Editorial annotations ] | [ Up : Editorial annotations ] | [ Selecting notation font size > ] |
1.7.1 Inside the staff
This section discusses how to add emphasis to elements that are inside the staff.
Selecting notation font size | ||
Fingering instructions | ||
Gliding fingers | ||
Hidden notes | ||
Coloring objects | ||
Parentheses | ||
Stems |
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Inside the staff ] | [ Up : Inside the staff ] | [ Fingering instructions > ] |
Selecting notation font size
Note:
For font sizes of text, see Selecting font and font size.
For staff size, see Setting the staff size.
For cue notes, see Formatting cue notes.
For ossia staves, see Ossia staves.
To change the size of the notation without changing the staff
size, specify a magnification factor with the \magnifyMusic
command:
\new Staff << \new Voice \relative { \voiceOne <e' e'>4 <f f'>8. <g g'>16 <f f'>8 <e e'>4 r8 } \new Voice \relative { \voiceTwo \magnifyMusic 0.63 { \override Score.SpacingSpanner.spacing-increment = #(* 1.2 0.63) r32 c'' a c a c a c r c a c a c a c r c a c a c a c a c a c a c a c } } >>
The \override
in the example above is a bug workaround.
See the “Known issues and warnings” at the end of this section.
If a normal sized note head is merged with a smaller one, the size of the smaller note may need to be reset (with ‘\once \normalsize’) so that the stems and accidentals align properly:
\new Staff << \key fis \minor \mergeDifferentlyDottedOn \new Voice \relative { \voiceOne \magnifyMusic 0.63 { \override Score.SpacingSpanner.spacing-increment = #(* 1.2 0.63) \once \normalsize cis'32( cis' gis b a fis \once \normalsize d d' \once \normalsize cis, cis' gis b a gis \once \normalsize fis fis' \once \normalsize fis, fis' ais, cis b gis \once \normalsize eis eis' \once \normalsize a, a' bis, d cis b \once \normalsize gis gis') } } \new Voice \relative { \voiceTwo cis'8. d16 cis8. fis16 fis8. eis16 a8. gis16 } >>
The \magnifyMusic
command is not intended for cue notes,
grace notes, or ossia staves—there are more appropriate methods
of entering each of those constructs. Instead, it is useful when
the notation size changes in a single instrumental part on one
staff, and where grace notes are not appropriate, such as in
cadenza-like passages or in cases such as the above examples.
Setting the \magnifyMusic
value to 0.63 duplicates the
dimensions of the CueVoice
context.
Note: The magnifyMusic
command should not be
used when also resizing the staff. See Setting the staff size.
Resizing individual layout objects
An individual layout object can be resized by using the
\tweak
or \override
commands to adjust its
font-size
property:
\relative { % resize a note head <f' \tweak font-size -4 b e>-5 % resize a fingering bes-\tweak font-size 0 -3 % resize an accidental \once \override Accidental.font-size = -4 bes!-^ % resize an articulation \once \override Script.font-size = 4 bes!-^ }
The default font-size
value for each layout object is
listed in the Internals Reference. The font-size
property
can only be set for layout objects that support the
font-interface
layout interface. If font-size
is
not specified in the object’s ‘Standard settings’ list, its
value is 0. See
All layout objects.
Understanding the fontSize
property
The fontSize
context property adjusts the relative size of
all glyph-based notational elements in a context:
\relative { \time 3/4 d''4---5 c8( b a g) | \set fontSize = -6 e'4-- c!8-4( b a g) | \set fontSize = 0 fis4---3 e8( d) fis4 | g2. }
The fontSize
value is a number indicating the size relative
to the standard size for the current staff height. The default
fontSize
is 0; adding 6 to any fontSize
value
doubles the printed size of the glyphs, and subtracting 6 halves
the size. Each step increases the size by approximately 12%.
The scheme function magnification->font-size
is provided
for convenience since the logarithmic units of the
font-size
property are not entirely intuitive. For
example, to adjust the musical notation to 75% of the default
size, use:
\set fontSize = #(magnification->font-size 0.75)
The scheme function magstep
does the opposite: it converts
a font-size
value into a magnification factor.
The fontSize
property will only affect notational elements
that are drawn with glyphs, such as noteheads, accidentals,
scripts, etc. It will not affect the size of the staff itself,
nor will it scale stems, beams, or horizontal spacing. To scale
stems, beams, and horizontal spacing along with the notation size
(without changing the staff size), use the \magnifyMusic
command discussed above. To scale everything, including the staff
size, see Setting the staff size.
Whenever the fontSize
context property is set, its
value is added to the value of the font-size
grob
property for individual layout objects, before any glyphs are
printed. This can cause confusion when setting individual
font-size
properties while fontSize
is already set:
% the default font-size for NoteHead is 0 % the default font-size for Fingering is -5 c''4-3 \set fontSize = -3 % the effective font size for NoteHead is now -3 % the effective font size for Fingering is now -8 c''4-3 \override Fingering.font-size = 0 % the effective font size for Fingering is now -3 c''4-3
The following shorthand commands are also available:
Command | Equivalent to | Relative size |
\teeny | \set fontSize = -3 | 71% |
\tiny | \set fontSize = -2 | 79% |
\small | \set fontSize = -1 | 89% |
\normalsize | \set fontSize = 0 | 100% |
\large | \set fontSize = 1 | 112% |
\huge | \set fontSize = 2 | 126% |
\relative c'' { \teeny c4.-> d8---3 \tiny c4.-> d8---3 \small c4.-> d8---3 \normalsize c4.-> d8---3 \large c4.-> d8---3 \huge c4.-> d8---3 }
Font size changes are achieved by scaling the design size that is
closest to the desired size. The standard font size (for
font-size = 0
) depends on the standard staff height.
For a 20pt staff, an 11pt font is selected.
Predefined commands
\magnifyMusic
,
\teeny
,
\tiny
,
\small
,
\normalsize
,
\large
,
\huge
.
See also
Notation Reference: Selecting font and font size, Setting the staff size, Formatting cue notes, Ossia staves.
Installed Files: ‘ly/music-functions-init.ly’, ‘ly/property-init.ly’.
Snippets: Editorial annotations.
Internals Reference: font-interface.
Known issues and warnings
There are currently two bugs that are preventing proper horizontal
spacing when using \magnifyMusic
. There is only one
available workaround, and it is not guaranteed to work in every
case. In the example below, replace the mag variable with
your own value. You may also try removing one or both of the
\newSpacingSection
commands, and/or the \override
and \revert
commands:
\magnifyMusic mag { \newSpacingSection \override Score.SpacingSpanner.spacing-increment = #(* 1.2 mag) [music] \newSpacingSection \revert Score.SpacingSpanner.spacing-increment }
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Selecting notation font size ] | [ Up : Inside the staff ] | [ Gliding fingers > ] |
Fingering instructions
Fingering instructions can be entered using ‘note-digit’:
\relative { c''4-1 d-2 f-4 e-3 }
Markup texts or strings may be used for finger changes.
\relative { c''4-1 d-2 f\finger \markup \tied-lyric "4~3" c\finger "2 - 3" }
A thumb fingering can be added (e.g., cello music) to indicate that a note should be played with the thumb.
\relative { <a'_\thumb a'-3>2 <b_\thumb b'-3> }
Fingerings for chords can also be added to individual notes by adding them after the pitches.
\relative { <c''-1 e-2 g-3 b-5>2 <d-1 f-2 a-3 c-5> }
Fingering instructions may be manually placed above or below the staff, see Direction and placement.
Selected Snippets
Controlling the placement of chord fingerings
The placement of fingering numbers can be controlled precisely. For fingering orientation to apply, it must be used within a chord construct <>, even for single notes. Orientation for string numbers and right-hand fingerings may be set in a similar way.
\relative c' { \set fingeringOrientations = #'(left) <c-1 e-3 a-5>4 \set fingeringOrientations = #'(down) <c-1 e-3 a-5>4 \set fingeringOrientations = #'(down right up) <c-1 e-3 a-5>4 \set fingeringOrientations = #'(up) <c-1 e-3 a-5>4 \set fingeringOrientations = #'(left) <c-1>2 \set fingeringOrientations = #'(down) <e-3>2 \set stringNumberOrientations = #'(up left down) <f\3 a\2 c\1>1 \set strokeFingerOrientations = #'(down right up) <c\rightHandFinger #1 e\rightHandFinger #2 c'\rightHandFinger #4 > }
Allowing fingerings to be printed inside the staff
By default, vertically oriented fingerings are positioned outside the staff; that behavior, however, may be disabled. Attention needs to be paid to situations where fingerings and stems are in the same direction: by default, fingerings will avoid only beamed stems. That setting can be changed to avoid no stems or all stems; the following example demonstrates these two options, as well as how to go back to the default behavior.
\relative c' { <c-1 e-2 g-3 b-5>2 \override Fingering.staff-padding = #'() <c-1 e-2 g-3 b-5>4 g'-0 a8[-1 b]-2 g-0 r \override Fingering.add-stem-support = ##f a[-1 b]-2 g-0 r \override Fingering.add-stem-support = ##t a[-1 b]-2 g-0 r \override Fingering.add-stem-support = #only-if-beamed a[-1 b]-2 g-0 r }
See also
Notation Reference: Direction and placement.
Snippets: Editorial annotations.
Internals Reference: FingeringEvent, fingering-event, Fingering_engraver, New_fingering_engraver, Fingering.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Fingering instructions ] | [ Up : Inside the staff ] | [ Hidden notes > ] |
Gliding fingers
For stringed instruments a gliding finger is often indicated by a line
connecting the same finger to be used for notes played at different positions on
the same string.
This line is initiated with \\glide
entered before a Fingering
and
ends with the next occurence of the same finger.
The line may be printed in various styles.
mus = { \set fingeringOrientations = #'(right) <a'\glide-1>2. \set fingeringOrientations = #'(left) <d'-1>4 } { <>^"line" \mus <>^"stub-left" \override FingerGlideSpanner.style = #'stub-left \mus <>^"stub-right" \override FingerGlideSpanner.style = #'stub-right \mus <>^"stub-both" \override FingerGlideSpanner.style = #'stub-both \mus <>^"dashed-line" \override FingerGlideSpanner.style = #'dashed-line \mus \break <>^"dotted-line" \override FingerGlideSpanner.style = #'dotted-line \mus <>^"bow" \override FingerGlideSpanner.style = #'bow \mus <>^"trill" \override FingerGlideSpanner.style = #'trill \mus <>^"zigzag" \override FingerGlideSpanner.style = #'zigzag \mus }
If style
is set to 'bow
the direction of the bow may be adjusted
using direction modifiers.
{ \override FingerGlideSpanner.style = #'bow \set fingeringOrientations = #'(down) <b\glide-1>4 <d'-1> \set fingeringOrientations = #'(up) <e''\glide-2> <c''-2> \set fingeringOrientations = #'(down) <b^\glide-1>4 <d'-1> \set fingeringOrientations = #'(up) <e''^\glide-2> <c''-2> \set fingeringOrientations = #'(down) <b_\glide-1>4 <d'-1> \set fingeringOrientations = #'(up) <e''_\glide-2> <c''-2> }
If the Finger_glide_engraver
is moved to Staff
context
Fingering
grobs from different Voice
contexts may be connected.
\score { \new Staff << \new Voice { \voiceOne \set fingeringOrientations = #'(right) <e''-3>2 \set fingeringOrientations = #'(left) <d''-\tweak bound-details.left.padding #2.5 \glide-2> <c''-2> \bar "||" } \new Voice { \voiceTwo \set fingeringOrientations = #'(right) <c''\glide-2> \set fingeringOrientations = #'(left) <b'-\tweak bound-details.left.padding #2.5 \glide-4> <a'-4> } >> \layout { ragged-right = ##f \context { \Voice \remove "Finger_glide_engraver" } \context { \Staff \consists "Finger_glide_engraver" } } }
See also
Notation Reference: Direction and placement.
Internals Reference: FingeringGlideEvent, fingering-glide-event, Finger_glide_engraver, finger-glide-interface, FingerGlideSpanner.
Known issues and warnings
Multiple glides with the same finger are not supported and lead to
unexpected results.
A workaround is to use different fingers and to use \tweak text
.
{ \clef "G_8" <a\glide-1 cis'\glide-1>2 <bes-1 d'-1> <a\glide-1 cis'\glide-\tweak text "1"-2>2 <bes-1 d'-\tweak text "1"-2> }
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Gliding fingers ] | [ Up : Inside the staff ] | [ Coloring objects > ] |
Hidden notes
Hidden (or invisible or transparent) notes can be useful in preparing theory or composition exercises.
\relative { c''4 d \hideNotes e4 f \unHideNotes g a \hideNotes b \unHideNotes c }
Note heads, stems, and flags, and rests are invisible. Beams are invisible if they start on a hidden note. Objects that are attached to invisible notes are still visible.
\relative c'' { e8(\p f g a)-- \hideNotes e8(\p f g a)-- }
Predefined commands
\hideNotes
,
\unHideNotes
.
See also
Learning Manual: Visibility and color of objects.
Notation Reference: Invisible rests, Visibility of objects, Hiding staves.
Snippets: Editorial annotations.
Internals Reference: Note_spacing_engraver, NoteSpacing.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Hidden notes ] | [ Up : Inside the staff ] | [ Parentheses > ] |
Coloring objects
Individual objects may be assigned colors. Valid color names are listed in the List of colors.
\override NoteHead.color = #red c''4 c'' \override NoteHead.color = #(x11-color 'LimeGreen) d'' \override Stem.color = "deepskyblue" e''
In addition to a limited set of simple colors
available as predefined variables (see ‘Normal colors’ in
List of colors), any color may be entered as a string.
That string may be either a
CSS-style predefined color name,
or a hexadecimal color code prefixed by the #
character
(inside the double quotes):
\override NoteHead.color = "lightsalmon" \override Flag.color = "#E30074" \override Beam.color = "#5e45ad" \override Rest.color = "#3058" g'8 \huge r4 a'16 f'
The color code might include an alpha channel for semi-transparency, by using an eight-character code "#RRGGBBAA" or its shorthand form "#RGBA".
In a different way, the full range of colors
defined for X11
can be accessed by using the Scheme function x11-color
.
That function takes one argument, which can be a symbol, such as
'DarkSeaGreen4
, or a string, such as "DarkSeaGreen4"
.
The first form is quicker to write and slightly more efficient; however,
the second form also makes it possible to specify X11 colors as multiple
words: in this instance, "dark sea green 4"
.
If x11-color
cannot make sense of the parameter, then the
color returned defaults to black.
\new Staff \with { instrumentName = \markup { \with-color #(x11-color 'red) "Clarinet" } } \relative c'' { \override Staff.StaffSymbol.color = #(x11-color 'SlateBlue2) gis8 a \override Beam.color = #(x11-color "medium turquoise") gis a \override Accidental.color = #(x11-color 'DarkRed) gis a \override NoteHead.color = #(x11-color "LimeGreen") gis a % this is deliberate nonsense; note that the stems remain black \override Stem.color = #(x11-color 'Boggle) b2 cis }
Exact RGB colors can be specified using the Scheme function
rgb-color
. This function takes three arguments used
respectively for the red, green and blue
channels, and an optional alpha number for
semi-transparency. (All values must be numbers from 0 to 1.)
Semi-transparency is supported in SVG output, for PS and PDF output
it is only supported if Ghostscript 9.53+ is used. In the
following fragment the staff’s clef can be seen through if
rendered under the conditions mentioned above.
\new Staff \with { instrumentName = \markup { \with-color #(x11-color 'red) "Clarinet" } \override Clef.color = #(rgb-color 0 0 0 0.5) } \relative c'' { \override Staff.StaffSymbol.color = #(x11-color 'SlateBlue2) \override Stem.color = #(rgb-color 0 0 0) gis8 a \override Stem.color = #(rgb-color 1 1 1) gis8 a \override Stem.color = #(rgb-color 0 0 0.5) gis4 a }
See also
Notation Reference:
List of colors, The \tweak
command.
Snippets: Editorial annotations.
Known issues and warnings
An X11 color is not necessarily exactly the same shade as a similarly named normal color.
Not all X11 colors are distinguishable in a web browser, i.e.,
a web browser might not display a difference between LimeGreen
and ForestGreen
. For web use CSS colors are recommended,
as detailed in List of colors.
Notes in a chord cannot be separately colored with
\override
; use \tweak
or the equivalent
\single\override
before the respective note instead, see
The \tweak
command.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Coloring objects ] | [ Up : Inside the staff ] | [ Stems > ] |
Parentheses
Objects may be parenthesized by prefixing \parenthesize
to
the music event. When prefixed to a chord, it parenthesizes every
note. Individual notes inside a chord may also be parenthesized.
\relative { c''2 \parenthesize d c2 \parenthesize <c e g> c2 <c \parenthesize e g> }
Non-note objects may be parenthesized as well. For articulations,
a hyphen is needed before the \parenthesize
command.
\relative { c''2-\parenthesize -. d c2 \parenthesize r }
See also
Snippets: Editorial annotations.
Internals Reference: Parenthesis_engraver, ParenthesesItem, parentheses-interface.
Known issues and warnings
Parenthesizing a chord prints parentheses around each individual note, instead of a single large parenthesis around the entire chord.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Parentheses ] | [ Up : Inside the staff ] | [ Outside the staff > ] |
Stems
Whenever a note is found, a Stem
object is created
automatically. For whole notes and rests, they are also created but
made invisible.
Stems may be manually placed to point up or down; see Direction and placement.
Predefined commands
\stemUp
,
\stemDown
,
\stemNeutral
.
Selected Snippets
Default direction of stems on the center line of the staff
The default direction of stems on the center line of the staff is set
by the Stem
property neutral-direction
.
\relative c'' { a4 b c b \override Stem.neutral-direction = #up a4 b c b \override Stem.neutral-direction = #down a4 b c b }
Automatically changing the stem direction of the middle note based on the melody
LilyPond can alter the stem direction of the middle note on a staff so
that it follows the melody, by adding the Melody_engraver
to the
Voice
context.
The context property suspendMelodyDecisions
may be used to turn
off this behavior locally.
\relative c'' { \time 3/4 a8 b g f b g | \set suspendMelodyDecisions = ##t a b g f b g | \unset suspendMelodyDecisions c b d c b c | } \layout { \context { \Voice \consists "Melody_engraver" \autoBeamOff } }
See also
Notation Reference: Direction and placement.
Snippets: Editorial annotations.
Internals Reference: Stem_engraver, Stem, stem-interface.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Stems ] | [ Up : Editorial annotations ] | [ Note names > ] |
1.7.2 Outside the staff
This section discusses how to add emphasis to elements in the staff from outside of the staff.
Note names | ||
Balloon help | ||
Grid lines | ||
Analysis brackets |
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Outside the staff ] | [ Up : Outside the staff ] | [ Balloon help > ] |
Note names
Note names can be printed as text, by using the
NoteNames
context. When used simultaneously
with a regular staff, that makes it possible to
synchronize each note with its name, printed above
or below the Staff.
\language "italiano" melody = \relative do'' { fad2 si,8 dod re mi fad4. re8 fad2 } << \new NoteNames { \melody } \new Staff { \key si \minor \melody } \new NoteNames { \set printNotesLanguage = "deutsch" \set printAccidentalNames = ##f \melody } >>
By default, note names are printed in the same language
used for music entry; however, the printNotesLanguage
property allows to select any other language available (see
Note names in other languages). Whether accidentals
should be printed or not is determined through the
printAccidentalNames
property.
By setting both that property to a symbol and
printOctaveNames
to ##t
, note names can be
obtained that closely resemble LilyPond entry syntax.
If a more generalistic result is desired, ‘scientific’
octave names may also be obtained.
melody = \relative c'' { fis2 b,8 cis d e fis4. d8 fis2 } << \new NoteNames { \set printOctaveNames = ##t \set printAccidentalNames = #'lily \melody } \new Staff { \key b \minor \melody } \new NoteNames { \set printOctaveNames = #'scientific \melody } >>
The noteNameSeparator
property defines how chords
will be printed. Other formatting functions may be defined
as noteNameFunction
; such a function must expect
a pitch
and a context
argument, even if
one of these can then be ignored.
somechords = \relative c' { <b d fis>2 <b cis e g> <b d fis> q } << \new NoteNames { \set noteNameSeparator = "+" \somechords } \new Staff { \key b \minor \somechords } \new NoteNames { \set noteNameFunction = #(lambda (pitch ctx) (alteration->text-accidental-markup (ly:pitch-alteration pitch))) \somechords } >>
See also
Notation Reference: Note names in other languages.
Internals Reference: NoteName, NoteNames, Note_name_engraver.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Note names ] | [ Up : Outside the staff ] | [ Grid lines > ] |
Balloon help
Elements of notation can be marked and named with the help of a square balloon. The primary purpose of this feature is to explain notation.
\new Voice \with { \consists "Balloon_engraver" } \relative c'' { \balloonGrobText #'Stem #'(3 . 4) \markup { "I'm a Stem" } a8 \balloonGrobText #'Rest #'(-4 . -4) \markup { "I'm a rest" } r <c, g'-\balloonText #'(-2 . -2) \markup { "I'm a note head" } c>2. }
There are two music functions, balloonGrobText
and
balloonText
; the former is used like
\once \override
to attach text to any grob, and the
latter is used like \tweak
, typically within chords, to
attach text to an individual note.
Balloon text does not influence note spacing, but this can be altered:
\new Voice \with { \consists "Balloon_engraver" } \relative c'' { \balloonGrobText #'Stem #'(3 . 4) \markup { "I'm a Stem" } a8 \balloonGrobText #'Rest #'(-4 . -4) \markup { "I'm a rest" } r \balloonLengthOn <c, g'-\balloonText #'(-2 . -2) \markup { "I'm a note head" } c>2. }
Predefined commands
\balloonLengthOn
,
\balloonLengthOff
.
See also
Snippets: Editorial annotations.
Internals Reference: Balloon_engraver, BalloonTextItem, balloon-interface.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Balloon help ] | [ Up : Outside the staff ] | [ Analysis brackets > ] |
Grid lines
Vertical lines can be drawn between staves synchronized with the notes.
The Grid_point_engraver
must be used to create the end
points of the lines, while the Grid_line_span_engraver
must
be used to actually draw the lines. By default this centers grid
lines horizontally below and to the left side of each note head.
Grid lines extend from the middle lines of each staff. The
gridInterval
must specify the duration between the grid
lines.
\layout { \context { \Staff \consists "Grid_point_engraver" gridInterval = #(ly:make-moment 1/4) } \context { \Score \consists "Grid_line_span_engraver" } } \score { \new ChoirStaff << \new Staff \relative { \stemUp c''4. d8 e8 f g4 } \new Staff \relative { \clef bass \stemDown c4 g' f e } >> }
Selected Snippets
Grid lines: changing their appearance
The appearance of grid lines can be changed by overriding some of their properties.
\score { \new ChoirStaff << \new Staff { \relative c'' { \stemUp c'4. d8 e8 f g4 } } \new Staff { \relative c { % this moves them up one staff space from the default position \override Score.GridLine.extra-offset = #'(0.0 . 1.0) \stemDown \clef bass \once \override Score.GridLine.thickness = #5.0 c4 \once \override Score.GridLine.thickness = #1.0 g'4 \once \override Score.GridLine.thickness = #3.0 f4 \once \override Score.GridLine.thickness = #5.0 e4 } } >> \layout { \context { \Staff % set up grids \consists "Grid_point_engraver" % set the grid interval to one quarter note gridInterval = #(ly:make-moment 1/4) } \context { \Score \consists "Grid_line_span_engraver" % this moves them to the right half a staff space \override NoteColumn.X-offset = #-0.5 } } }
See also
Snippets: Editorial annotations.
Internals Reference: Grid_line_span_engraver, Grid_point_engraver, GridLine, GridPoint, grid-line-interface, grid-point-interface.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Grid lines ] | [ Up : Outside the staff ] | [ Text > ] |
Analysis brackets
Brackets are used in musical analysis to indicate structure in musical pieces. Simple horizontal brackets are supported.
\layout { \context { \Voice \consists "Horizontal_bracket_engraver" } } \relative { c''2\startGroup d\stopGroup }
Analysis brackets may be nested.
\layout { \context { \Voice \consists "Horizontal_bracket_engraver" } } \relative { c''4\startGroup\startGroup d4\stopGroup e4\startGroup d4\stopGroup\stopGroup }
Selected Snippets
Analysis brackets above the staff
Simple horizontal analysis brackets are added below the staff by default. The following example shows a way to place them above the staff instead.
\layout { \context { \Voice \consists "Horizontal_bracket_engraver" } } \relative c'' { \once \override HorizontalBracket.direction = #UP c2\startGroup d2\stopGroup }
Analysis brackets with labels
Text may be added to analysis brackets through the text
property
of the HorizontalBracketText
grob. Adding different texts to
brackets beginning at the same time requires the \tweak
command.
Bracket text will be parenthesized after a line break.
\layout { \context { \Voice \consists "Horizontal_bracket_engraver" \override HorizontalBracket.direction = #UP } } { \once\override HorizontalBracketText.text = "a" c''\startGroup d''\stopGroup \once\override HorizontalBracketText.text = "a'" e''\startGroup d''\stopGroup | c''-\tweak HorizontalBracketText.text \markup \bold \huge "b" \startGroup -\tweak HorizontalBracketText.text "a" \startGroup d''\stopGroup e''-\tweak HorizontalBracketText.text "a'" \startGroup d''\stopGroup\stopGroup | c''-\tweak HorizontalBracketText.text foo \startGroup d'' e'' f'' | \break g'' a'' b'' c'''\stopGroup }
See also
Internals Reference: Horizontal_bracket_engraver, HorizontalBracket, horizontal-bracket-interface, HorizontalBracketText, horizontal-bracket-text-interface, Staff.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Analysis brackets ] | [ Up : Musical notation ] | [ Writing text > ] |
1.8 Text
This section explains how to include text (with various formatting) in music scores.
1.8.1 Writing text | ||
1.8.2 Formatting text | ||
1.8.3 Fonts |
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Text ] | [ Up : Text ] | [ Text objects overview > ] |
1.8.1 Writing text
This section introduces different ways of adding text to a score.
Note: 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 Text encoding.
Text objects overview | ||
Text scripts | ||
Text spanners | ||
Text marks | ||
Separate text |
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Writing text ] | [ Up : Writing text ] | [ Text scripts > ] |
Text objects overview
Text objects are entered either as simple strings between
double quotes, or as \markup
blocks that can accept
a variety of advanced text formatting and graphical enhancements,
as detailed in Formatting text.
As such, markup blocks may be used:
-
in any
TextScript
object (attached to notes with-
,^
or_
); see Text scripts; - as ‘spanners’, when some indications are prolonged over several beats or bars; see Text spanners;
-
in any mark printed above the score, such as
RehearsalMark
orMetronomeMark
objects respectively introduced with the\mark
or\tempo
keywords; see Text marks; -
as standalone markup blocks, entered at the top level
outside of any
\score
block (in this specific case the\markup {...}
command is mandatory, and cannot be omitted in favor of a simple text string between double quotes); see Separate text; -
in any definition inside the
\header
block (e.g.,title
,subtitle
,composer
), or in specific elements defined inside the\paper
block such asevenHeaderMarkup
for page numbers. This is explained in Titles and headers.
Many other text-based objects may be entered as markup blocks, even if that is not their primary use.
-
Fingerings may easily be replaced with markup blocks, if
introduced with the
\finger
command; see Fingering instructions. -
Lyric syllables may be formatted through the
\markup
command; see Common notation for vocal music. - Chord names are in fact defined as markup blocks, and therefore may be redefined in the same way for customizing chord modifiers or chord exceptions; see Displaying chords.
-
Dynamics are usually entered in a simple way; however it is possible
to define New dynamic marks as markup objects. Some dynamics
such as crescendo are printed as spanners and may be redefined
through properties such as
crescendoText
; see Dynamics. - Less common objects are also made of markup blocks, such as Balloon help indications.
In fact, it is possible to use \markup
to customize the appearance of
virtually any graphical object (or ‘grob’), by overriding either its
text
property if it has one, or its stencil
property. Some of
the logic that makes this a possibility is explained in
Flexible architecture.
The following example illustrates the ubiquity of markup blocks, not only as some of the objects listed above, but also by replacing musical objects with text objects through various methods.
\header { title = \markup "Header" } dyn = #(make-dynamic-script #{ \markup \text "DynamicText" #}) \markup \box "Top-level markup" \score { << \new ChordNames \with { majorSevenSymbol = \markup "majorSevenSymbol" } \chordmode { c1:maj7 } \new Staff { \tempo \markup "MetronomeMark" \mark \markup \smaller "RehearsalMark" \once \override TupletNumber.text = \markup "TupletNumber" \tuplet 3/2 { \once \override NoteHead.stencil = #ly:text-interface::print \once \override NoteHead.text = \markup \lower #0.5 "NoteHead" c''8^\markup \italic "TextScript" a'\finger \markup \text "Fingering" \once \override Rest.stencil = #(lambda (grob) (grob-interpret-markup grob #{ \markup "Rest" #})) r } } \new Lyrics \lyricmode { \markup \smallCaps "LyricText" 1 } \new Dynamics { s1\dyn } >> }
See also
Notation Reference: Formatting text, Text scripts, Text spanners, Text marks, Separate text, Fingering instructions, Common notation for vocal music, Displaying chords, New dynamic marks, Dynamics, Balloon help.
Essay on automated music engraving: Flexible architecture.
Snippets: Text.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Text objects overview ] | [ Up : Writing text ] | [ Text spanners > ] |
Text scripts
Simple “quoted text” indications may be added to a score, as demonstrated in the following example. Such indications may be manually placed above or below the staff, using the syntax described in Direction and placement.
\relative { a'8^"pizz." g f e a4-"scherz." f }
This syntax is actually a shorthand; more complex text formatting may be
added to a note by explicitly using a \markup
block, as described
in Formatting text.
\relative { a'8^\markup { \italic pizz. } g f e a4_\markup { \tiny scherz. \bold molto } f }
By default, text indications do not influence the note spacing. However, their widths can be taken into account: in the following example, the first text string does not affect spacing, whereas the second one does.
\relative { a'8^"pizz." g f e \textLengthOn a4_"scherzando" f }
In addition to text scripts, articulations can be attached to notes. For more information, see Articulations and ornamentations.
For more information about the relative ordering of text scripts and articulations, see Placement of objects.
Predefined commands
\textLengthOn
,
\textLengthOff
.
See also
Learning Manual: Placement of objects.
Notation Reference: Formatting text, Direction and placement, Articulations and ornamentations.
Snippets: Text.
Internals Reference: TextScript.
Known issues and warnings
Checking to make sure that text scripts and lyrics are within the margins requires additional calculations. In cases where slightly faster performance is desired, use
\override Score.PaperColumn.keep-inside-line = ##f
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Text scripts ] | [ Up : Writing text ] | [ Text marks > ] |
Text spanners
Some performance indications, e.g., rallentando or accelerando, are written as text and are extended over multiple notes with dotted lines. Such objects, called “spanners”, may be created from one note to another using the following syntax:
\relative { \override TextSpanner.bound-details.left.text = "rit." b'1\startTextSpan e,\stopTextSpan }
The string to be printed is set through object properties. By default
it is printed in italic characters, but different formatting can be
obtained using \markup
blocks, as described in
Formatting text.
\relative { \override TextSpanner.bound-details.left.text = \markup { \upright "rit." } b'1\startTextSpan c e,\stopTextSpan }
The line style, as well as the text string, can be defined as an object property. This syntax is described in Line styles.
Predefined commands
\textSpannerUp
,
\textSpannerDown
,
\textSpannerNeutral
.
Known issues and warnings
LilyPond is only able to handle one text spanner per voice.
Selected Snippets
Dynamics text spanner postfix
Custom text spanners can be defined and used with hairpin and text
crescendos. \<
and \>
produce hairpins by default,
\cresc
etc. produce text spanners by default.
% Some sample text dynamic spanners, to be used as postfix operators crpoco = #(make-music 'CrescendoEvent 'span-direction START 'span-type 'text 'span-text "cresc. poco a poco") \relative c' { c4\cresc d4 e4 f4 | g4 a4\! b4\crpoco c4 | c4 d4 e4 f4 | g4 a4\! b4\< c4 | g4\dim a4 b4\decresc c4\! }
Dynamics custom text spanner postfix
Postfix functions for custom crescendo text spanners. The spanners
should start on the first note of the measure. One has to use
-\mycresc
, otherwise the spanner start will rather be assigned
to the next note.
% Two functions for (de)crescendo spanners where you can explicitly % give the spanner text. mycresc = #(define-music-function (mymarkup) (markup?) (make-music 'CrescendoEvent 'span-direction START 'span-type 'text 'span-text mymarkup)) mydecresc = #(define-music-function (mymarkup) (markup?) (make-music 'DecrescendoEvent 'span-direction START 'span-type 'text 'span-text mymarkup)) \relative c' { c4-\mycresc "custom cresc" c4 c4 c4 | c4 c4 c4 c4 | c4-\mydecresc "custom decresc" c4 c4 c4 | c4 c4\! c4 c4 }
See also
Notation Reference: Line styles, Dynamics, Formatting text.
Snippets: Text, Expressive marks.
Internals Reference: TextSpanner.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Text spanners ] | [ Up : Writing text ] | [ Separate text > ] |
Text marks
Various text elements may be added to a score using the syntax described in Rehearsal marks:
\relative { \mark "Verse" c'2 g' \bar "||" \mark "Chorus" g2 c, \bar "|." }
This syntax makes it possible to put any text on a bar line;
more complex text formatting may be added using a \markup
block, as described in Formatting text:
\relative { <c' e>1 \mark \markup { \italic { colla parte } } <d f>2 <e g> <c f aes>1 }
This syntax also allows to print special signs, like coda, segno or fermata, by specifying the appropriate symbol name as explained in Music notation inside markup:
\relative { <bes' f>2 <aes d> \mark \markup { \musicglyph "scripts.ufermata" } <e g>1 }
Such objects are only typeset above the top staff of the score; depending on whether they are specified at the end or the middle of a bar, they can be placed above the bar line or between notes. When specified at a line break, the mark will be printed at the beginning of the next line.
\relative c'' { \mark "Allegro" c1 c \mark "assai" \break c c }
Predefined commands
\markLengthOn
,
\markLengthOff
.
Selected Snippets
Printing marks at the end of a line
Marks can be printed at the end of the current line, instead of the beginning of the following line. In such cases, it might be preferable to align the right end of the mark with the bar line.
\relative c'' { g2 c d,2 a' \once \override Score.RehearsalMark.break-visibility = #end-of-line-visible \once \override Score.RehearsalMark.self-alignment-X = #RIGHT \mark "D.C. al Fine" \break g2 b, c1 \bar "||" }
Printing marks on every staff
Although text marks are normally only printed above the topmost staff, they may also be printed on every staff.
\score { << \new Staff { c''1 \mark "molto" c'' } \new Staff { c'1 \mark "molto" c' } >> \layout { \context { \Score \remove "Mark_engraver" \remove "Staff_collecting_engraver" } \context { \Staff \consists "Mark_engraver" \consists "Staff_collecting_engraver" } } }
See also
Notation Reference: Rehearsal marks, Formatting text, Music notation inside markup, The Emmentaler font.
Snippets: Text.
Internals Reference: MarkEvent, Mark_engraver, RehearsalMark.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Text marks ] | [ Up : Writing text ] | [ Formatting text > ] |
Separate text
A \markup
block can exist by itself, outside of any
\score
block, as a “top-level expression”. This syntax
is described in File structure.
\markup { Tomorrow, and tomorrow, and tomorrow... }
This allows printing text separately from the music, which is particularly useful when the input file contains several music pieces, as described in Multiple scores in a book.
\score { c'1 } \markup { Tomorrow, and tomorrow, and tomorrow... } \score { c'1 }
Separate text blocks can be spread over multiple pages, making it possible to print text documents or books entirely within LilyPond. This feature, and the specific syntax it requires, are described in Multi-page markup.
Predefined commands
\markup
,
\markuplist
.
Selected Snippets
Stand-alone two-column markup
Stand-alone text may be arranged in several columns using
\markup
commands:
\markup { \fill-line { \hspace #1 \column { \line { O sacrum convivium } \line { in quo Christus sumitur, } \line { recolitur memoria passionis ejus, } \line { mens impletur gratia, } \line { futurae gloriae nobis pignus datur. } \line { Amen. } } \hspace #2 \column \italic { \line { O sacred feast } \line { in which Christ is received, } \line { the memory of His Passion is renewed, } \line { the mind is filled with grace, } \line { and a pledge of future glory is given to us. } \line { Amen. } } \hspace #1 } }
See also
Notation Reference: Formatting text, File structure, Multiple scores in a book, Multi-page markup.
Snippets: Text.
Internals Reference: TextScript.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Separate text ] | [ Up : Text ] | [ Text markup introduction > ] |
1.8.2 Formatting text
This section presents basic and advanced text formatting,
using the \markup
mode specific syntax.
Text markup introduction | ||
Selecting font and font size | ||
Text alignment | ||
Graphic notation inside markup | ||
Music notation inside markup | ||
Multi-page markup |
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Formatting text ] | [ Up : Formatting text ] | [ Selecting font and font size > ] |
Text markup introduction
A \markup
block is used to typeset text with an extensible
syntax called “markup mode”. Such blocks may be used anywhere,
as explained in Text objects overview.
The markup syntax is similar to LilyPond’s usual syntax: a
\markup
expression is enclosed in curly braces
{… }
. A single word is regarded as a minimal expression,
and therefore does not need to be enclosed with braces.
Unlike simple “quoted text” indications, \markup
blocks may
contain nested expressions or markup commands, entered using the
backslash \
character. Such commands only affect the first
following expression.
\relative { a'1-\markup intenso a2^\markup { poco \italic più forte } c e1 d2_\markup { \italic "string. assai" } e b1^\markup { \bold { molto \italic agitato } } c }
A \markup
block may also contain quoted text strings. Such
strings are treated as minimal text expressions, and therefore any
markup command or special character (such as \
and #
)
will be printed verbatim without affecting the formatting of the text.
Double quotation marks themselves may be printed by preceding them
with backslashes.
\relative { a'1^"\italic markup..." a_\markup { \italic "... prints \"italic\" letters!" } a a }
To be treated as a distinct expression, a list of words needs to be
enclosed with double quotes or preceded by a command. The way markup
expressions are defined affects how these expressions will be stacked,
centered and aligned; in the following example, the second
\markup
expression is treated the same as the first one:
\relative c'' { c1^\markup { \center-column { a bbb c } } c1^\markup { \center-column { a { bbb c } } } c1^\markup { \center-column { a \line { bbb c } } } c1^\markup { \center-column { a "bbb c" } } }
Markups can be stored in variables. Such variables may be directly attached to notes:
allegro = \markup { \bold \large Allegro } { d''8.^\allegro d'16 d'4 r2 }
An exhaustive list of \markup
-specific commands can be found in
Text markup commands.
The inner workings of these commands, and how to implement new ones, is
explained in
Markup functions.
See also
Notation Reference: Text objects overview, Text markup commands.
Extending LilyPond: Markup functions.
Snippets: Text.
Installed Files: ‘scm/markup.scm’.
Known issues and warnings
Syntax error messages for markup mode can be confusing.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Text markup introduction ] | [ Up : Formatting text ] | [ Text alignment > ] |
Selecting font and font size
Basic font switching is supported in markup mode:
\relative { d''1^\markup { \bold { Più mosso } \italic { non troppo \underline Vivo } } r2 r4 r8 d,_\markup { \italic quasi \smallCaps Tromba } f1 d2 r }
The font size can be altered, relative to the global staff size, in a number of different ways.
It can be set to predefined size.
\relative b' { b1_\markup { \huge Sinfonia } b1^\markup { \teeny da } b1-\markup { \normalsize camera } }
It can be set relative to its previous value.
\relative b' { b1_\markup { \larger Sinfonia } b1^\markup { \smaller da } b1-\markup { \magnify #0.6 camera } }
It can be increased or decreased relative to the value set by the global staff size.
\relative b' { b1_\markup { \fontsize #-2 Sinfonia } b1^\markup { \fontsize #1 da } b1-\markup { \fontsize #3 camera } }
It can also be set to a fixed point-size, regardless of the global staff size.
\relative b' { b1_\markup { \abs-fontsize #20 Sinfonia } b1^\markup { \abs-fontsize #8 da } b1-\markup { \abs-fontsize #14 camera } }
If the text includes spaces, then it is best to put it all inside quote marks, so that the size of each space is appropriate for the size of the other characters.
\markup \fontsize #6 \bold { Sinfonia da camera } \markup \fontsize #6 \bold { "Sinfonia da camera" }
Text may be printed as subscript or superscript. By default these are printed in a smaller size, but a normal size can be used as well:
\markup { \column { \line { 1 \super st movement } \line { 1 \normal-size-super st movement \sub { (part two) } } } }
The markup mode provides an easy way to select alternate font families. The default serif font, of roman type, is automatically selected unless specified otherwise; on the last line of the following example, there is no difference between the first and the second word.
\markup { \column { \line { Act \number 1 } \line { \sans { Scene I. } } \line { \typewriter { Verona. An open place. } } \line { Enter \roman Valentine and Proteus. } } }
Some of these font families, used for specific items such as numbers or dynamics, do not provide all characters, as mentioned in New dynamic marks and Manual repeat marks.
When used inside a word, some font-switching or formatting commands may produce an unwanted blank space. This can easily be solved by concatenating the text elements together:
\markup { \column { \line { \concat { 1 \super st } movement } \line { \concat { \dynamic p , } \italic { con dolce espressione } } } }
An exhaustive list of font switching commands and custom font usage commands can be found in Font.
Defining custom font sets is also possible, as explained in Fonts.
Predefined commands
\teeny
,
\tiny
,
\small
,
\normalsize
,
\large
,
\huge
,
\smaller
,
\larger
.
See also
Notation Reference: Font, New dynamic marks, Manual repeat marks, Fonts.
Installed Files: ‘scm/define-markup-commands.scm’.
Snippets: Text.
Internals Reference: TextScript.
Known issues and warnings
Using the font sizing commands \teeny
, \tiny
,
\small
, \normalsize
, \large
, and
\huge
will lead to inconsistent line spacing compared to
using \fontsize
.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Selecting font and font size ] | [ Up : Formatting text ] | [ Graphic notation inside markup > ] |
Text alignment
This subsection discusses how to place text in markup mode. Markup objects can also be moved as a whole, using the syntax described in Moving objects.
Markup objects may be aligned in different ways. By default, a text indication is aligned on its left edge: in the following example, there is no difference between the first and the second markup. That example also demonstrates various syntactically correct ways of placing the alignment commands:
\relative { d''1-\markup { poco } f d-\markup { \left-align poco } f d-\markup { \center-align { poco } } f d-\markup \right-align { poco } }
Horizontal alignment may be fine-tuned using a numeric value:
\relative { a'1-\markup { \halign #-1 poco } e' a,-\markup { \halign #0 poco } e' a,-\markup { \halign #0.5 poco } e' a,-\markup { \halign #2 poco } }
Lastly, words and any other objects may be moved by preceding them with padding. Negative padding is also supported, and will move any objects that follow in the opposite direction. Although padding is normally invisible, in the following example some commands have been added to make it appear more clearly:
\relative { d''1-\markup { poco } f d-\markup { \with-color #darkred \box \hspace #4 poco } f d-\markup { \with-color #darkred \box \hspace #-4 poco } f d-\markup { \with-color #darkred \box \hspace #10 poco } }
Some objects may have alignment procedures of their own, and therefore are not affected by these commands. It is possible to move such markup objects as a whole, as shown for instance in Text marks.
Vertical alignment can be set in a similar way. As stated above, markup objects can be moved as a whole; however, it is also possible to move specific elements inside a markup block.
\relative { d'2^\markup { Acte I \raise #2 { Scène 1 } } a' g_\markup { \lower #4 \bold { Très modéré } } a d,^\markup \raise #4 \italic { Une forêt. } a'4 a g2 a }
Some commands can affect both the horizontal and vertical alignment of text objects in markup mode:
\relative { d'2^\markup { Acte I \translate #'(-1 . 2) "Scène 1" } a' g_\markup { \general-align #Y #3.2 \bold "Très modéré" } a d,^\markup \translate-scaled #'(-1 . 2) \teeny { "Une forêt." } a'4 a g2 a }
Here again, padding (either positive or negative) is a convenient way of positioning objects vertically, when inserted into markup columns:
\relative { d'2^\markup { Acte I \column { \with-color #darkred \box \vspace #-1 "Scène 1" } } a' g_\markup \column { \with-color #darkred \box \vspace #1 "Très modéré" } a d,^\markup \column { "Une forêt." \with-color #darkred \box \vspace #2 } a'4 a g2 a }
A markup object may include several lines of text. In the following example, each element or expression is placed on its own line, either left-aligned or centered:
\markup { \column { a "b c" \line { d e f } } \hspace #10 \center-column { a "b c" \line { d e f } } }
Similarly, a list of elements or expressions may be spread to fill the entire horizontal line width (if there is only one element, it will be centered on the page). These expressions can, in turn, include multi-line text or any other markup expression:
\markup { \fill-line { \line { William S. Gilbert } \center-column { \huge \smallCaps "The Mikado" or \smallCaps "The Town of Titipu" } \line { Sir Arthur Sullivan } } } \markup { \fill-line { 1885 } }
Elements may be spread to fill any specified width by overriding
the line-width
property. By default it is set to
#f
which indicates the entire line:
\markup { \column { \fill-line { left center right } \null \override #'(line-width . 30) \fill-line { left center right } } }
Long text indications can also be automatically wrapped accordingly to the given line width. These will be either left-aligned or justified, as shown in the following example.
\markup { \column { \line \smallCaps { La vida breve } \line \bold { Acto I } \wordwrap \italic { (La escena representa el corral de una casa de gitanos en el Albaicín de Granada. Al fondo una puerta por la que se ve el negro interior de una Fragua, iluminado por los rojos resplandores del fuego.) } \hspace #0 \line \bold { Acto II } \override #'(line-width . 50) \justify \italic { (Calle de Granada. Fachada de la casa de Carmela y su hermano Manuel con grandes ventanas abiertas a través de las que se ve el patio donde se celebra una alegre fiesta) } } }
An exhaustive list of text alignment commands can be found in Align.
See also
Learning Manual: Moving objects.
Notation Reference: Align, Text marks.
Installed Files: ‘scm/define-markup-commands.scm’.
Snippets: Text.
Internals Reference: TextScript.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Text alignment ] | [ Up : Formatting text ] | [ Music notation inside markup > ] |
Graphic notation inside markup
Various graphic objects may be added to a score, using markup commands.
Some markup commands allow decoration of text elements with graphics, as demonstrated in the following example.
\markup \fill-line { \center-column { \circle Jack \box "in the box" \null \line { Erik Satie \hspace #3 \bracket "1866 - 1925" } \null \rounded-box \bold Prelude } }
Some commands may require an increase in the padding around the text; this is achieved with some markup commands exhaustively described in Align.
\markup \fill-line { \center-column { \box "Charles Ives (1874 - 1954)" \null \box \pad-markup #2 "THE UNANSWERED QUESTION" \box \pad-x #8 "A Cosmic Landscape" \null } } \markup \column { \line { \hspace #10 \box \pad-to-box #'(-5 . 20) #'(0 . 5) \bold "Largo to Presto" } \box \pad-around #3 "String quartet keeps very even time." }
Other graphic elements or symbols may be printed without requiring any text. As with any markup expression, such objects can be combined.
\markup { \combine \draw-circle #4 #0.4 ##f \filled-box #'(-4 . 4) #'(-0.5 . 0.5) #1 \hspace #5 \center-column { \triangle ##t \combine \draw-line #'(0 . 4) \arrow-head #Y #DOWN ##f } }
Advanced graphic features include the ability to include external image files converted to the Encapsulated PostScript format (eps), or to directly embed graphics into the input file, using native PostScript code. In such a case, it may be useful to explicitly specify the size of the drawing, as demonstrated below:
c'1^\markup { \combine \epsfile #X #10 "./context-example.eps" \with-dimensions #'(0 . 6) #'(0 . 10) \postscript " -2 3 translate 2.7 2 scale newpath 2 -1 moveto 4 -2 4 1 1 arct 4 2 3 3 1 arct 0 4 0 3 1 arct 0 0 1 -1 1 arct closepath stroke" } c'
An exhaustive list of graphics-specific commands can be found in Graphic.
See also
Notation Reference: Align, Dimensions, Editorial annotations, Graphic.
Installed Files: ‘scm/define-markup-commands.scm’, ‘scm/stencil.scm’.
Snippets: Text.
Internals Reference: TextScript.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Graphic notation inside markup ] | [ Up : Formatting text ] | [ Multi-page markup > ] |
Music notation inside markup
Various musical notation elements may be added to a score, inside a markup object.
Notes and accidentals can be entered using markup commands:
a'2 a'^\markup { \note {4} #1 = \note-by-number #1 #1 #1.5 } b'1_\markup { \natural \semiflat \flat \sesquiflat \doubleflat } \glissando a'1_\markup { \natural \semisharp \sharp \sesquisharp \doublesharp } \glissando b'
Other notation objects may also be printed in markup mode:
\relative { g1 bes ees\finger \markup \tied-lyric "4~1" fis_\markup { \dynamic rf } bes^\markup { \beam #8 #0.1 #0.5 } cis d-\markup { \markalphabet #8 \markletter #8 } }
More generally, any available musical symbol may be included separately in a markup object, as demonstrated below; an exhaustive list of these symbols and their names can be found in The Emmentaler font.
\relative { c''2 c'^\markup { \musicglyph "eight" } c,4 c,8._\markup { \musicglyph "clefs.G_change" } c16 c2^\markup { \musicglyph "timesig.neomensural94" } }
Another way of printing non-text glyphs is described in Music fonts. This is useful for printing braces of various sizes.
The markup mode also supports diagrams for specific instruments:
\relative { c''1^\markup { \fret-diagram-terse "x;x;o;2;3;2;" } c^\markup { \harp-pedal "^-v|--ov^" } c c^\markup { \combine \musicglyph "accordion.discant" \combine \raise #0.5 \musicglyph "accordion.dot" \raise #1.5 \musicglyph "accordion.dot" } }
Such diagrams are documented in Instrument Specific Markup.
A whole score can even be nested inside a markup object:
\relative { c'4 d^\markup { \score { \relative { c'4 d e f } } } e f | c d e f }
An exhaustive list of music notation related commands can be found in Music.
See also
Notation Reference: Music, The Emmentaler font, Music fonts.
Installed Files: ‘scm/define-markup-commands.scm’, ‘scm/fret-diagrams.scm’, ‘scm/harp-pedals.scm’.
Snippets: Text.
Internals Reference: TextScript.
Known issues and warnings
Vertical spacing of a \score
inside a markup object is controlled
by baseline-skip
. Any \paper
settings are ignored.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Music notation inside markup ] | [ Up : Formatting text ] | [ Fonts > ] |
Multi-page markup
Although standard markup objects are not breakable, a specific syntax makes it possible to enter lines of text that can spread over multiple pages:
\markuplist { \justified-lines { A very long text of justified lines. ... } \wordwrap-lines { Another very long paragraph. ... } ... }
This syntax accepts a list of markups, that can be
- the result of a markup list command,
- a list of markups,
- a list of markup lists.
An exhaustive list of markup list commands can be found in Text markup list commands.
See also
Notation Reference: Text markup list commands.
Extending LilyPond: New markup list command definition.
Installed Files: ‘scm/define-markup-commands.scm’.
Snippets: Text.
Internals Reference: TextScript.
Predefined commands
\markuplist
.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Multi-page markup ] | [ Up : Text ] | [ Finding fonts > ] |
1.8.3 Fonts
Fonts in LilyPond are handled by several libraries; two of them are of relevance to the user: FontConfig is used to detect available fonts, and selected fonts are then rendered by Pango to display text strings.
This section shows how to access fonts in LilyPond, and how to change them in scores.
Finding fonts | ||
Font families | ||
Font features | ||
Single entry fonts | ||
Entire document fonts | ||
Music fonts |
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Fonts ] | [ Up : Fonts ] | [ Font families > ] |
Finding fonts
In addition to any font already installed on the operating system, more fonts may be added to the ones detected by FontConfig (and thus available in LilyPond scores) by the following commands:
#(ly:font-config-add-font "path/to/font-file") #(ly:font-config-add-directory "path/to/directory/")
Both commands accept either absolute or relative paths, which makes it possible to compile a score on any system by simply distributing the relevant font files together with the LilyPond input files.
To verify that the desired fonts are found by FontConfig, use the
command #(ly:font-config-display-fonts)
, which prints the
complete list of available fonts to the console log. It also
shows the actual font names to be used with LilyPond; these may
differ from the file names themselves.
See section Single entry fonts, and Entire document fonts, how to access fonts in general.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Finding fonts ] | [ Up : Fonts ] | [ Font features > ] |
Font families
Three generic aliases for text font families1 are available: ‘roman’ (serif), ‘sans’, and ‘typewriter’. Depending on the backend, these families get mapped to different font family aliases.
For the svg
backend:
generic family
SVG font family
roman
serif
sans
sans-serif
typewriter
monospace
‘serif’, ‘sans-serif’, and ‘monospace’ are ‘generic-family’ in SVG and CSS specifications.
For other backends:
generic family
default font family alias
font families contained in alias
roman
LilyPond Serif
C059, Century SchoolBook URW, Century Schoolbook L, TeX Gyre Schola, DejaVu Serif, …, serif
sans
LilyPond Sans Serif
Nimbus Sans, Nimbus Sans L, TeX Gyre Heros, DejaVu Sans, …, sans-serif
typewriter
LilyPond Monospace
Nimbus Mono PS, Nimbus Mono, Nimbus Mono L, TeX Gyre Cursor, DejaVu Sans Mono, …, monospace
If a character does not exist in the appropriate font of the first listed family, the appropriate font of the next listed family gets used instead for that character.
Note that the URW font families distributed with LilyPond (‘C059’, ‘Nimbus Sans’, and ‘Nimbus Mono PS’) have a peculiarity: By default, in addition to the standard ligatures like ‘fl’ or ‘ffi’, they substitute the string ‘Nr.’ with the Numero Sign (U+2116) if the ‘latn’ script is selected. To circumvent this locally, insert a zero-width non-joiner character (ZWNJ, U+200C) between the ‘N’ and ‘r’ characters. To circumvent this globally, use the following code to make LilyPond always insert a ZWNJ character.
\paper { #(add-text-replacements! `(("Nr." . ,(format #f "N~ar." (ly:wide-char->utf-8 #x200C))))) }
‘LilyPond Serif’, ‘LilyPond Sans Serif’, and ‘LilyPond Monospace’ are font family aliases defined in the additional FontConfig configuration file ‘00-lilypond-fonts.conf’, which can be usually found in directory ‘/usr/local/share/lilypond/2.23.2/fonts’, and which is used exclusively by LilyPond.
Each font family may include different shapes and series. The
following example demonstrates that, including code to also change
the size. The value supplied to font-size
is taken
relative to the default font size.
\override Score.RehearsalMark.font-family = #'typewriter \mark \markup "Ouverture" \override Voice.TextScript.font-shape = #'italic \override Voice.TextScript.font-series = #'bold d''2.^\markup "Allegro" \override Voice.TextScript.font-size = #-3 c''4^"smaller"
A similar syntax may be used in markup mode; however, in most cases it is preferable to use the simpler syntax explained in Selecting font and font size:
\markup { \column { \line { \override #'((font-shape . italic) (font-size . 4)) Idomeneo, } \line { \override #'(font-family . typewriter) { \override #'(font-series . bold) re di } \override #'(font-family . sans) Creta } } }
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Font families ] | [ Up : Fonts ] | [ Single entry fonts > ] |
Font features
When using OpenType fonts, font features can be used.2 Note that not all OpenType fonts have all features. If you request a feature that does not exist in the chosen font, the feature is simply ignored. The example below uses the font ‘TeX Gyre Schola’ (this is, the roman style of the family).
\markup { \override #'(font-name . "TeX Gyre Schola") normal style: Hello HELLO } \markup { \override #'(font-name . "TeX Gyre Schola") \caps { small caps: Hello } } \markup { \override #'(font-name . "TeX Gyre Schola") \override #'(font-features . ("smcp")) { true small caps: Hello } } \markup { \override #'(font-name . "TeX Gyre Schola") normal number style: 0123456789 } \markup { \override #'(font-name . "TeX Gyre Schola") \override #'(font-features . ("onum")) { old number style: 0123456789 } } \markup { \override #'(font-name . "TeX Gyre Schola") \override #'(font-features . ("salt 0")) { stylistic alternate 0: εφπρθ } } \markup { \override #'(font-name . "TeX Gyre Schola") \override #'(font-features . ("salt 1")) { stylistic alternate 1: εφπρθ } } \markup { \override #'(font-name . "TeX Gyre Schola") \override #'(font-features . ("onum" "smcp" "salt 1")) { multiple features: Hello 0123456789 εφπρθ } }
For the full OpenType font feature list see https://www.microsoft.com/typography/otspec/featurelist.htm; for identifying features of OpenType fonts see http://lists.gnu.org/archive/html/lilypond-devel/2017-08/msg00004.html.
Although it is easy to switch between preconfigured fonts, it is also possible to use other fonts. For more information, see section Single entry fonts, and Entire document fonts.
See also
Notation Reference: The Emmentaler font, Music notation inside markup, Rotating objects, Selecting font and font size, Font.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Font features ] | [ Up : Fonts ] | [ Entire document fonts > ] |
Single entry fonts
Almost all outline fonts installed on the operating system and recognized by FontConfig may be used in a score, with the exception of bitmap fonts (which are not supported by design) and OpenType Variation Fonts (which are not supported yet).
LilyPond calls function pango_font_description_from_string
from the Pango library to access fonts; it uses the following
syntax form for font names.3
[family-list] [style-options]
where family-list is a comma-separated list of families optionally terminated by a comma, and style-options a whitespace-separated list of words where each word describes one of style, variant, weight, stretch, or gravity.
The following words are understood as styles: Normal
(the
default), Roman
, Oblique
, Italic
.
The following words are understood as variants:
Small-Caps
. Default is no variant.
The following words are understood as weights: Thin
,
Ultra-Light
, Extra-Light
, Light
,
Semi-Light
, Demi-Light
, Book
, Regular
(the default), Medium
, Semi-Bold
, Demi-Bold
,
Bold
, Ultra-Bold
, Extra-Bold
, Heavy
,
Black
, Ultra-Black
, Extra-Black
.
The following words are understood as stretch values:
Ultra-Condensed
, Extra-Condensed
, Condensed
,
Semi-Condensed
, Semi-Expanded
, Expanded
,
Extra-Expanded
, Ultra-Expanded
. Default is no
stretch.
The following words are understood as gravity values:
Not-Rotated
, South
, Upside-Down
,
North
, Rotated-Left
, East
,
Rotated-Right
, West
. Default is no gravity.
Assuming the syntax is correct, setting a font name never fails. If none of the font families are known (or no font family is given), FontConfig returns a default font depending on the operating system. If none of the style options are known (or no style option is given), default values are used.
In the following example, the font for the time signature is set to ‘Bitstream Charter’. Since no style option is given, FontConfig uses default values as specified above. For the markup string, the list of font families is set to ‘Bitstream Vera Sans’ and ‘sans-serif’, which tells FontConfig to try ‘Bitstream Vera Sans’ first; if it is not available, it tries the generic font family ‘sans-serif’ as described in Font families. The style for the markup is set to ‘Oblique Bold’, which makes FontConfig try to find a font that is both oblique and bold. If that fails, it tries to find an oblique or bold font. If that fails again, it tries to match a font with default style options.
Note that FontConfig also checks whether the requested glyph is actually present in the font. In case it is missing, another font gets tried (following the above algorithm) until the glyph is eventually found. Only if FontConfig fails to find any font with the appropriate glyph a symbol for a missing glyph is shown (which is normally a rectangular box or simply some whitespace).
\override Staff.TimeSignature.font-name = "Bitstream Charter" \override Staff.TimeSignature.font-size = #2 \time 3/4 a'1_\markup { \override #'(font-name . "Bitstream Vera Sans, sans-serif, Oblique Bold") { Vera Oblique Bold } }
Note: If any of the above style options is part of the font
(family) name you must use a trailing comma after the name
even if you do not select a style option. A typical example is
‘Times New Roman’: If specified as "Times New Roman"
,
FontConfig searches for a font ‘Times New’ in roman style. Only
if you say "Times New Roman,"
this font is really
accessed.
Running lilypond
on the command line with the following
option displays a list of all available fonts on the operating
system:
lilypond -dshow-available-fonts
See also
Notation Reference: Finding fonts, Font families, Entire document fonts.
Snippets: Text.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Single entry fonts ] | [ Up : Fonts ] | [ Music fonts > ] |
Entire document fonts
It is possible to change the fonts used in LilyPond’s default font
families by calling the function make-pango-font-tree
. The
arguments are substitutions for the ‘roman’, ‘sans’ and
‘typewriter’ font families (in that order), followed by a
scaling factor. Similar to single fonts (see section Single entry fonts), font families are set up by using comma-separated lists
of font family names, but without style options.4
Note that make-pango-font-tree
resets the notation fonts to
‘emmentaler’ as the default.
The example below adjusts the font size in relation to the global staff size.
\paper { #(define fonts (make-pango-font-tree "Linux Libertine O" "Nimbus Sans, Nimbus Sans L" "DejaVu Sans Mono" (/ staff-height pt 20))) } \relative c'{ c1-\markup { roman, \sans sans, \typewriter typewriter. } }
LilyPond provides an alternative, more flexible interface to set
global font families. It allows you to change only specific font
family names, leaving others set to default values. The following
example has the same effect as the above
make-pango-font-tree
example; the syntax for font family
names is identical. If you do not change the staff size from the
default of 20pt, the line containing the #:factor
keyword is unnecessary.
\paper { #(define fonts (set-global-fonts #:roman "Linux Libertine O" #:sans "Nimbus Sans, Nimbus Sans L" #:typewriter "DejaVu Sans Mono" ; unnecessary if the staff size is default #:factor (/ staff-height pt 20) )) }
Additionally, set-global-fonts
can also set the music
notation fonts. The following example has the same effect as the
previous examples, because it uses the default notation fonts.
For more information, see Replacing the notation font.
\paper { #(define fonts (set-global-fonts #:music "emmentaler" ; default #:brace "emmentaler" ; default #:roman "Linux Libertine O" #:sans "Nimbus Sans, Nimbus Sans L" #:typewriter "DejaVu Sans Mono" ; unnecessary if the staff size is default #:factor (/ staff-height pt 20) )) }
Note that each call to set-global-fonts
completely resets
both the main notation and text fonts.5 If
any font category is left unspecified, the respective default font
(family) gets used for that category. Each call of
set-global-fonts
affects all \book
blocks that
follow it. If there are multiple \book
blocks and you want
to use different fonts for each, simply call
set-global-fonts
again, like this:
\paper { #(define fonts (set-global-fonts … )) } \book { … } \paper { #(define fonts (set-global-fonts … )) } \book { … }
See also
Notation Reference: Finding fonts, Font families, Single entry fonts, Selecting font and font size, Font, Replacing the notation font.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Entire document fonts ] | [ Up : Fonts ] | [ Specialist notation > ] |
Music fonts
LilyPond neither uses FontConfig nor Pango for accessing music notation fonts but handles them by itself. As a consequence, the interface is different. This section describes how to insert music symbols into markup strings.
Music notation fonts are a collection of specific glyphs that can be accessed with several encodings. The following syntax allows LilyPond’s various Emmentaler glyphs6 to be used directly in markup mode:
a'1^\markup { \vcenter { \override #'(font-encoding . fetaBraces) \lookup "brace120" \override #'(font-encoding . fetaText) \column { 1 3 sf } \override #'(font-encoding . fetaMusic) \lookup "noteheads.s0petrucci" } }
However, all these glyphs except the braces of various sizes are available using the simpler syntax described in Music notation inside markup.
When accessing braces with the ‘fetaBraces’ encoding, the size of the brace is specified by the numerical part of the glyph name, in arbitrary units. Any integer from 0 to 575 inclusive may be specified, with 0 giving the smallest brace. The optimum value must be determined by trial and error. These glyphs are all left braces; right braces may be obtained by rotation, see section Rotating objects.
[ << Musical notation ] | [Top][Contents][Index] | [ General input and output >> ] |
[ < Music fonts ] | [ Up : Top ] | [ Vocal music > ] |
2. Specialist notation
This chapter explains how to create musical notation for specific types of instrument or in specific styles.
Orchestral and ensemble music is not addressed in a separate section; however, several notions commonly useful in orchestral scores are found in References for opera and stage musicals.
[ << Specialist notation ] | [Top][Contents][Index] | [ General input and output >> ] |
[ < Specialist notation ] | [ Up : Specialist notation ] | [ Common notation for vocal music > ] |
2.1 Vocal music
This section explains how to typeset vocal music, and make sure that the lyrics will be aligned with the notes of their melody.
2.1.1 Common notation for vocal music | ||
2.1.2 Techniques specific to lyrics | ||
2.1.3 Stanzas | ||
2.1.4 Songs | ||
2.1.5 Choral | ||
2.1.6 Opera and stage musicals | ||
2.1.7 Chants psalms and hymns | ||
2.1.8 Ancient vocal music | ||
[ << Specialist notation ] | [Top][Contents][Index] | [ General input and output >> ] |
[ < Vocal music ] | [ Up : Vocal music ] | [ References for vocal music > ] |
2.1.1 Common notation for vocal music
This section discusses issues common to most types of vocal music.
[ << Specialist notation ] | [Top][Contents][Index] | [ General input and output >> ] |
[ < Common notation for vocal music ] | [ Up : Common notation for vocal music ] | [ Entering lyrics > ] |
References for vocal music
This section indicates where to find details of notation issues that may arise in any type of vocal music.
- Most styles of vocal music use written text as lyrics. An introduction to this notation is to be found in Setting simple songs.
-
Vocal music is likely to require the use of
markup
mode, either for lyrics or for other text elements (characters’ names, etc.). This syntax is described in Text markup introduction. - Ambitus may be added at the beginning of vocal staves, as explained in Ambitus.
- Dynamic markings by default are placed below the staff, but in choral music they are usually placed above the staff in order to avoid the lyrics, as explained in Score layouts for choral.
See also
Music Glossary: ambitus.
Learning Manual: Setting simple songs.
Notation Reference: Text markup introduction, Ambitus, Score layouts for choral.
Snippets: Vocal music.
[ << Specialist notation ] | [Top][Contents][Index] | [ General input and output >> ] |
[ < References for vocal music ] | [ Up : Common notation for vocal music ] | [ Aligning lyrics to a melody > ] |
Entering lyrics
Lyrics are entered in a special input mode, which can be introduced
by the keyword \lyricmode
, or by using \addlyrics
or
\lyricsto
. In this special input mode, the input d
is not parsed as the pitch D, but rather as a one-letter
syllable of text. In other words, syllables are entered like notes
but with pitches replaced by text.
For example:
\lyricmode { Three4 blind mice,2 three4 blind mice2 }
There are two main methods for specifying the horizontal placement
of the syllables, either by specifying the duration of each syllable
explicitly, as in the example above, or by leaving the lyrics to be
aligned automatically to a melody or other voice of music, using
\addlyrics
or \lyricsto
. The former method is
described below in Manual syllable durations. The latter
method is described in Automatic syllable durations.
A word or syllable of lyrics begins with an alphabetic character (plus some other characters, see below) and is terminated by any white space or a digit. Later characters in the syllable can be any character that is not a digit or white space.
Because any character that is not a digit or white space is regarded
as part of the syllable, a word is valid even if it ends with
}
, which often leads to the following mistake:
\lyricmode { lah lah lah}
In this example, the }
is included in the final syllable, so the
opening brace is not balanced and the input file will probably not
compile. Instead, braces should always be surrounded with white space:
\lyricmode { lah lah lah }
Punctuation, lyrics with accented characters, characters from non-English languages, or special characters (such as the heart symbol or slanted quotes), may simply be inserted directly into the input file, providing it is saved with UTF-8 encoding. For more information, see Special characters.
\relative { d''8 c16 a bes8 f ees' d c4 } \addlyrics { „Schad’ um das schö -- ne grü -- ne Band, }
Normal quotes may be used in lyrics, but they have to be preceded with a backslash character and the whole syllable has to be enclosed between additional quotes. For example,
\relative { \time 3/4 e'4 e4. e8 d4 e d c2. } \addlyrics { "\"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 is one that begins with an
alphabetic character, _
, ?
, !
, :
,
'
, the control characters ^A
through ^F
,
^Q
through ^W
, ^Y
, ^^
, any 8-bit
character with an ASCII code over 127, or a two-character
combination of a backslash followed by one of `
, '
,
"
, or ^
.
Great control over the appearance of lyrics comes from using
\markup
inside the lyrics themselves. For explanation of many
options, see Formatting text.
Selected Snippets
Formatting lyrics syllables
Markup mode may be used to format individual syllables in lyrics.
mel = \relative c'' { c4 c c c } lyr = \lyricmode { Lyrics \markup { \italic can } \markup { \with-color #red contain } \markup { \fontsize #8 \bold Markup! } } << \new Voice = melody \mel \new Lyrics \lyricsto melody \lyr >>
See also
Learning Manual: Songs.
Notation Reference: Automatic syllable durations, Fonts, Formatting text, Input modes, Manual syllable durations, Special characters.
Internals Reference: LyricText.
Snippets: Text.
[ << Specialist notation ] | [Top][Contents][Index] | [ General input and output >> ] |
[ < Entering lyrics ] | [ Up : Common notation for vocal music ] | [ Automatic syllable durations > ] |
Aligning lyrics to a melody
Lyrics are interpreted in \lyricmode
and printed in a
Lyrics
context, see Contexts explained.
\new Lyrics \lyricmode { … }
Two variants of \lyricmode
additionally set an associated
context used to synchronise the lyric syllables to music. The more
convenient \addlyrics
immediately follows the musical content
of the Voice context with which it should be synchronised, implicitly
creating a Lyrics context of its own. The more versatile
\lyricsto
requires both specifying the associated Voice context
by name and explicitly creating a containing Lyrics context. For
details see Automatic syllable durations.
Lyrics can be aligned with melodies in two main ways:
-
Lyrics can be aligned automatically, with the durations of the
syllables being taken from another voice of music or (in special
circumstances) an associated melody, using
\addlyrics
,\lyricsto
, or by setting theassociatedVoice
property. For more details, see Automatic syllable durations.<< \new Staff << \time 2/4 \new Voice = "one" \relative { \voiceOne c''4 b8. a16 g4. r8 a4 ( b ) c2 } \new Voice = "two" \relative { \voiceTwo s2 s4. f'8 e4 d c2 } >> % takes durations and alignment from notes in "one" \new Lyrics \lyricsto "one" { Life is __ _ love, live __ life. } % takes durations and alignment from notes in "one" initially % then switches to "two" \new Lyrics \lyricsto "one" { No more let \set associatedVoice = "two" % must be set one syllable early sins and sor -- rows grow. } >>
The first stanza shows the normal way of entering lyrics.
The second stanza shows how the voice from which the lyric durations are taken can be changed. This is useful if the words to different stanzas fit the notes in different ways and all the durations are available in Voice contexts. For more details, see Stanzas.
-
Lyrics can be aligned independently of the duration of any notes
if the durations of the syllables are specified explicitly,
and entered with
\lyricmode
.<< \new Voice = "one" \relative { \time 2/4 c''4 b8. a16 g4. f8 e4 d c2 } % uses previous explicit duration of 2; \new Lyrics \lyricmode { Joy to the earth! } % explicit durations, set to a different rhythm \new Lyrics \lyricmode { Life4 is love,2. live4 life.2 } >>
The first stanza is not aligned with the notes because the durations were not specified, and the previous value of 2 is used for each word.
The second stanza shows how the words can be aligned quite independently from the notes. This is useful if the words to different stanzas fit the notes in different ways and the required durations are not available in a music context. For more details see Manual syllable durations. This technique is also useful when setting dialogue over music; for examples showing this, see Dialogue over music.
See also
Learning Manual: Aligning lyrics to a melody.
Notation Reference: Contexts explained, Automatic syllable durations, Stanzas, Manual syllable durations, Dialogue over music, Manual syllable durations.
Internals Reference: Lyrics.
[ << Specialist notation ] | [Top][Contents][Index] | [ General input and output >> ] |
[ < Aligning lyrics to a melody ] | [ Up : Common notation for vocal music ] | [ Manual syllable durations > ] |
Automatic syllable durations
Lyrics can be automatically aligned to the notes of a melody in three ways:
-
by specifying the named Voice context containing the melody with
\lyricsto
, -
by introducing the lyrics with
\addlyrics
and placing them immediately after the Voice context containing the melody, -
by setting the
associatedVoice
property, the alignment of the lyrics may be switched to a different named Voice context at any musical moment.
In all three methods hyphens can be drawn between the syllables of a word and extender lines can be drawn beyond the end of a word. For details, see Extenders and hyphens.
The Voice
context containing the melody to which the lyrics
are being aligned must not have “died”, or the lyrics after that
point will be lost. This can happen if there are periods when that
voice has nothing to do. For methods of keeping contexts alive, see
Keeping contexts alive.
Using \lyricsto
Lyrics can be aligned under a melody automatically by specifying
the named Voice context containing the melody with
\lyricsto
:
<< \new Voice = "melody" \relative { a'1 a4. a8 a2 } \new Lyrics \lyricsto "melody" { These are the words } >>
This aligns the lyrics to the notes of the named Voice
context, which must already exist. Therefore normally the
Voice
context is specified first, followed by the
Lyrics
context. The lyrics themselves follow the
\lyricsto
command. The \lyricsto
command
invokes lyric mode automatically. By default, the lyrics are placed
underneath the notes. For other placements, see
Placing lyrics vertically.
Using \addlyrics
The \addlyrics
command is just a convenient shortcut that
can sometimes be used instead of having to set up the lyrics
through a more complicated LilyPond structure.
{ MUSIC } \addlyrics { LYRICS }
is the same as
\new Voice = "blah" { MUSIC } \new Lyrics \lyricsto "blah" { LYRICS }
Here is an example,
{ \time 3/4 \relative { c'2 e4 g2. } \addlyrics { play the game } }
More stanzas can be added by adding more
\addlyrics
sections:
{ \time 3/4 \relative { c'2 e4 g2. } \addlyrics { play the game } \addlyrics { speel het spel } \addlyrics { joue le jeu } }
The command \addlyrics
cannot handle polyphonic settings.
Also, it cannot be used to associate lyrics to a TabVoice
.
For these cases one should use \lyricsto
.
Using associatedVoice
The melody to which the lyrics are being aligned can be changed by
setting the associatedVoice
property,
\set associatedVoice = "lala"
The value of the property (here: "lala"
) should be the name
of a Voice
context. For technical reasons, the \set
command must be placed one syllable before the one to which the
change in voice is to apply.
Here is an example demonstrating its use:
<< \new Staff << \time 2/4 \new Voice = "one" \relative { \voiceOne c''4 b8. a16 g4. r8 a4 ( b ) c2 } \new Voice = "two" \relative { \voiceTwo s2 s4. f'8 e8 d4. c2 } >> % takes durations and alignment from notes in "one" initially % then switches to "two" \new Lyrics \lyricsto "one" { No more let \set associatedVoice = "two" % must be set one syllable early sins and sor -- rows grow. } >>
See also
Notation Reference: Extenders and hyphens, Keeping contexts alive, Placing lyrics vertically.
[ << Specialist notation ] | [Top][Contents][Index] | [ General input and output >> ] |
[ < Automatic syllable durations ] | [ Up : Common notation for vocal music ] | [ Multiple syllables to one note > ] |
Manual syllable durations
In some complex vocal music, it may be desirable to place lyrics
completely independently of notes. In this case do not use
\lyricsto
or \addlyrics
and do not set
associatedVoice
. Syllables are entered like notes –
but with pitches replaced by text – and the duration of each
syllable is entered explicitly after the syllable.
Hyphenated lines may be drawn between syllables as usual, but extender lines cannot be drawn when there is no associated voice.
Here are two examples:
<< \new Voice = "melody" \relative { c''2 a f f e e } \new Lyrics \lyricmode { c4. -- a -- f -- f -- e2. -- e } >>
<< \new Staff { \relative { c''2 c2 d1 } } \new Lyrics { \lyricmode { I2 like4. my8 cat!1 } } \new Staff { \relative { c'8 c c c c c c c c8 c c c c c c c } } >>
This technique is useful when writing dialogue over music, see Dialogue over music.
To change syllable alignment, simply override the self-alignment-X
property:
<< \new Voice = "melody" \relative { \time 3/4 c'2 e4 g2 f } \new Lyrics \lyricmode { \override LyricText.self-alignment-X = #LEFT play1 a4 game4 } >>
See also
Notation Reference: Dialogue over music.
Internals Reference: Lyrics, Voice.
[ << Specialist notation ] | [Top][Contents][Index] | [ General input and output >> ] |
[ < Manual syllable durations ] | [ Up : Common notation for vocal music ] | [ Multiple notes to one syllable > ] |
Multiple syllables to one note
In order to assign more than one syllable to a single note with
spaces between the syllables, you can surround the phrase with
quotes or use a _
character. Alternatively, you can use
the tilde symbol (~
) to get a lyric tie.
{ \relative { \autoBeamOff r8 b' c fis, fis c' b e, } \addlyrics { % Ensure hyphens are visible \override LyricHyphen.minimum-distance = #1.0 Che_in ques -- ta_e_in quel -- l'al -- tr'on -- da } \addlyrics { "Che in" ques -- "ta e in" quel -- l'al -- tr'on -- da } \addlyrics { Che~in ques -- ta~e~in quel -- l'al -- tr'on -- da } }
See also
Internals Reference: LyricCombineMusic.
[ << Specialist notation ] | [Top][Contents][Index] | [ General input and output >> ] |
[ < Multiple syllables to one note ] | [ Up : Common notation for vocal music ] | [ Extenders and hyphens > ] |
Multiple notes to one syllable
Sometimes, particularly in Medieval and baroque music, several notes are sung on one syllable; this is called melisma, see melisma. The syllable to a melisma is usually left-aligned with the first note of the melisma.
When a melisma occurs on a syllable other than the last one in a
word, that syllable is usually joined to the following one with a
hyphenated line. This is indicated by placing a double hyphen,
--
, immediately after the syllable.
Alternatively, when a melisma occurs on the last or only syllable in
a word an extender line is usually drawn from the end of the syllable
to the last note of the melisma. This is indicated by placing a
double underscore, __
, immediately after the word.
There are five ways in which melismata can be indicated:
-
Melismata are created automatically over notes which are tied
together:
<< \new Voice = "melody" \relative { \time 3/4 f''4 g2 ~ | 4 e2 ~ | 8 } \new Lyrics \lyricsto "melody" { Ky -- ri -- e __ } >>
-
Melismata can be created automatically from the music by placing
slurs over the notes of each melisma. This is the usual way of
entering lyrics:
<< \new Voice = "melody" \relative { \time 3/4 f''4 g8 ( f e f ) e8 ( d e2 ) } \new Lyrics \lyricsto "melody" { Ky -- ri -- e __ } >>
Note that phrasing slurs do not affect the creation of melismata.
-
Notes are considered a melisma if they are manually beamed,
providing automatic beaming is switched off. See
Setting automatic beam behavior.
<< \new Voice = "melody" \relative { \time 3/4 \autoBeamOff f''4 g8[ f e f] e2. } \new Lyrics \lyricsto "melody" { Ky -- ri -- e } >>
Clearly this is not suited to melismata over notes which are longer than eighth notes.
-
An unslurred group of notes will be treated as a melisma if they
are bracketed between
\melisma
and\melismaEnd
.<< \new Voice = "melody" \relative { \time 3/4 f''4 g8 \melisma f e f \melismaEnd e2. } \new Lyrics \lyricsto "melody" { Ky -- ri -- e } >>
-
A melisma can be defined entirely in the lyrics by entering a
single underscore character,
_
, for every extra note that has to be added to the melisma.<< \new Voice = "melody" \relative { \time 3/4 f''4 g8 f e f e8 d e2 } \new Lyrics \lyricsto "melody" { Ky -- ri -- _ _ _ e __ _ _ } >>
It is possible to have ties, slurs and manual beams in the melody
without their indicating melismata. To do this, set
melismaBusyProperties
:
<< \new Voice = "melody" \relative { \time 3/4 \set melismaBusyProperties = #'() c'4 d ( e ) g8 [ f ] f4 ~ 4 } \new Lyrics \lyricsto "melody" { Ky -- ri -- e e -- le -- i -- son } >>
Other settings for melismaBusyProperties
can be used to
selectively include or exclude ties, slurs, and beams from the
automatic detection of melismata; see melismaBusyProperties
in
Tunable context properties.
Alternatively, if all melismata indications are to be ignored,
ignoreMelismata
may be set true;
see Stanzas with different rhythms.
If a melisma is required during a passage in which
melismaBusyProperties
is active, it may be indicated by
placing a single underscore in the lyrics for each note which
should be included in the melisma:
<< \new Voice = "melody" \relative { \time 3/4 \set melismaBusyProperties = #'() c'4 d ( e ) g8 [ f ] ~ 4 ~ f } \new Lyrics \lyricsto "melody" { Ky -- ri -- _ e __ _ _ _ } >>
Predefined commands
\autoBeamOff
,
\autoBeamOn
,
\melisma
,
\melismaEnd
.
See also
Musical Glossary: melisma.
Learning Manual: Aligning lyrics to a melody.
Notation Reference: Aligning lyrics to a melody, Automatic syllable durations, Setting automatic beam behavior, Stanzas with different rhythms.
Internals Reference: Tunable context properties.
Known issues and warnings
Extender lines under melismata are not created automatically; they must be inserted manually with a double underscore.
[ << Specialist notation ] | [Top][Contents][Index] | [ General input and output >> ] |
[ < Multiple notes to one syllable ] | [ Up : Common notation for vocal music ] | [ Gradual changes of vowel > ] |
Extenders and hyphens
In the last syllable of a word, melismata are sometimes indicated with a long horizontal line starting in the melisma syllable, and ending in the next one. Such a line is called an extender line, and it is entered as ‘ __ ’ (note the spaces before and after the two underscore characters).
Note: Melismata are indicated in the score with extender lines, which are entered as one double underscore; but short melismata can also be entered by skipping individual notes, which are entered as single underscore characters; these do not make an extender line to be typeset by default.
Centered hyphens are entered as ‘ -- ’ between syllables of a same word (note the spaces before and after the two hyphen characters). The hyphen will be centered between the syllables, and its length will be adjusted depending on the space between the syllables.
In tightly engraved music, hyphens can be removed. Whether this
happens can be controlled with the minimum-distance
(minimum
distance between two syllables) and the minimum-length
(threshold below which hyphens are removed) properties of
LyricHyphen
.
By default a hyphen is not repeated after a system break when the
next line begins with a new syllable. Setting the
after-line-breaking
property to #t
allows hyphens
to be drawn in such situations.
See also
Internals Reference: LyricExtender, LyricHyphen.
[ << Specialist notation ] | [Top][Contents][Index] | [ General input and output >> ] |
[ < Extenders and hyphens ] | [ Up : Common notation for vocal music ] | [ Techniques specific to lyrics > ] |
Gradual changes of vowel
Vowel transitions (gradual changes of vowel or sustained
consonant), which may be indicated by arrows between syllables,
are entered with the command \vowelTransition
(see
Gould pp. 452–453). The arrow shows the length of
the transition, and it is by default always drawn (space is
added if necessary in tightly engraved music). Ties between
notes of unchanged pitch or slurs show that there is no
new articulation, despite a change of vowel. The minimum length
of the arrows may be adjusted with the minimum-length
property of VowelTransition
.
{ c'2 c' \set melismaBusyProperties = #'() c'2 ~ c' \time 3/2 d'4( e' f' e' f'2 e'2.) } \addlyrics { Ah \vowelTransition oh, ah \vowelTransition oh, ah \vowelTransition _ _ _ _ oh. }
See also
Musical Glossary: vowel transition.
Internals Reference: VowelTransition.
[ << Specialist notation ] | [Top][Contents][Index] | [ General input and output >> ] |
[ < Gradual changes of vowel ] | [ Up : Vocal music ] | [ Working with lyrics and variables > ] |
2.1.2 Techniques specific to lyrics
Working with lyrics and variables | ||
Placing lyrics vertically | ||
Placing syllables horizontally | ||
Lyrics and repeats | ||
Divisi lyrics | ||
Polyphony with shared lyrics |
[ << Specialist notation ] | [Top][Contents][Index] | [ General input and output >> ] |
[ < Techniques specific to lyrics ] | [ Up : Techniques specific to lyrics ] | [ Placing lyrics vertically > ] |
Working with lyrics and variables
Variables containing lyrics can be created, but the lyrics must be entered in lyric mode:
musicOne = \relative { c''4 b8. a16 g4. f8 e4 d c2 } verseOne = \lyricmode { Joy to the world, the Lord is come. } \score { << \new Voice = "one" { \time 2/4 \musicOne } \new Lyrics \lyricsto "one" { \verseOne } >> }
Durations do not need to be added if the variable is to be invoked
with \addlyrics
or \lyricsto
.
For different or more complex orderings, the best way is to define
the music and lyric variables first, then set up the hierarchy of
staves and lyrics, omitting the lyrics themselves, and then add the
lyrics using \context
underneath. This ensures that the
voices referenced by \lyricsto
have always been defined
earlier. For example:
sopranoMusic = \relative { c''4 c c c } contraltoMusic = \relative { a'4 a a a } sopranoWords = \lyricmode { Sop -- ra -- no words } contraltoWords = \lyricmode { Con -- tral -- to words } \score { \new ChoirStaff << \new Staff { \new Voice = "sopranos" { \sopranoMusic } } \new Lyrics = "sopranos" \new Lyrics = "contraltos" \new Staff { \new Voice = "contraltos" { \contraltoMusic } } \context Lyrics = "sopranos" { \lyricsto "sopranos" { \sopranoWords } } \context Lyrics = "contraltos" { \lyricsto "contraltos" { \contraltoWords } } >> }
See also
Notation Reference: Placing lyrics vertically.
Internals Reference: LyricCombineMusic, Lyrics.
[ << Specialist notation ] | [Top][Contents][Index] | [ General input and output >> ] |
[ < Working with lyrics and variables ] | [ Up : Techniques specific to lyrics ] | [ Placing syllables horizontally > ] |
Placing lyrics vertically
Depending on the type of music, lyrics may be positioned above the staff, below the staff, or between staves. Placing lyrics below the associated staff is the easiest, and can be achieved by simply defining the Lyrics context below the Staff context:
\score { << \new Staff { \new Voice = "melody" { \relative { c''4 c c c } } } \new Lyrics { \lyricsto "melody" { Here are the words } } >> }
Lyrics may be positioned above the staff using one of two methods. The simplest (and preferred) method is to use the same syntax as above and explicitly specify the position of the lyrics:
\score { << \new Staff = "staff" { \new Voice = "melody" { \relative { c''4 c c c } } } \new Lyrics \with { alignAboveContext = "staff" } { \lyricsto "melody" { Here are the words } } >> }
Alternatively, a two-step process may be used. First the Lyrics
context is declared (without any content) before the Staff and
Voice contexts, then the \lyricsto
command is placed after
the Voice declaration it references by using \context
, as
follows:
\score { << \new Lyrics = "lyrics" \with { % lyrics above a staff should have this override \override VerticalAxisGroup.staff-affinity = #DOWN } \new Staff { \new Voice = "melody" { \relative { c''4 c c c } } } \context Lyrics = "lyrics" { \lyricsto "melody" { Here are the words } } >> }
When there are two voices on separate staves the lyrics may be placed between the staves using either of these methods. Here is an example of the second method:
\score { \new ChoirStaff << \new Staff { \new Voice = "sopranos" { \relative { c''4 c c c } } } \new Lyrics = "sopranos" \new Lyrics = "contraltos" \with { % lyrics above a staff should have this override \override VerticalAxisGroup.staff-affinity = #DOWN } \new Staff { \new Voice = "contraltos" { \relative { a'4 a a a } } } \context Lyrics = "sopranos" { \lyricsto "sopranos" { Sop -- ra -- no words } } \context Lyrics = "contraltos" { \lyricsto "contraltos" { Con -- tral -- to words } } >> }
Other combinations of lyrics and staves may be generated by elaborating these examples, or by examining the templates in the Learning Manual, see Vocal ensembles templates.
Selected Snippets
Obtaining 2.12 lyrics spacing in newer versions
The vertical spacing engine changed since version 2.14. This can cause lyrics to be spaced differently.
It is possible to set properties for Lyric
and Staff
contexts to get the spacing engine to behave as it did in version 2.12.
global = { \key d \major \time 3/4 } sopMusic = \relative c' { % VERSE ONE fis4 fis fis | \break fis4. e8 e4 } altoMusic = \relative c' { % VERSE ONE d4 d d | d4. b8 b4 | } tenorMusic = \relative c' { a4 a a | b4. g8 g4 | } bassMusic = \relative c { d4 d d | g,4. g8 g4 | } words = \lyricmode { Great is Thy faith -- ful -- ness, } \score { \new ChoirStaff << \new Lyrics = sopranos \new Staff = women << \new Voice = "sopranos" { \voiceOne \global \sopMusic } \new Voice = "altos" { \voiceTwo \global \altoMusic } >> \new Lyrics = "altos" \new Lyrics = "tenors" \new Staff = men << \clef bass \new Voice = "tenors" { \voiceOne \global \tenorMusic } \new Voice = "basses" { \voiceTwo \global \bassMusic } >> \new Lyrics = basses \context Lyrics = sopranos \lyricsto sopranos \words \context Lyrics = altos \lyricsto altos \words \context Lyrics = tenors \lyricsto tenors \words \context Lyrics = basses \lyricsto basses \words >> \layout { \context { \Lyrics \override VerticalAxisGroup.staff-affinity = ##f \override VerticalAxisGroup.staff-staff-spacing = #'((basic-distance . 0) (minimum-distance . 2) (padding . 2)) } \context { \Staff \override VerticalAxisGroup.staff-staff-spacing = #'((basic-distance . 0) (minimum-distance . 2) (padding . 2)) } } }
See also
Learning Manual: Vocal ensembles templates.
Notation Reference: Context layout order, Creating and referencing contexts.
[ << Specialist notation ] | [Top][Contents][Index] | [ General input and output >> ] |
[ < Placing lyrics vertically ] | [ Up : Techniques specific to lyrics ] | [ Lyrics and repeats > ] |
Placing syllables horizontally
To increase the spacing between lyrics, set the
minimum-distance
property of LyricSpace
.
\relative c' { c c c c \override Lyrics.LyricSpace.minimum-distance = #1.0 c c c c } \addlyrics { longtext longtext longtext longtext longtext longtext longtext longtext }
To make this change for all lyrics in the score, set the property in the
\layout
block.
\score { \relative { 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 } } }
Selected Snippets
Lyrics alignment
Horizontal alignment for lyrics can be set by overriding the
self-alignment-X
property of the LyricText
object.
#-1
is left, #0
is center and #1
is right;
however, you can use #LEFT
, #CENTER
and #RIGHT
as
well.
\layout { ragged-right = ##f } \relative c'' { c1 c1 c1 } \addlyrics { \once \override LyricText.self-alignment-X = #LEFT "This is left-aligned" \once \override LyricText.self-alignment-X = #CENTER "This is centered" \once \override LyricText.self-alignment-X = #1 "This is right-aligned" }
Known issues and warnings
Checking to make sure that text scripts and lyrics are within the margins requires additional calculations. To speed up processing slightly, this feature can be disabled:
\override Score.PaperColumn.keep-inside-line = ##f
To make lyrics avoid bar lines as well, use
\layout { \context { \Lyrics \consists "Bar_engraver" \consists "Separating_line_group_engraver" \hide BarLine } }
[ << Specialist notation ] | [Top][Contents][Index] | [ General input and output >> ] |
[ < Placing syllables horizontally ] | [ Up : Techniques specific to lyrics ] | [ Divisi lyrics > ] |
Lyrics and repeats
Simple repeats
Repeats in music are fully described elsewhere; see Repeats. This section explains how to add lyrics to repeated sections of music.
Lyrics to a section of music that is repeated should be surrounded by exactly the same repeat construct as the music, if the words are unchanged.
\score { << \new Staff { \new Voice = "melody" { \relative { a'4 a a a \repeat volta 2 { b4 b b b } } } } \new Lyrics { \lyricsto "melody" { Not re -- peat -- ed. \repeat volta 2 { Re -- peat -- ed twice. } } } >> }
The words will then be correctly expanded if the repeats are unfolded.
\score { \unfoldRepeats { << \new Staff { \new Voice = "melody" { \relative { a'4 a a a \repeat volta 2 { b4 b b b } } } } \new Lyrics { \lyricsto "melody" { Not re -- peat -- ed. \repeat volta 2 { Re -- peat -- ed twice. } } } >> } }
If the repeated section is to be unfolded and has different words, simply enter all the words:
\score { << \new Staff { \new Voice = "melody" { \relative { a'4 a a a \repeat unfold 2 { b4 b b b } } } } \new Lyrics { \lyricsto "melody" { Not re -- peat -- ed. The first time words. Sec -- ond time words. } } >> }
When the words to a repeated volta section are different, the words
to each repeat must be entered in separate Lyrics
contexts,
correctly nested in parallel sections:
\score { << \new Staff { \new Voice = "melody" { \relative { a'4 a a a \repeat volta 2 { b4 b b b } } } } \new Lyrics \lyricsto "melody" { Not re -- peat -- ed. << { The first time words. } \new Lyrics { \set associatedVoice = "melody" Sec -- ond time words. } >> } >> }
More verses may be added in a similar way:
\score { << \new Staff { \new Voice = "singleVoice" { \relative { a'4 a a a \repeat volta 3 { b4 b b b } c4 c c c } } } \new Lyrics \lyricsto "singleVoice" { Not re -- peat -- ed. << { The first time words. } \new Lyrics { \set associatedVoice = "singleVoice" Sec -- ond time words. } \new Lyrics { \set associatedVoice = "singleVoice" The third time words. } >> The end sec -- tion. } >> }
However, if this construct is embedded within a multi-staff
context such as a ChoirStaff
the lyrics of the second and
third verses will appear beneath the bottom staff.
To position them correctly use alignBelowContext
:
\score { << \new Staff { \new Voice = "melody" { \relative { a'4 a a a \repeat volta 3 { b4 b b b } c4 c c c } } } \new Lyrics = "firstVerse" \lyricsto "melody" { Not re -- peat -- ed. << { The first time words. } \new Lyrics = "secondVerse" \with { alignBelowContext = "firstVerse" } { \set associatedVoice = "melody" Sec -- ond time words. } \new Lyrics = "thirdVerse" \with { alignBelowContext = "secondVerse" } { \set associatedVoice = "melody" The third time words. } >> The end sec -- tion. } \new Voice = "harmony" { \relative { f'4 f f f \repeat volta 2 { g8 g g4 g2 } a4 a8. a16 a2 } } >> }
Repeats with alternative endings
If the words of the repeated section are the same, and none of the
\alternative
blocks start with a rest, exactly the same
structure can be used for both the lyrics and music. This has the
advantage that \unfoldRepeats
will expand both music and
lyrics correctly.
\score { << \new Staff { \time 2/4 \new Voice = "melody" { \relative { a'4 a a a \repeat volta 2 { b4 b } \alternative { \volta 1 { b b } \volta 2 { b c } } } } } \new Lyrics { \lyricsto "melody" { Not re -- peat -- ed. \repeat volta 2 { Re -- peat -- } \alternative { \volta 1 { ed twice. } \volta 2 { ed twice. } } } } >> }
But when the repeated section has different words, or when one
of the \alternative
blocks starts with a rest, a repeat
construct cannot be used around the words and \skip
commands
have to be inserted manually to skip over the notes in the
alternative sections which do not apply.
Note: do not use an underscore, _
, to skip notes – an
underscore indicates a melisma, causing the preceding syllable
to be left-aligned.
Note: The skip
command must be followed by a number,
but this number is ignored in lyrics which derive their durations
from the notes in an associated melody through addlyrics
or
lyricsto
. Each skip
skips a single note of any
value, irrespective of the value of the following number.
\score { << \new Staff { \time 2/4 \new Voice = "melody" { \relative { \repeat volta 2 { b'4 b } \alternative { \volta 1 { b b } \volta 2 { b c } } c4 c } } } \new Lyrics { \lyricsto "melody" { The first time words. \repeat unfold 2 { \skip 1 } End here. } } \new Lyrics { \lyricsto "melody" { Sec -- ond \repeat unfold 2 { \skip 1 } time words. } } >> }
When a note is tied over into two or more alternative endings a
tie is used to carry the note into the first alternative ending and
a \repeatTie
is used in the second and subsequent endings.
This structure causes difficult alignment problems when lyrics are
involved and increasing the length of the alternative sections so
the tied notes are contained wholly within them may give a more
acceptable result.
The tie creates a melisma into the first alternative, but not into the second and subsequent alternatives, so to align the lyrics correctly it is necessary to disable the automatic creation of melismata over the volta section and insert manual skips.
\score { << \new Staff { \time 2/4 \new Voice = "melody" { \relative { \set melismaBusyProperties = #'() \repeat volta 2 { b'4 b ~} \alternative { \volta 1 { b b } \volta 2 { b \repeatTie c } } \unset melismaBusyProperties c4 c } } } \new Lyrics { \lyricsto "melody" { \repeat volta 2 { Here's a __ } \alternative { \volta 1 { \skip 1 verse } \volta 2 { \skip 1 sec } } ond one. } } >> }
Note that if \unfoldRepeats
is used around a section
containing \repeatTie
, the \repeatTie
should be
removed to avoid both types of tie being printed.
When the repeated section has different words a \repeat
cannot be used around the lyrics and \skip
commands need to
be inserted manually, as before.
\score { << \new Staff { \time 2/4 \new Voice = "melody" { \relative { \repeat volta 2 { b'4 b ~} \alternative { \volta 1 { b b } \volta 2 { b \repeatTie c } } c4 c } } } \new Lyrics { \lyricsto "melody" { Here's a __ verse. \repeat unfold 2 { \skip 1 } } } \new Lyrics { \lyricsto "melody" { Here's one \repeat unfold 2 { \skip 1 } more to sing. } } >> }
If you wish to show extenders and hyphens into and out of alternative sections these must be inserted manually.
\score { << \new Staff { \time 2/4 \new Voice = "melody" { \relative { \repeat volta 2 { b'4 b ~} \alternative { \volta 1 { b b } \volta 2 { b \repeatTie c } } c4 c } } } \new Lyrics { \lyricsto "melody" { Here's a __ verse. \repeat unfold 2 { \skip 1 } } } \new Lyrics { \lyricsto "melody" { Here's "a_" \skip 1 "_" sec -- ond one. } } >> }
See also
Notation Reference: Keeping contexts alive, Repeats.
[ << Specialist notation ] | [Top][Contents][Index] | [ General input and output >> ] |
[ < Lyrics and repeats ] | [ Up : Techniques specific to lyrics ] | [ Polyphony with shared lyrics > ] |
Divisi lyrics
When just the words and rhythms of the two parts differ with the pitches remaining the same, temporarily turning off the automatic detection of melismata and indicating the melisma in the lyrics may be the appropriate method to use:
\score { << \new Voice = "melody" { \relative c' { \set melismaBusyProperties = #'() \slurDown \slurDashed e4 e8 ( e ) c4 c | \unset melismaBusyProperties c } } \new Lyrics \lyricsto "melody" { They shall not o -- ver -- come } \new Lyrics \lyricsto "melody" { We will _ } >> }
When both music and words differ it may be better to display the differing music and lyrics by naming voice contexts and attaching lyrics to those specific contexts:
\score { << \new Voice = "melody" { \relative { << { \voiceOne e'4 e8 e } \new Voice = "splitpart" { \voiceTwo c4 c } >> \oneVoice c4 c | c } } \new Lyrics \lyricsto "melody" { They shall not o -- ver -- come } \new Lyrics \lyricsto "splitpart" { We will } >> }
It is common in choral music to have a voice part split for
several measures. The << {…} \\ {…} >>
construct, where the two (or more) musical expressions are
separated by double backslashes, might seem the proper way to
set the split voices. This construct, however, will assign
all the expressions within it to NEW Voice
contexts which will result in no lyrics being set for
them since the lyrics will be set to the original voice context
– not, typically, what one wants. The temporary polyphonic
passage is the proper construct to use, see section
Temporary polyphonic passages in Single-staff polyphony.
[ << Specialist notation ] | [Top][Contents][Index] | [ General input and output >> ] |
[ < Divisi lyrics ] | [ Up : Techniques specific to lyrics ] | [ Stanzas > ] |
Polyphony with shared lyrics
When two voices with different rhythms share the same lyrics, aligning the lyrics to one of the voices may lead to problems in the other voice. For example, the second lyric extender below is too short, since the lyrics are aligned only to the top voice:
soprano = \relative { b'8( c d c) d2 } alto = \relative { g'2 b8( a g a) } words = \lyricmode { la __ la __ } \new Staff << \new Voice = "sopranoVoice" { \voiceOne \soprano } \new Voice { \voiceTwo \alto } \new Lyrics \lyricsto "sopranoVoice" \words >>
To get the desired result, align the lyrics to a new
NullVoice
context containing a suitable combination of the
two voices. The notes of the NullVoice
context do not
appear on the printed page, but can be used to align the lyrics
appropriately:
soprano = \relative { b'8( c d c) d2 } alto = \relative { g'2 b8( a g a) } aligner = \relative { b'8( c d c) b( a g a) } words = \lyricmode { la __ la __ } \new Staff << \new Voice { \voiceOne \soprano } \new Voice { \voiceTwo \alto } \new NullVoice = "aligner" \aligner \new Lyrics \lyricsto "aligner" \words >>
This method also can be used with the \partCombine
function, which does not allow lyrics on its own:
soprano = \relative { b'8( c d c) d2 } alto = \relative { g'2 b8( a g a) } aligner = \relative { b'8( c d c) b( a g a) } words = \lyricmode { la __ la __ } \new Staff << \new Voice \partCombine \soprano \alto \new NullVoice = "aligner" \aligner \new Lyrics \lyricsto "aligner" \words >>
Known issues and warnings
The \addlyrics
function only works with Voice
lyrics
and so cannot be used with NullVoice
.
The \partCombine
function is described in
Automatic part combining.
Lastly, this method can be used even when the voices are in different staves, and is not limited to only two voices:
soprano = \relative { b'8( c d c) d2 } altoOne = \relative { g'2 b8( a b4) } altoTwo = \relative { d'2 g4( fis8 g) } aligner = \relative { b'8( c d c) d( d d d) } words = \lyricmode { la __ la __ } \new ChoirStaff \with {\accepts NullVoice } << \new Staff \soprano \new NullVoice = "aligner" \aligner \new Lyrics \lyricsto "aligner" \words \new Staff \partCombine \altoOne \altoTwo >>
[ << Specialist notation ] | [Top][Contents][Index] | [ General input and output >> ] |
[ < Polyphony with shared lyrics ] | [ Up : Vocal music ] | [ Adding stanza numbers > ] |
2.1.3 Stanzas
Adding stanza numbers | ||
Adding dynamics marks to stanzas | ||
Adding singers’ names to stanzas | ||
Stanzas with different rhythms | ||
Printing stanzas at the end | ||
Printing stanzas at the end in multiple columns |
[ << Specialist notation ] | [Top][Contents][Index] | [ General input and output >> ] |
[ < Stanzas ] | [ Up : Stanzas ] | [ Adding dynamics marks to stanzas > ] |
Adding stanza numbers
Stanza numbers can be added by setting stanza
, e.g.,
\new Voice \relative { \time 3/4 g'2 e4 a2 f4 g2. } \addlyrics { \set stanza = "1. " Hi, my name is Bert. } \addlyrics { \set stanza = "2. " Oh, ché -- ri, je t'aime }
These numbers are put just before the start of the first syllable. Two lines of a stanza can also be grouped together, for example in case of a repeat with different lyrics:
leftbrace = \markup { \override #'(font-encoding . fetaBraces) \lookup "brace80" } stanzaOneOne = \lyricmode { \set stanza = \markup { \column { \vspace #.33 "1. "} \leftbrace } Child, you’re mine and I love you. Lend thine ear to what I say. } stanzaOneThree = \lyricmode { Child, I have no great -- er joy Than to have you walk in truth. } \new Voice { \repeat volta 2 { c'8 c' c' c' c' c' c'4 c'8 c' c' c' c' c' c'4 } } \addlyrics { \stanzaOneOne } \addlyrics { \stanzaOneThree }
[ << Specialist notation ] | [Top][Contents][Index] | [ General input and output >> ] |
[ < Adding stanza numbers ] | [ Up : Stanzas ] | [ Adding singers' names to stanzas > ] |
Adding dynamics marks to stanzas
Stanzas differing in loudness may be indicated by putting a
dynamics mark before each stanza. In LilyPond, everything coming in
front of a stanza goes into the StanzaNumber
object; dynamics
marks are no different. For technical reasons, you have to set the
stanza outside \lyricmode
:
text = { \set stanza = \markup { \dynamic "ff" "1. " } \lyricmode { Big bang } } << \new Voice = "tune" { \time 3/4 g'4 c'2 } \new Lyrics \lyricsto "tune" \text >>
[ << Specialist notation ] | [Top][Contents][Index] | [ General input and output >> ] |
[ < Adding dynamics marks to stanzas ] | [ Up : Stanzas ] | [ Stanzas with different rhythms > ] |
Adding singers’ names to stanzas
Names of singers can also be added. They are printed at the start of
the line, just like instrument names. They are created by setting
vocalName
. A short version may be entered as
shortVocalName
.
\new Voice \relative { \time 3/4 g'2 e4 a2 f4 g2. } \addlyrics { \set vocalName = "Bert " Hi, my name is Bert. } \addlyrics { \set vocalName = "Ernie " Oh, ché -- ri, je t'aime }
[ << Specialist notation ] | [Top][Contents][Index] | [ General input and output >> ] |
[ < Adding singers' names to stanzas ] | [ Up : Stanzas ] | [ Printing stanzas at the end > ] |
Stanzas with different rhythms
Often, different stanzas of one song are put to one melody in slightly
differing ways. Such variations can still be captured with
\lyricsto
.
Ignoring melismata
One possibility is that the text has a melisma in one stanza, but
multiple syllables in another. One solution is to make the faster
voice ignore the melisma. This is done by setting
ignoreMelismata
in the Lyrics context.
<< \relative \new Voice = "lahlah" { \set Staff.autoBeaming = ##f c'4 \slurDotted f8.[( g16]) a4 } \new Lyrics \lyricsto "lahlah" { more slow -- ly } \new Lyrics \lyricsto "lahlah" { go \set ignoreMelismata = ##t fas -- ter \unset ignoreMelismata still } >>
Known issues and warnings
Unlike most \set
commands, \set ignoreMelismata
does
not work if prefixed with \once
. It is necessary to use
\set
and \unset
to bracket the lyrics where melismata
are to be ignored.
Adding syllables to grace notes
By default, grace notes (e.g., via \grace
) do not get assigned
syllables when using \lyricsto
, but this behavior can be
changed:
<< \new Voice = melody \relative { f'4 \appoggiatura a32 b4 \grace { f16 a16 } b2 \afterGrace b2 { f16[ a16] } \appoggiatura a32 b4 \acciaccatura a8 b4 } \new Lyrics \lyricsto melody { normal \set includeGraceNotes = ##t case, gra -- ce case, after -- grace case, \set ignoreMelismata = ##t app. case, acc. case. } >>
Known issues and warnings
Like associatedVoice
, includeGraceNotes
needs to be
set at latest one syllable before the one which is to be put under a
grace note. In the case of a grace note at the very beginning of a
piece of music, using a \with
, or a \context
block
within \layout
, is recommended:
<< \new Voice = melody \relative c' { \grace { c16( d e f } g1) f } \new Lyrics \with { includeGraceNotes = ##t } \lyricsto melody { Ah __ fa } >>
Switching to an alternative melody
More complex variations in setting lyrics to music are possible.
The melody to which the lyrics are being set can be changed from
within the lyrics by setting the associatedVoice
property:
<< \relative \new Voice = "lahlah" { \set Staff.autoBeaming = ##f c'4 << \new Voice = "alternative" { \voiceOne \tuplet 3/2 { % show associations clearly. \override NoteColumn.force-hshift = #-3 f8 f g } } { \voiceTwo f8.[ g16] \oneVoice } >> a8( b) c } \new Lyrics \lyricsto "lahlah" { Ju -- ras -- sic Park } \new Lyrics \lyricsto "lahlah" { % Tricky: need to set associatedVoice % one syllable too soon! \set associatedVoice = "alternative" % applies to "ran" Ty -- ran -- no -- \set associatedVoice = "lahlah" % applies to "rus" sau -- rus Rex } >>
The text for the first stanza is set to the melody called
‘lahlah’ in the usual way, but the second stanza is set initally
to the lahlah
context and is then switched to the
alternative
melody for the syllables ‘ran’ to ‘sau’ by
the lines:
\set associatedVoice = "alternative" % applies to "ran" Ty -- ran -- no -- \set associatedVoice = "lahlah" % applies to "rus" sau -- rus Rex
Here, alternative
is the name of the Voice
context
containing the triplet.
Note the placement of the \set associatedVoice
command –
it appears to be one syllable too early, but this is correct.
Note: The set associatedVoice
command must be placed
one syllable before the one at which the switch to the new
voice is to occur. In other words, changing the associated Voice
happens one syllable later than expected. This is for technical
reasons, and it is not a bug.
[ << Specialist notation ] | [Top][Contents][Index] | [ General input and output >> ] |
[ < Stanzas with different rhythms ] | [ Up : Stanzas ] | [ Printing stanzas at the end in multiple columns > ] |
Printing stanzas at the end
Sometimes it is appropriate to have one stanza set
to the music, and the rest added in verse form at
the end of the piece. This can be accomplished by adding
the extra verses into a \markup
section outside
of the main score block. Notice that there are several
different ways to force linebreaks when using
\markup
. For inputting a whole string you may use
\string-lines
with manually inserted \n
or automatic line breaks as entered or
\wordwrap-string
. If inner fomatting code is used
a combination of \line
and \column
is recommended.
melody = \relative { e' d c d | e e e e | d d e d | c1 | } text = \lyricmode { \set stanza = "1." Ma- ry had a lit- tle lamb, its fleece was white as snow. } \score { << \new Voice = "one" { \melody } \new Lyrics \lyricsto "one" \text >> \layout { } } \markup { \column { \string-lines "Verse 2. \n Everywhere that Mary went \n The lamb was sure to go." } } \markup { \column { \string-lines "Verse 3. All the children laughed and played, To see a lamb at school." } } \markup { \column { \line \italic { Verse 4. } \line { And so the teacher turned it out, } \line { But still it lingered near. } } } \markup { \wordwrap-string " Verse 5. Mary took it home again, It was against the rule." }
[ << Specialist notation ] | [Top][Contents][Index] | [ General input and output >> ] |
[ < Printing stanzas at the end ] | [ Up : Stanzas ] | [ Songs > ] |
Printing stanzas at the end in multiple columns
When a piece of music has many verses, they are often printed in multiple columns across the page. An outdented verse number often introduces each verse. The following example shows how to produce such output in LilyPond.
melody = \relative { c'4 c c c | d d d d } 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 { % moves the column off the left margin; % can be removed if space on the page is tight \hspace #0.1 \column { \line { \bold "2." \column { "This is verse two." "It has two lines." } } % adds vertical spacing between verses \combine \null \vspace #0.1 \line { \bold "3." \column { "This is verse three." "It has two lines." } } } % adds horizontal spacing between columns \hspace #0.1 \column { \line { \bold "4." \column { "This is verse four." "It has two lines." } } % adds vertical spacing between verses \combine \null \vspace #0.1 \line { \bold "5." \column { "This is verse five." "It has two lines." } } } % gives some extra space on the right margin; % can be removed if page space is tight \hspace #0.1 } }
See also
Internals Reference: LyricText, StanzaNumber.
[ << Specialist notation ] | [Top][Contents][Index] | [ General input and output >> ] |
[ < Printing stanzas at the end in multiple columns ] | [ Up : Vocal music ] | [ References for songs > ] |
2.1.4 Songs
References for songs | ||
Lead sheets |
[ << Specialist notation ] | [Top][Contents][Index] | [ General input and output >> ] |
[ < Songs ] | [ Up : Songs ] | [ Lead sheets > ] |
References for songs
Songs are usually written on three staves with the melody for the singer on the top staff and two staves of piano accompaniment at the bottom. The lyrics of the first stanza are printed immediately underneath the top staff. If there are just a small number of further stanzas these can be printed immediately under the first one, but if there are more stanzas than can be easily accommodated there the second and subsequent stanzas are printed after the music as stand-alone text.
All the notational elements needed to write songs are fully described elsewhere:
- For constructing the staff layout, see Displaying staves.
- For writing piano music, see Keyboard and other multi-staff instruments.
- For writing the lyrics to a melody line, see Common notation for vocal music.
- For placing the lyrics, see Placing lyrics vertically.
- For entering stanzas, see Stanzas.
- Songs are frequently printed with the chording indicated by chord names above the staves. This is described in Displaying chords.
- To print fret diagrams of the chords for guitar accompaniment or accompaniment by other fretted instruments, see “Fret diagram markups” in Common notation for fretted strings.
See also
Learning Manual: Songs.
Notation Reference: Common notation for vocal music, Displaying chords, Displaying staves, Keyboard and other multi-staff instruments, Placing lyrics vertically, Stanzas.
Snippets: Vocal music.
[ << Specialist notation ] | [Top][Contents][Index] | [ General input and output >> ] |
[ < References for songs ] | [ Up : Songs ] | [ Choral > ] |
Lead sheets
Lead sheets may be printed by combining vocal parts and ‘chord mode’; this syntax is explained in Chord notation.
Selected Snippets
Simple lead sheet
When put together, chord names, a melody, and lyrics form a lead sheet:
<< \chords { c2 g:sus4 f e } \new Staff \relative c'' { a4 e c8 e r4 b2 c4( d) } \addlyrics { One day this shall be free __ } >>
See also
Notation Reference: Chord notation.
[ << Specialist notation ] | [Top][Contents][Index] | [ General input and output >> ] |
[ < Lead sheets ] | [ Up : Vocal music ] | [ References for choral > ] |
2.1.5 Choral
This section discusses notation issues that relate most directly to choral music. This includes anthems, part songs, oratorio, etc.
References for choral | ||
Score layouts for choral |
[ << Specialist notation ] | [Top][Contents][Index] | [ General input and output >> ] |
[ < Choral ] | [ Up : Choral ] | [ Score layouts for choral > ] |
References for choral
Choral music is usually notated on two, three or four staves within
a ChoirStaff
group. Accompaniment, if required, is placed
beneath in a PianoStaff
group, which is usually reduced in
size for rehearsal of a cappella choral works. The notes for
each vocal part are placed in a Voice
context, with each staff
being given either a single vocal part (i.e., one Voice
) or
a pair of vocal parts (i.e., two Voice
s).
Words are placed in Lyrics
contexts, either underneath each
corresponding music staff, or one above and one below the music
staff if this contains the music for two parts.
Several common topics in choral music are described fully elsewhere:
- An introduction to creating an SATB vocal score can be found in the Learning Manual, see Four-part SATB vocal score. There is also a built-in template which simplifies the entry of SATB vocal music, see Built-in templates.
- Several templates suitable for various styles of choral music can also be found in the Learning Manual, see Vocal ensembles templates.
-
For information about
ChoirStaff
andPianoStaff
see Grouping staves. - Shape note heads, as used in Sacred Harp and similar notation, are described in Shape note heads.
-
When two vocal parts share a staff the stems, ties, slurs, etc., of
the higher part will be directed up and those of the lower part
down. To do this, use
\voiceOne
and\voiceTwo
. See Single-staff polyphony. - When a vocal part temporarily splits, you should use Temporary polyphonic passages (see Single-staff polyphony).
Predefined commands
\oneVoice
,
\voiceOne
,
\voiceTwo
.
See also
Learning Manual: Four-part SATB vocal score, Vocal ensembles templates.
Notation Reference: Context layout order, Grouping staves, Shape note heads, Single-staff polyphony.
Snippets: Vocal music.
Internals Reference: ChoirStaff, Lyrics, PianoStaff.
[ << Specialist notation ] | [Top][Contents][Index] | [ General input and output >> ] |
[ < References for choral ] | [ Up : Choral ] | [ Opera and stage musicals > ] |
Score layouts for choral
Choral music containing four staves, with or without piano accompaniment, is usually laid out with two systems per page. Depending on the page size, achieving this may require changes to several default settings. The following settings should be considered:
- The global staff size can be modified to change the overall size of the elements of the score. See Setting the staff size.
- The distances between the systems, the staves and the lyrics can all be adjusted independently. See Vertical spacing.
- The dimensions of the vertical layout variables can be displayed as an aid to adjusting the vertical spacing. This and other possibilities for fitting the music onto fewer pages are described in Fitting music onto fewer pages.
- If the number of systems per page changes from one to two it is customary to indicate this with a system separator mark between the two systems. See Separating systems.
- For details of other page formatting properties, see Page layout.
Dynamic markings by default are placed below the staff, but in
choral music they are usually placed above the staff in order to
avoid the lyrics. The predefined command \dynamicUp
does
this for the dynamic markings in a single Voice
context.
If there are many Voice
contexts this predefined command
would have to be placed in every one. Alternatively its expanded
form can be used to place all dynamic markings in the entire score
above their respective staves, as shown here:
\score { \new ChoirStaff << \new Staff { \new Voice { \relative { g'4\f g g g } } } \new Staff { \new Voice { \relative { d'4 d d\p d } } } >> \layout { \context { \Score \override DynamicText.direction = #UP \override DynamicLineSpanner.direction = #UP } } }
Predefined commands
\dynamicUp
,
\dynamicDown
,
\dynamicNeutral
.
See also
Notation Reference: Changing spacing, Displaying spacing, Fitting music onto fewer pages, Page layout, Score layout, Separating systems, Setting the staff size, Breaks, Vertical spacing.
Internals Reference: VerticalAxisGroup, StaffGrouper.
Selected Snippets
Using arpeggioBracket to make divisi more visible
The arpeggioBracket
can be used to indicate the division of
voices where there are no stems to provide the information. This is
often seen in choral music.
\include "english.ly" \score { \relative c'' { \key a \major \time 2/2 << \new Voice = "upper" << { \voiceOne \arpeggioBracket a2( b2 <b d>1\arpeggio) <cs e>\arpeggio ~ <cs e>4 } \addlyrics { \lyricmode { A -- men. } } >> \new Voice = "lower" { \voiceTwo a1 ~ a a ~ a4 \bar "|." } >> } \layout { ragged-right = ##t } }
See also
Notation Reference: Expressive marks as lines.
[ << Specialist notation ] | [Top][Contents][Index] | [ General input and output >> ] |
[ < Score layouts for choral ] | [ Up : Vocal music ] | [ References for opera and stage musicals > ] |
2.1.6 Opera and stage musicals
The music, lyrics and dialogue to opera and stage musicals are usually set out in one or more of the following forms:
- A Conductors’ Score containing the full orchestral and vocal parts, together with libretto cues if there are spoken passages.
- Orchestral Parts containing the music for the individual instruments of the orchestra or band.
- A Vocal Score containing all vocal parts with piano accompaniment. The accompaniment is usually an orchestral reduction, and if so the name of the original orchestral instrument is often indicated. Vocal scores sometimes includes stage directions and libretto cues.
- A Vocal Book containing just the vocal parts (no accompaniment), sometimes combined with the libretto.
- A Libretto containing the extended passages of spoken dialogue usually found in musicals, together with the words to the sung parts. Stage directions are usually included. LilyPond can be used to typeset libretti but as they contain no music alternative methods may be preferable.
The sections in the LilyPond documentation which cover the topics needed to create scores in the styles commonly found in opera and musicals are indicated in the References below. This is followed by sections covering those techniques which are peculiar to typesetting opera and musical scores.
References for opera and stage musicals | ||
Character names | ||
Musical cues | ||
Spoken music | ||
Dialogue over music |
[ << Specialist notation ] | [Top][Contents][Index] | [ General input and output >> ] |
[ < Opera and stage musicals ] | [ Up : Opera and stage musicals ] | [ Character names > ] |
References for opera and stage musicals
In addition to vocal and stage ensembles, most of the following notions may apply to nearly any orchestral and ensemble music:
- A conductors’ score contains many grouped staves and lyrics. Ways of grouping staves is shown in Grouping staves. To nest groups of staves see Nested staff groups.
- The printing of empty staves in conductors’ scores and vocal scores is often suppressed. To create such a “Frenched score” see Hiding staves.
- Writing orchestral parts is covered in Writing parts. Other sections in the Specialist notation chapter may be relevant, depending on the orchestration used. Many instruments are transposing instruments, see Instrument transpositions.
- If the number of systems per page changes from page to page it is customary to separate the systems with a system separator mark. See Separating systems.
- For details of other page formatting properties, see Page layout.
-
Dialogue cues, stage directions and footnotes can be inserted, see
Creating footnotes and Text. Extensive stage directions
can also be added with a section of stand-alone markups between two
\score
blocks, see Separate text.
See also
Musical Glossary: Frenched score, Frenched staves, transposing instrument.
Notation Reference: Creating footnotes, Grouping staves, Hiding staves, Instrument transpositions, Nested staff groups, Page layout, Separating systems, Transpose, Writing parts, Writing text.
Snippets: Vocal music.
[ << Specialist notation ] | [Top][Contents][Index] | [ General input and output >> ] |
[ < References for opera and stage musicals ] | [ Up : Opera and stage musicals ] | [ Musical cues > ] |
Character names
Character names are usually shown to the left of the staff when the staff is dedicated to that character alone:
\score { << \new Staff { \set Staff.vocalName = \markup \smallCaps Kaspar \set Staff.shortVocalName = \markup \smallCaps Kas. \relative { \clef "G_8" c'4 c c c \break c4 c c c } } \new Staff { \set Staff.vocalName = \markup \smallCaps Melchior \set Staff.shortVocalName = \markup \smallCaps Mel \clef "bass" \relative { a4 a a a a4 a a a } } >> }
When two or more characters share a staff the character’s name is usually printed above the staff at the start of every section applying to that character. This can be done with markup. Often a specific font is used for this purpose.
\relative c' { \clef "G_8" c4^\markup \fontsize #1 \smallCaps Kaspar c c c \clef "bass" a4^\markup \fontsize #1 \smallCaps Melchior a a a \clef "G_8" c4^\markup \fontsize #1 \smallCaps Kaspar c c c }
Alternatively, if there are many character changes, it may be easier to set up variables to hold the definitions for each character so that the switch of characters can be indicated easily and concisely.
kaspar = { \clef "G_8" \set Staff.shortVocalName = "Kas." \set Staff.midiInstrument = "voice oohs" <>^\markup \smallCaps "Kaspar" } melchior = { \clef "bass" \set Staff.shortVocalName = "Mel." \set Staff.midiInstrument = "choir aahs" <>^\markup \smallCaps "Melchior" } \relative c' { \kaspar c4 c c c \melchior a4 a a a \kaspar c4 c c c }
See also
Learning Manual: Organizing pieces with variables.
Notation Reference: Text, Text markup commands.
[ << Specialist notation ] | [Top][Contents][Index] | [ General input and output >> ] |
[ < Character names ] | [ Up : Opera and stage musicals ] | [ Spoken music > ] |
Musical cues
Musical cues can be inserted in Vocal Scores, Vocal Books and Orchestral Parts to indicate what music in another part immediately precedes an entry. Also, cues are often inserted in the piano reduction in Vocal Scores to indicate what each orchestral instrument is playing. This aids the conductor when a full Conductors’ Score is not available.
The basic mechanism for inserting cues is fully explained in the main text, see Quoting other voices and Formatting cue notes. But when many cues have to be inserted, for example, as an aid to a conductor in a vocal score, the instrument name must be positioned carefully just before and close to the start of the cue notes. The following example shows how this is done.
flute = \relative { s4 s4 e'' g } \addQuote "flute" { \flute } pianoRH = \relative { c''4. g8 % position name of cue-ing instrument just before the cue notes, % and above the staff <>^\markup { \right-align { \tiny "Flute" } } \cueDuring "flute" #UP { g4 bes4 } } pianoLH = \relative { c4 <c' e> e, <g c> } \score { \new PianoStaff << \new Staff { \pianoRH } \new Staff { \clef "bass" \pianoLH } >> }
If a transposing instrument is being quoted the instrument part should
specify its key so the conversion of its cue notes will be done
automatically. The example below shows this transposition for a
B-flat clarinet. The notes in this example are low on the staff so
DOWN
is specified in \cueDuring
(so the stems are
down) and the instrument name is positioned below the staff.
clarinet = \relative c' { \transposition bes fis4 d d c } \addQuote "clarinet" { \clarinet } pianoRH = \relative c'' { \transposition c' % position name of cue-ing instrument below the staff <>_\markup { \right-align { \tiny "Clar." } } \cueDuring "clarinet" #DOWN { c4. g8 } g4 bes4 } pianoLH = \relative { c4 <c' e> e, <g c> } \score { << \new PianoStaff << \new Staff { \new Voice { \pianoRH } } \new Staff { \clef "bass" \pianoLH } >> >> }
From these two examples it is clear that inserting many cues in a Vocal Score would be tedious, and the notes of the piano part would become obscured. However, as the following snippet shows, it is possible to define a music function to reduce the amount of typing and to make the piano notes clearer.
Selected Snippets
Adding orchestral cues to a vocal score
This shows one approach to simplify adding many orchestral cues to the
piano reduction in a vocal score. The music function \cueWhile
takes four arguments: the music from which the cue is to be taken, as
defined by \addQuote
, the name to be inserted before the cue
notes, then either #UP
or #DOWN
to specify either
\voiceOne
with the name above the staff or \voiceTwo
with the name below the staff, and finally the piano music in parallel
with which the cue notes are to appear. The name of the cued
instrument is positioned to the left of the cued notes. Many passages
can be cued, but they cannot overlap each other in time.
cueWhile = #(define-music-function (instrument name dir music) (string? string? ly:dir? ly:music?) #{ \cueDuring $instrument #dir { \once \override TextScript.self-alignment-X = #RIGHT \once \override TextScript.direction = $dir <>-\markup { \tiny #name } $music } #}) flute = \relative c'' { \transposition c' s4 s4 e g } \addQuote "flute" { \flute } clarinet = \relative c' { \transposition bes fis4 d d c } \addQuote "clarinet" { \clarinet } singer = \relative c'' { c4. g8 g4 bes4 } words = \lyricmode { here's the lyr -- ics } pianoRH = \relative c'' { \transposition c' \cueWhile "clarinet" "Clar." #DOWN { c4. g8 } \cueWhile "flute" "Flute" #UP { g4 bes4 } } pianoLH = \relative c { c4 <c' e> e, <g c> } \score { << \new Staff { \new Voice = "singer" { \singer } } \new Lyrics { \lyricsto "singer" \words } \new PianoStaff << \new Staff { \new Voice { \pianoRH } } \new Staff { \clef "bass" \pianoLH } >> >> }
See also
Musical Glossary: cue-notes.
Notation Reference: Aligning objects, Direction and placement, Formatting cue notes, Quoting other voices, Using music functions.
Snippets: Vocal music.
Internals Reference: CueVoice.
Known issues and warnings
\cueDuring
automatically inserts a CueVoice
context
and all cue notes are placed in that context. This means it is not
possible to have two overlapping sequences of cue notes by this
technique. Overlapping sequences could be entered by explicitly
declaring separate CueVoice
contexts and using
\quoteDuring
to extract and insert the cue notes.
[ << Specialist notation ] | [Top][Contents][Index] | [ General input and output >> ] |
[ < Musical cues ] | [ Up : Opera and stage musicals ] | [ Dialogue over music > ] |
Spoken music
Such effects as ‘parlato’ or ‘Sprechgesang’ require performers to speak without pitch but still with rhythm; these are notated by cross note heads, as demonstrated in Special note heads.
[ << Specialist notation ] | [Top][Contents][Index] | [ General input and output >> ] |
[ < Spoken music ] | [ Up : Opera and stage musicals ] | [ Chants psalms and hymns > ] |
Dialogue over music
Dialogue over music is usually printed over the staves in an italic font, with the start of each phrase keyed in to a particular music moment.
For short interjections a simple markup suffices.
\relative { a'4^\markup { \smallCaps { Alex - } \italic { He's gone } } a a a a4 a a^\markup { \smallCaps { Bethan - } \italic Where? } a a4 a a a }
For longer phrases it may be necessary to expand the music to make the words fit neatly. There is no provision in LilyPond to do this fully automatically, and some manual intervention to layout the page will be necessary.
For long phrases or for passages with a lot of closely packed dialogue, using a Lyrics context will give better results. The Lyrics context should not be associated with a music Voice; instead each section of dialogue should be given an explicit duration. If there is a gap in the dialogue, the final word should be separated from the rest and the duration split between them so that the underlying music spaces out smoothly.
If the dialogue extends for more than one line it will be necessary
to manually insert \break
s and adjust the placing of the
dialogue to avoid running into the right margin. The final word of
the last measure on a line should also be separated out, as above.
Here is an example illustrating how this might be done.
music = \relative { \repeat unfold 3 { a'4 a a a } } dialogue = \lyricmode { \markup { \fontsize #1 \upright \smallCaps Abe: "Say this over measures one and" }4*7 "two"4 | \break "and this over measure"4*3 "three"4 | } \score { << \new Lyrics \with { \override LyricText.font-shape = #'italic \override LyricText.self-alignment-X = #LEFT } { \dialogue } \new Staff { \new Voice { \music } } >> }
See also
Notation Reference: Manual syllable durations, Text.
Internal Reference: LyricText.
[ << Specialist notation ] | [Top][Contents][Index] | [ General input and output >> ] |
[ < Dialogue over music ] | [ Up : Vocal music ] | [ References for chants and psalms > ] |
2.1.7 Chants psalms and hymns
The music and words for chants, psalms and hymns usually follow a well-established format in any particular church. Although the formats may differ from church to church the type-setting problems which arise are broadly similar, and are covered in this section.
References for chants and psalms | ||
Setting a chant | ||
Pointing a psalm | ||
Partial measures in hymn tunes |
[ << Specialist notation ] | [Top][Contents][Index] | [ General input and output >> ] |
[ < Chants psalms and hymns ] | [ Up : Chants psalms and hymns ] | [ Setting a chant > ] |
References for chants and psalms
Typesetting Gregorian chant in various styles of ancient notation is described in Ancient notation.
See also
Notation reference: Ancient notation.
Snippets: Vocal music.
[ << Specialist notation ] | [Top][Contents][Index] | [ General input and output >> ] |
[ < References for chants and psalms ] | [ Up : Chants psalms and hymns ] | [ Pointing a psalm > ] |
Setting a chant
Modern chant settings use modern notation with varying numbers of elements taken from ancient notation. Some of the elements and methods to consider are shown here.
Chants often use quarter notes without stems to indicate the pitch, with the rhythm being taken from the spoken rhythm of the words.
stemOff = { \hide Staff.Stem } \relative c' { \stemOff a'4 b c2 | }
Chants often omit the bar lines or use shortened or dotted bar lines to indicate pauses in the music. To omit all bar lines from all staves remove the bar line engraver completely:
\score { \new StaffGroup << \new Staff { \relative { a'4 b c2 | a4 b c2 | a4 b c2 | } } \new Staff { \relative { a'4 b c2 | a4 b c2 | a4 b c2 | } } >> \layout { \context { \Staff \remove "Bar_engraver" } } }
Bar lines can also be removed on a staff-by-staff basis:
\score { \new ChoirStaff << \new Staff \with { \remove "Bar_engraver" } { \relative { a'4 b c2 | a4 b c2 | a4 b c2 | } } \new Staff { \relative { a'4 b c2 | a4 b c2 | a4 b c2 | } } >> }
To remove bar lines from just a section of music treat it as a
cadenza. If the section is long you may need to insert dummy
bar lines with \bar ""
to show where the line should break.
\relative a' { a4 b c2 | \cadenzaOn a4 b c2 a4 b c2 \bar "" a4 b c2 a4 b c2 \cadenzaOff a4 b c2 | a4 b c2 | }
Rests or pauses in chants can be indicated by modified bar lines.
\relative a' { a4 \cadenzaOn b c2 a4 b c2 \bar "'" a4 b c2 a4 b c2 \bar ";" a4 b c2 \bar "!" a4 b c2 \bar "||" }
Alternatively, the notation used in Gregorian chant for pauses or
rests is sometimes used even though the rest of the notation is
modern. This uses a modified \breathe
mark:
divisioMinima = { \once \override BreathingSign.stencil = #ly:breathing-sign::divisio-minima \once \override BreathingSign.Y-offset = #0 \breathe } divisioMaior = { \once \override BreathingSign.stencil = #ly:breathing-sign::divisio-maior \once \override BreathingSign.Y-offset = #0 \breathe } divisioMaxima = { \once \override BreathingSign.stencil = #ly:breathing-sign::divisio-maxima \once \override BreathingSign.Y-offset = #0 \breathe } finalis = { \once \override BreathingSign.stencil = #ly:breathing-sign::finalis \once \override BreathingSign.Y-offset = #0 \breathe } \score { \relative { g'2 a4 g \divisioMinima g2 a4 g \divisioMaior g2 a4 g \divisioMaxima g2 a4 g \finalis } \layout { \context {