GNU LilyPond — Notation Reference

The music typesetter

This document is also available as a PDF and as a HTML indexed multiple pages.

This file documents GNU LilyPond.

Copyright 1999–2009 by the authors

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections. A copy of the license is included in the section entitled “GNU Free Documentation License”.

This is the Notation Reference (NR) for GNU LilyPond version 2.12.2. For more information about how this fits with the other documentation, see About the documentation.

More information can be found at http://www.lilypond.org/. The website contains on-line copies of this and other documentation.

We want to dedicate this program to all the friends that we met through music.

Han-Wen and Jan


1. Musical notation

This chapter explains how to create musical notation.


1.1 Pitches

[image of music]

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

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

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
c d e f
g a b c
d e f g

[image of music]

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' c'' e' g
d'' d' d c
\clef bass
c, c,, e, g
d,, d, d c

[image of music]

See also

Music Glossary: Pitch names.

Snippets: Pitches.


Relative octave entry

When octaves are specified in absolute mode it is easy to accidentally put a pitch in the wrong octave. Relative octave mode reduces these errors since most of the time it is not necessary to indicate any octaves at all. Furthermore, in absolute mode a single mistake may be difficult to spot, while in relative mode a single error puts the rest of the piece off by one octave.

\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:

Here is the relative mode shown in action:

\relative c {
  \clef bass
  c d e f
  g a b c
  d e f g
}

[image of music]

Octave changing marks are used for intervals greater than a fourth:

\relative c'' {
  c g c f,
  c' a, e'' c
}

[image of music]

A note sequence without a single octave mark can nevertheless span large intervals:

\relative c {
  c f b e
  a d g c
}

[image of music]

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
  <c e g>
  <c' e g'>
  <c, e, g''>
}

[image of music]

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'' {
  c2 fis
  c2 ges
  b2 eisis
  b2 feses
}

[image of music]

See also

Music Glossary: fifth, interval, Pitch names.

Notation Reference: Octave checks.

Snippets: Pitches.

Internals Reference: RelativeOctaveMusic.

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.

If no startpitch is specified for \relative, then c' is assumed. However, this is a deprecated option and may disappear in future versions, so its use is discouraged.


Accidentals

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 Accidentals 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.

ais1 aes aisis aeses

[image of music]

A natural will cancel the effect of an accidental or key signature. However, naturals are not encoded into the note name syntax with a suffix; a natural pitch is shown as a simple note name:

a4 aes a2

[image of music]

Quarter tones may be added; the following is a series of Cs with increasing pitches:

ceseh1 ces ceh c cih cis cisih

[image of music]

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. These extra accidentals can also be used to produce natural signs.

cis cis cis! cis? c c c! c?

[image of music]

Accidentals on tied notes are only printed at the beginning of a new system:

cis1 ~ cis ~
\break
cis

[image of music]

Selected Snippets

Preventing extra naturals from being automatically added

In accordance with standard typesetting rules, a natural sign is printed before a sharp or flat if a previous accidental on the same note needs to be canceled. To change this behavior, set the extraNatural property to "false" in the Staff context.

\relative c'' {
  aeses4 aes ais a
  \set Staff.extraNatural = ##f
  aeses4 aes ais a
}

[image of music]

Makam example Makam is a type of melody from Turkey using 1/9th-tone microtonal alterations. Consult the initialization file makam.ly (see the ‘Learning Manual 2.12.2, 4.6.3 Other sources of information’ for the location of this file) for details of pitch names and alterations.

% Initialize makam settings
\include "makam.ly"

\relative c' {
  \set Staff.keySignature = #`((3 . ,BAKIYE) (6 . ,(- KOMA)))
  c4 cc db fk
  gbm4 gfc gfb efk
  fk4 db cc c
}

[image of music]

See also

Music Glossary: sharp, flat, double sharp, double flat, Pitch names, quarter tone.

Learning Manual: Accidentals 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 symbol does not conform to any standard.


Note names in other languages

There are predefined sets of note and accidental names for various other languages. To use them, include the language-specific init file listed below. For example, to use English notes names, add \include "english.ly" to the top of the input file.

The available language files and the note names they define are:

Language File

Note Names

nederlands.ly

c d e f g a bes b

arabic.ly

do re mi fa sol la sib si

catalan.ly

do re mi fa sol la sib si

deutsch.ly

c d e f g a b h

english.ly

c d e f g a bf b

espanol.ly

do re mi fa sol la sib si

italiano.ly

do re mi fa sol la sib si

norsk.ly

c d e f g a b h

portugues.ly

do re mi fa sol la sib si

suomi.ly

c d e f g a b h

svenska.ly

c d e f g a b h

vlaams.ly

do re mi fa sol la sib si

and the accidental suffixes they define are:

Language File

sharp

flat

double sharp

double flat

nederlands.ly

-is

-es

-isis

-eses

arabic.ly

-d

-b

-dd

-bb

catalan.ly

-d/-s

-b

-dd/-ss

-bb

deutsch.ly

-is

-es

-isis

-eses

english.ly

-s/-sharp

-f/-flat

-ss/-x/-sharpsharp

-ff/-flatflat

espanol.ly

-s

-b

-ss

-bb

italiano.ly

-d

-b

-dd

-bb

norsk.ly

-iss/-is

-ess/-es

-ississ/-isis

-essess/-eses

portugues.ly

-s

-b

-ss

-bb

suomi.ly

-is

-es

-isis

-eses

svenska.ly

-iss

-ess

-ississ

-essess

vlaams.ly

-k

-b

-kk

-bb

In Dutch, aes is contracted to as, but both forms are accepted in LilyPond. Similarly, both es and ees are accepted. This also applies to aeses / ases and eeses / eses. Sometimes only these contracted names are defined in the corresponding language files.

a2 as e es a ases e eses

[image of music]

Some music uses microtones whose alterations are fractions of a ‘normal’ sharp or flat. The note names for quarter-tones defined in the various language files are listed in the following table. Here the prefixes semi- and sesqui- mean ‘half’ and ‘one and a half’, respectively. For the other languages, no special names have been defined yet.

Language File

semi-sharp

semi-flat

sesqui-sharp

sesqui-flat

nederlands.ly

-ih

-eh

-isih

-eseh

arabic.ly

-sd

-sb

-dsd

-bsb

deutsch.ly

-ih

-eh

-isih

-eseh

english.ly

-qs

-qf

-tqs

-tqf

italiano.ly

-sd

-sb

-dsd

-bsb

portugues.ly

-sqt

-bqt

-stqt

-btqt

See also

Music Glossary: Pitch names.

Snippets: Pitches.


1.1.2 Changing multiple pitches

This section discusses how to modify pitches.


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'' {
  c2 d='4 d
  e2 f
}

[image of music]

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, but the previous note is not changed. Future notes are relative to the controlpitch.

\relative c'' {
  c2 d
  \octaveCheck c'
  e2 f
}

[image of music]

Compare the two bars below. The first and third \octaveCheck checks fail, but the second one does not fail.

\relative c'' {
  c4 f g f

  c4
  \octaveCheck c'
  f
  \octaveCheck c'
  g
  \octaveCheck c'
  f
}

[image of music]

See also

Snippets: Pitches.

Internals Reference: RelativeOctaveCheck.


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.

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 c' {
    \key d \major
    d4 fis a d
  }
}

[image of music]

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 c' {
    \key c \major
    c4 d e g
  }
}

[image of music]

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' { c d e f }
\new Staff {
  \transpose c cis { \music }
  \transpose c des { \music }
}

[image of 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 music with minimum accidentals 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:

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 (eq? n 6) (eq? n 2)))
      (set! a (- a 2))
      (set! n (+ n 1)))
     ((and (< a -1) (or (eq? n 0) (eq? 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 (lambda (x) (naturalize x)) 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 (parser location 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 { }
}

[image of music]

See also

Notation Reference: Instrument transpositions.

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.


1.1.3 Displaying pitches

This section discusses how to alter the output of pitches.


Clef

The clef may be altered. Middle C is shown in every example.

\clef treble
c2 c
\clef alto
c2 c
\clef tenor
c2 c
\clef bass
c2 c

[image of music]

Other clefs include:

\clef french
c2 c
\clef soprano
c2 c
\clef mezzosoprano
c2 c
\clef baritone
c2 c

\break

\clef varbaritone
c2 c
\clef subbass
c2 c
\clef percussion
c2 c
\clef tab
c2 c

[image of music]

Further supported clefs are described under Mensural clefs and Gregorian clefs.

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. The clef name must be enclosed in quotes when it contains underscores or digits.

\clef treble
c2 c
\clef "treble_8"
c2 c
\clef "bass^15"
c2 c

[image of music]

Selected Snippets

Tweaking clef properties

The command \clef "treble_8" is equivalent to setting clefGlyph, clefPosition (which controls the vertical position of the clef), middleCPosition and clefOctavation. A clef is printed when any of the properties except middleCPosition are changed.

Note that changing the glyph, the position of the clef, or the octavation does not in itself change the position of subsequent notes on the staff: the position of middle C must also be specified to do this. The positional parameters are relative to the staff center line, positive numbers displacing upwards, counting one for each line and space. The clefOctavation value would normally be set to 7, -7, 15 or -15, but other values are valid.

When a clef change takes place at a line break the new clef symbol is printed at both the end of the previous line and the beginning of the new line by default. If the warning clef at the end of the previous line is not required it can be suppressed by setting the Staff property explicitClefVisibility to the value end-of-line-invisible. The default behavior can be recovered with \unset Staff.explicitClefVisibility.

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.

\layout { ragged-right = ##t }

{
  % The default treble clef
  c'1
  % The standard bass clef
  \set Staff.clefGlyph = #"clefs.F"
  \set Staff.clefPosition = #2
  \set Staff.middleCPosition = #6
  c'1
  % The baritone clef
  \set Staff.clefGlyph = #"clefs.C"
  \set Staff.clefPosition = #4
  \set Staff.middleCPosition = #4
  c'1
  % The standard choral tenor clef
  \set Staff.clefGlyph = #"clefs.G"
  \set Staff.clefPosition = #-2
  \set Staff.clefOctavation = #-7
  \set Staff.middleCPosition = #1
  c'1
  % A non-standard clef
  \set Staff.clefPosition = #0
  \set Staff.clefOctavation = #0
  \set Staff.middleCPosition = #-4
  c'1 \break

  % The following clef changes do not preserve
  % the normal relationship between notes 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.clefOctavation = #7
  c'1
  \set Staff.clefOctavation = #0
  \set Staff.clefPosition = #0
  c'1
  
  % Return to the normal clef:

  \set Staff.middleCPosition = #0
  c'1
}

[image of music]

See also

Notation Reference: Mensural clefs, Gregorian clefs.

Snippets: Pitches.

Internals Reference: Clef_engraver, Clef, OctavateEight, clef-interface.


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 Accidentals 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.

\key g \major
fis1
f
fis

[image of music]

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 "false" 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
}

[image of music]

Non-traditional key signatures

The commonly used \key command sets the keySignature 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.keySignature = #`(((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. (Note the leading comma.) The accidentals in the key signature will appear in the reverse order to that in which they are specified.

Alternatively, for each item in the list, using the more concise format (step . alter) specifies that the same alteration should hold in all octaves.

For microtonal scales where a "sharp" is not 100 cents, alter refers to the alteration as a proportion of a 200-cent whole tone.

Here is an example of a possible key signature for generating a whole-tone scale:

\relative c' {
  \set Staff.keySignature = #`(((0 . 3) . ,SHARP)
                               ((0 . 5) . ,FLAT)
                               ((0 . 6) . ,FLAT))
  c4 d e fis
  aes4 bes c2
}

[image of music]

See also

Music Glossary: church mode, scordatura.

Learning Manual: Accidentals and key signatures.

Snippets: Pitches.

Internals Reference: KeyChangeEvent, Key_engraver, Key_performer, KeyCancellation, KeySignature, key-cancellation-interface, key-signature-interface.


Ottava brackets

Ottava brackets introduce an extra transposition of an octave for the staff:

a'2 b
\ottava #1
a b
\ottava #0
a b

[image of music]

The ottava function also takes -1 (for 8va bassa), 2 (for 15ma), and -2 (for 15ma bassa) as arguments.

Selected Snippets

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.

{
  \ottava #1
  \set Staff.ottavation = #"8"
  c''1
  \ottava #0
  c'1
  \ottava #1
  \set Staff.ottavation = #"Text"
  c''1
}

[image of music]

See also

Music Glossary: octavation.

Snippets: Pitches.

Internals Reference: Ottava_spanner_engraver, OttavaBracket, ottava-bracket-interface.


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" {
    \relative c'' {
      \set Staff.instrumentName = #"Vln"
      \set Staff.midiInstrument = #"violin"
      % not strictly necessary, but a good reminder
      \transposition c'

      \key c \major
      g4( c8) r c r c4
    }
  }
  \new Staff = "clarinet" {
    \relative c'' {
      \set Staff.instrumentName = \markup { Cl (B\flat) }
      \set Staff.midiInstrument = #"clarinet"
      \transposition bes

      \key d \major
      a4( d8) r d r d4
    }
  }
>>

[image of music]

The \transposition may be changed during a piece. For example, a clarinetist may switch from an A clarinet to a B-flat clarinet.

\set Staff.instrumentName = #"Cl (A)"
\key a \major
\transposition a
c d e f
\textLengthOn
s1*0^\markup { Switch to B\flat clarinet }
R1

\key bes \major
\transposition bes
c2 g

[image of music]

See also

Music Glossary: concert pitch, transposing instrument.

Notation Reference: Quoting other voices, Transpose.

Snippets: Pitches.


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 <<
  #(set-accidental-style '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:

#(set-accidental-style 'voice 'StaffGroup)

The following accidental styles are supported. To demonstrate each style, we use the following example:

musicA = {
  <<
    \relative c' {
      cis'8 fis, d'4 <a cis>8 f bis4 |
      cis2. <c, g'>4 |
    }
    \\
    \relative c' {
      ais'2 cis, |
      fis8 b a4 cis2 |
    }
  >>
}

musicB = {
  \clef bass
  \new Voice {
    \voiceTwo \relative c' {
      <fis, a cis>4
      \change Staff = up
      cis'
      \change Staff = down
      <fis, a>
      \change Staff = up
      dis' |
      \change Staff = down
      <fis, a cis>4 gis <f a d>2 |
    }
  }
}

\new PianoStaff {
  <<
    \context Staff = "up" {
      #(set-accidental-style 'default)
      \musicA
    }
    \context Staff = "down" {
      #(set-accidental-style 'default)
      \musicB
    }
  >>
}

[image of music]

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 {
  <<
    \context Staff = "up" {
      %%% change the next line as desired:
      #(set-accidental-style 'default 'Score)
      \musicA
    }
    \context 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 last c:

[image of music]

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 to default.

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. The voice 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) then modern or modern-cautionary should be used instead.

[image of music]

modern

This rule corresponds to the common practice in the twentieth century. It prints the same accidentals as default, with two exceptions 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 the b and the c in the second measure of the upper staff:

[image of music]

modern-cautionary

This rule is similar to modern, but the ‘extra’ accidentals (the ones not typeset by default) are typeset as cautionary accidentals. They are by default printed with parentheses, but they can also be printed in reduced size by defining the cautionary-style property of AccidentalSuggestion.

[image of music]

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, the a in the last measure is canceled because the previous cancellation was in a different voice, and the d in the lower staff is canceled because of the accidental in a different voice in the previous measure:

[image of music]

modern-voice-cautionary

This rule is the same as modern-voice, but with the extra accidentals (the ones not typeset by voice) typeset as cautionaries. Even though all accidentals typeset by default are typeset with this rule, some of them are typeset as cautionaries.

[image of music]

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 same GrandStaff or PianoStaff, hence all the cancellations of the final notes.

This accidental style applies to the current GrandStaff or PianoStaff by default.

[image of music]

piano-cautionary

This is the same as piano but with the extra accidentals typeset as cautionaries.

[image of music]

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.

[image of music]

neo-modern-cautionary

This rule is similar to neo-modern, but the extra accidentals are printed as cautionary accidentals.

[image of music]

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.

[image of music]

teaching

This rule is intended for students, and makes it easy to create scale sheets with automagically 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.

[image of music]

no-reset

This is the same as default but with accidentals lasting ‘forever’ and not only within the same measure:

[image of music]

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. Unlike dodecaphonic, this rule never prints any naturals.

[image of music]

Selected Snippets

Dodecaphonic-style accidentals for each note including naturals In early 20th century works, starting with Schoenberg, Berg and Webern (the "Second" Viennese school), every pitch in the twelve-tone scale has to be regarded as equal, without any hierarchy such as the classical (tonal) degrees. Therefore, these composers print one accidental for each note, even at natural pitches, to emphasize their new approach to music theory and language.

This snippet shows how to achieve such notation rules.

\score {
  \new Staff {
    #(set-accidental-style 'dodecaphonic)
    c'4 dis' cis' cis'
    c'4 dis' cis' cis'
    c'4 c' dis' des'
  }
  \layout {
    \context {
      \Staff
      \remove "Key_engraver"
    }
  }
}

[image of music]

See also

Snippets: Pitches.

Internals Reference: Accidental, Accidental_engraver, GrandStaff and PianoStaff, Staff, AccidentalSuggestion, AccidentalPlacement, accidental-suggestion-interface.

Known issues and warnings

Simultaneous notes are considered to be entered in sequential mode. This means that in a chord the accidentals are typeset as if the notes in the chord happen one at a time, in the order in which they appear in the input file. This is a problem when accidentals in a chord depend on each other, which does not happen for the default accidental style. The problem can be solved by manually inserting ! and ? for the problematic notes.


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 c'' {
  aes c e2
  cis,1
}

[image of music]

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
  }
>>

[image of music]

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
  }
>>

[image of music]

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.


1.1.4 Note heads

This section suggests ways of altering note heads.


Special note heads

Note heads may be altered:

c4 b a b
\override NoteHead #'style = #'cross
c4 b a b
\revert NoteHead #'style
c4 d e f

[image of music]

There is a shorthand for diamond shapes which can only be used inside chords:

<c f\harmonic>2 <d a'\harmonic>4 <c g'\harmonic>

[image of music]

To see all note head styles, see Note head styles.

See also

Snippets: Pitches.

Notation Reference: Note head styles, Chorded notes.

Internals Reference: note-event, Note_heads_engraver, Ledger_line_engraver, NoteHead, LedgerLineSpanner, note-head-interface, ledger-line-spanner-interface.


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
}

[image of music]

Predefined commands

\easyHeadsOn, \easyHeadsOff.

See also

Notation Reference: Setting the staff size.

Snippets: Pitches.

Internals Reference: note-event, Note_heads_engraver, NoteHead, note-head-interface.


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:

\aikenHeads
c, d e f g a b c
\sacredHarpHeads
c, d e f g a b c

[image of music]

Shapes are typeset according to the step in the scale, where the base of the scale is determined by the \key command.

Predefined commands

\aikenHeads, \sacredHarpHeads.

Selected Snippets

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
}

\score {
  \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
    }
  }
  \layout { ragged-right = ##t }
}

[image of music]

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.


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"
} {
  e8 e g a a16( bes) a8 g
  \improvisationOn
  e8 ~
  e2 ~ e8 f4 f8 ~
  f2
  \improvisationOff
  a16( bes) a8 g e
}

[image of music]

Predefined commands

\improvisationOn, \improvisationOff.

See also

Snippets: Pitches.

Internals Reference: Pitch_squash_engraver, Voice, RhythmicStaff.


1.2 Rhythms

[image of music]

This section discusses rhythms, rests, durations, beaming and bars.


1.2.1 Writing rhythms


Durations

Durations are designated by numbers and dots. Durations are entered as their reciprocal values. For example, a quarter note is entered using a 4 (since it is a 1/4 note), and a half note is entered using a 2 (since it is a 1/2 note). For notes longer than a whole you must use the \longa (a double breve) and \breve commands. Durations as short as 128th notes may be specified. Shorter values are possible, but only as beamed notes.

\time 8/1
c\longa c\breve c1 c2
c4 c8 c16 c32 c64 c64

[image of music]

Here are the same durations with automatic beaming turned off.

\time 8/1
\autoBeamOff
c\longa c\breve c1 c2
c4 c8 c16 c32 c64 c64

[image of music]

A note with the duration of a quadruple breve may be entered with \maxima, but this is supported only within ancient music notation. For details, see Ancient notation.

If the duration is omitted, it is set to the previously entered duration. The default for the first note is a quarter note.

a a a2 a a4 a a1 a

[image of music]

To obtain dotted note lengths, place a dot (.) after the duration. Double-dotted notes are specified by appending two dots, and so on.

a4 b c4. b8 a4. b4.. c8.

[image of music]

Some durations cannot be represented with just binary durations and dots; they can be represented only by tying two or more notes together. For details, see Ties.

For ways of specifying durations for the syllables of lyrics and ways of aligning lyrics to notes, see Vocal music.

Optionally, notes can be spaced strictly proportionately to their duration. For details of this and other settings which control proportional notation, see Proportional notation.

Dots are normally moved up to avoid staff lines, except in polyphonic situations. Predefined commands are available to force a particular direction manually, for details see Direction and placement.

Predefined commands

\autoBeamOff, \dotsUp, \dotsDown, \dotsNeutral.

See also

Music Glossary: breve, longa, maxima, note value, Duration names notes and rests.

Notation Reference: Automatic beams, Ties, Writing rhythms, Writing rests, Vocal music, Ancient notation, Proportional notation.

Snippets: Rhythms.

Internals Reference: Dots, DotColumn.

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: rests from 128th to maxima (8 x whole) may be printed.


Tuplets

Tuplets are made from a music expression by multiplying all the durations with a fraction:

\times fraction { music }

The duration of music will be multiplied by the fraction. The fraction’s denominator will be printed over or under the notes, optionally with a bracket. The most common tuplet is the triplet in which 3 notes have the duration of 2, so the notes are 2/3 of their written length.

a2 \times 2/3 { b4 b b }
c4 c \times 2/3 { b4 a g }

[image of music]

The automatic placement of the tuplet bracket above or below the notes may be overridden manually with predefined commands, for details see Direction and placement.

Tuplets may be nested:

\autoBeamOff
c4 \times 4/5 { f8 e f \times 2/3 { e[ f g] } } f4 |

[image of music]

Modifying nested tuplets which begin at the same musical moment must be done with \tweak.

To modify the duration of notes without printing a tuplet bracket, see Scaling durations.

Predefined commands

\tupletUp, \tupletDown, \tupletNeutral.

Selected Snippets

Entering several tuplets using only one \times command

The property tupletSpannerDuration sets how long each of the tuplets contained within the brackets after \times should last. Many consecutive tuplets can then be placed within a single \times expression, thus saving typing.

In the example, two triplets are shown, while \times was entered only once.

For more information about make-moment, see "Time administration".

\relative c' {
  \time 2/4
  \set tupletSpannerDuration = #(ly:make-moment 1 4)
  \times 2/3 { c8 c c c c c }
}

[image of music]

Changing the tuplet number

By default, only the numerator of the tuplet number is printed over the tuplet bracket, i.e., the denominator of the argument to the \times command. Alternatively, num:den of the tuplet number may be printed, or the tuplet number may be suppressed altogether.

\relative c'' {
  \times 2/3 { c8 c c }
  \times 2/3 { c8 c c }
  \override TupletNumber #'text = #tuplet-number::calc-fraction-text
  \times 2/3 { c8 c c }
  \override TupletNumber #'stencil = ##f
  \times 2/3 { c8 c c }
}

[image of music]

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 { \times 2/3 { c[ b a] } }
  % Insert a manual line break within a tuplet
  \times 2/3 { c[ b \bar "" \break a] }
  \repeat unfold 5 { \times 2/3 { c[ b a] } }
  c8
}

[image of music]

See also

Music Glossary: triplet, tuplet, polymetric.

Learning Manual: Tweaking methods.

Notation Reference: Time administration, Scaling durations, The \tweak command, Polymetric notation.

Snippets: Rhythms.

Internals Reference: TupletBracket, TupletNumber, TimeScaledMusic.

Known issues and warnings

When the first note on a staff is a grace note followed by a tuplet the grace note must be placed before the \times command to avoid errors. Anywhere else, grace notes may be placed within tuplet brackets.


Scaling durations

You can alter the duration of single notes, rests or chords by a fraction N/M by appending *N/M (or *N if M is 1) to the duration. This 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 such as *L*M/N.

In the following example, the first three notes take up exactly two beats, but no triplet bracket is printed.

\time 2/4
% Alter durations to triplets
a4*2/3 gis4*2/3 a4*2/3
% Normal durations
a4 a4
% Double the duration of chord
<a d>4*2
% Duration of quarter, appears like sixteenth
b16*4 c4

[image of music]

The duration of skip or spacing notes 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 fraction num/den. The spaces around the dot are required. Here is an example showing how music can be compressed and expanded:

\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 . 1) {
  <c' a>4 c8 b
}

[image of music]

One application of this command is in polymetric notation, see Polymetric notation.

See also

Notation Reference: Tuplets, Invisible rests, Polymetric notation.

Snippets: Rhythms.


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 using the tilde symbol ~

a2 ~ a

[image of music]

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 c' {
  r8 c8 ~ c2 r4 |
  r8^"not" c2 ~ c8 r4
}

[image of music]

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 tie inside the chord.

<c e g> ~ <c e g>
<c~ e g~ b> <c e g b>

[image of music]

When a second alternative of a repeat starts with a tied note, you have to specify the repeated tie as follows:

\repeat volta 2 { c g <c e>2 ~ }
\alternative {
  % First alternative: following note is tied normally
  { <c e>2. r4 }
  % Second alternative: following note has a repeated tie
  { <c e>2\repeatTie d4 c } }

[image of music]

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

[image of music]

The vertical placement of ties may be controlled, see Predefined commands, or for details, see Direction and placement.

Solid, dotted or dashed ties may be specified, see Predefined commands.

Predefined commands

\tieUp, \tieDown, \tieNeutral, \tieDotted, \tieDashed, \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
}

[image of music]

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 staff-spaces, and the second number indicates the direction (1 = up, -1 = down).

\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> ~ <c e g>
}

[image of music]

See also

Music Glossary: tie, laissez vibrer.

Notation Reference: Automatic note splitting.

Snippets: 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 octavations during a tie is not really well-defined. In these cases, a slur may be preferable.


1.2.2 Writing rests

Rests are entered as part of the music in music expressions.


Rests

Rests are entered like notes with the note name r. Durations longer than a whole rest use the predefined commands shown:

\new Staff {
  % These two lines are just to prettify this example
  \time 16/1
  \override Staff.TimeSignature #'stencil = ##f
  % 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
}

[image of music]

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.

a4\rest d4\rest

[image of music]

Selected Snippets

Rest styles

Rests may be used in various styles.

\layout {
  indent = 0.0
  \context {
    \Staff
    \remove "Time_signature_engraver"
  }
}

\new Staff \relative c {
  \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 ""
  
  \override Staff.Rest #'style = #'neomensural
  r\maxima^\markup \typewriter { neomensural }
  r\longa r\breve r1 r2 r4 r8 r16 s32 s64 s128 s128
  \bar ""
  
  \override Staff.Rest #'style = #'classical
  r\maxima^\markup \typewriter { classical }
  r\longa r\breve r1 r2 r4 r8 r16 r32 r64 r128 s128
  \bar ""
  
  \override Staff.Rest  #'style = #'default
  r\maxima^\markup \typewriter { default }
  r\longa r\breve r1 r2 r4 r8 r16 r32 r64 r128 s128
}

[image of music]

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 128th to maxima (8 x whole).


Invisible rests

An invisible rest (also called a ‘spacer rest’) can be entered like a note with the note name s:

c4 c s c
s2 c

[image of music]

Spacer rests are available only in note mode and chord mode. In other situations, for example, when entering lyrics, \skip is used to skip a musical moment. \skip requires an explicit duration.

<<
  {
    a2 \skip2 a2 a2
  }
  \new Lyrics {
    \lyricmode {
      foo2 \skip 1 bla2
    }
  }
>>

[image of music]

A spacer rest implicitly causes Staff and Voice contexts to be created if none exist, just like notes and rests do:

s1 s s

[image of music]

\skip simply skips musical time; it creates no output of any kind.

% This is valid input, but does nothing
\skip 1 \skip1 \skip 1

[image of music]

See also

Snippets: Rhythms.

Internals Reference: SkipMusic


Full measure rests

Rests for one or more full measures are entered like notes with the note name uppercase R:

% Rest measures contracted to single measure
\compressFullBarRests
R1*4
R1*24
R1*4
b2^"Tutti" b4 a4

[image of music]

The duration of full-measure rests is identical to the duration notation used for notes. The duration in a multi-measure rest must always be an integral number of measure-lengths, so augmentation dots or fractions must often be used:

\compressFullBarRests
\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 |

[image of music]

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 |

[image of music]

By default a multi-measure rest is expanded in the printed score to show all the rest measures explicitly. Alternatively, a multi-measure rest can 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
\compressFullBarRests
r1 | R1*17 | R1*4 |
% Rest measures expanded
\expandFullBarRests
\time 3/4
R2.*2 |

[image of music]

Markups can be added to multi-measure rests. The predefined command \fermataMarkup is provided for adding fermatas.

\compressFullBarRests
\time 3/4
R2.*10^\markup { \italic "ad lib." }
R2.^\fermataMarkup

[image of music]

Note: Markups attached to a multi-measure rest are objects of type MultiMeasureRestText, not TextScript. 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
R1^"wrong"
% This is correct and works
\override MultiMeasureRestText #'padding = #5
R1^"right"

[image of music]

When a multi-measure rest immediately follows a \partial setting, resulting bar-check warnings may not be displayed.

Predefined commands

\textLengthOn, \textLengthOff, \fermataMarkup, \compressFullBarRests, \expandFullBarRests.

Selected Snippets

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'' {
  \compressFullBarRests
  R1*2 | R1*5 | R1*9
  \override MultiMeasureRest #'expand-limit = #3
  R1*2 | R1*5 | R1*9
}

[image of music]

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 second line
  R1
  % They can be moved with an override
  \override MultiMeasureRest #'staff-position = #-2
  R1
  % A value of 0 is the default position;
  % the following trick moves the rest to the center line
  \override MultiMeasureRest #'staff-position = #-0.01
  R1
  % Multi-measure rests in odd-numbered voices are under the top line
  << { R1 } \\ { a1 } >>
  % Multi-measure rests in even-numbered voices are under the bottom line
  << { c1 } \\ { R1 } >>
  % They remain separated even in empty measures
  << { R1 } \\ { R1 } >>
  % This brings them together even though there are two voices
  \compressFullBarRests
  <<
    \revert MultiMeasureRest #'staff-position
    { R1*3 }
    \\
    \revert MultiMeasureRest #'staff-position
    { R1*3 }
  >>
}

[image of music]

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 a spacer rest with an attached markup before the multi-measure rest.

Note that the spacer rest causes a bar line to be inserted. 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' {
  \compressFullBarRests
  \textLengthOn
  s1*0^\markup { [MAJOR GENERAL] }
  R1*19
  s1*0_\markup { \italic { Cue: ... it is yours } }
  s1*0^\markup { A }
  R1*30^\markup { [MABEL] }
  \textLengthOff
  c4^\markup { CHORUS } d f c
}

[image of music]

See also

Music Glossary: multi-measure rest.

Notation Reference: Durations, Text, Formatting text, Text scripts.

Snippets: Rhythms.

Internals Reference: MultiMeasureRest, MultiMeasureRestNumber, MultiMeasureRestText.

Known issues and warnings

If an attempt is made to use fingerings (e.g., R1*10-4) to put numbers over multi-measure rests, the fingering numeral (4) may collide with the bar counter numeral (10).

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.


1.2.3 Displaying rhythms


Time signature

The time signature is set as follows:

\time 2/4 c2
\time 3/4 c2.

[image of music]

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.

\time 2/4
c2 c
\break
c c
\break
\time 4/4
c c c c

[image of music]

The time signature symbol that is used in 2/2 and 4/4 time can be changed to a numeric style:

% 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

[image of music]

Mensural time signatures are covered in Mensural time signatures.

Predefined commands

\numericTimeSignature, \defaultTimeSignature.

Selected Snippets

Changing the time signature without affecting the beaming

The \time command sets the properties timeSignatureFraction, beatLength, beatGrouping and measureLength in the Timing context, which is normally aliased to Score. Changing the value of timeSignatureFraction causes the new time signature symbol to be printed without changing any of the other properties:

\relative c'' {
  \time 3/4
  a16 a a a a a a a a a a a

  % Change time signature symbol but keep 3/4 beaming
  % due to unchanged underlying time signature
  \set Score.timeSignatureFraction = #'(12 . 16)
  a16 a a a a a a a a a a a

  \time 12/16
  % Lose 3/4 beaming now \time has been changed
  a16 a a a a a a a a a a a
}

[image of music]

Compound time signatures

Odd 20th century time signatures (such as "5/8") can often be played as compound time signatures (e.g. "3/8 + 2/8"), which combine two or more inequal metrics. LilyPond can make such music quite easy to read and play, by explicitly printing the compound time signatures and adapting the automatic beaming behavior. (Graphic measure grouping indications can also be added; see the appropriate snippet in this database.)

#(define ((compound-time one two num) grob)
  (grob-interpret-markup grob
    (markup #:override '(baseline-skip . 0) #:number
      (#:line (
          (#:column (one num))
          #:vcenter "+"
          (#:column (two num))))
      )))

\relative c' {
  \override Staff.TimeSignature #'stencil = #(compound-time "2" "3" "8")
  \time 5/8
  #(override-auto-beam-setting '(end 1 8 5 8) 1 4)
  c8 d e fis gis
  c8 fis, gis e d
  c8 d e4 gis8
}

[image of music]

See also

Music Glossary: time signature

Notation Reference: Mensural time signatures, Time administration.

Snippets: Rhythms.

Internals Reference: TimeSignature, Timing_translator.


Upbeats

Partial or pick-up measures, such as an anacrusis or upbeat, are entered using the \partial command, with the syntax

\partial duration

where duration is the rhythmic length of the interval before the start of the first complete measure:

\partial 4 e4 |
a2. c,4 |

[image of music]

The partial measure can be any duration less than a full measure:

\partial 8*3 c8 d e |
a2. c,4 |

[image of music]

Internally, this is translated into

\set Timing.measurePosition = -duration

The property measurePosition contains a rational number indicating how much of the measure has passed at this point. Note that this is set to a negative number by the \partial command: i.e., \partial 4 is internally translated to -4, meaning “there is a quarter note left in the measure.”

See also

Music Glossary: anacrusis.

Notation Reference: Grace notes.

Snippets: Rhythms.

Internal Reference: Timing_translator.

Known issues and warnings

The \partial command is intended to be used only at the beginning of a piece. If you use it after the beginning, some odd warnings may occur.


Unmetered music

Bar lines and bar numbers are calculated automatically. For unmetered music (some cadenzas, for example), this is not desirable. To turn off automatic calculation of bar lines and bar numbers, use the command \cadenzaOn, and use \cadenzaOff to turn them on again.

c4 d e d
\cadenzaOn
c4 c d8 d d f4 g4.
\cadenzaOff
\bar "|"
d4 e d c

[image of music]

Bar numbering is resumed at the end of the cadenza as if the cadenza were not there:

% Show all bar numbers
\override Score.BarNumber #'break-visibility = #all-visible
c4 d e d
\cadenzaOn
c4 c d8 d d f4 g4.
\cadenzaOff
\bar "|"
d4 e d c

[image of music]

Predefined commands

\cadenzaOn, \cadenzaOff.

See also

Music Glossary: cadenza.

Notation Reference:

Snippets: Rhythms.

Known issues and warnings

LilyPond will insert line breaks and page breaks only at a bar line. Unless the unmetered music ends before the end of the staff line, you will need to insert invisible bar lines with

\bar ""

to indicate where breaks can occur.


Polymetric notation

Polymetric notation is supported, either explicitly or by modifying the visible time signature symbol and scaling the note durations.

Staves with different time signatures, equal measure lengths

This notation can be created by setting a common time signature for each staff but replacing the symbol manually by setting timeSignatureFraction to the desired fraction and scaling the printed durations in each staff to the common time signature; see Time signature. The scaling is done with \scaleDurations, which is used in a similar way to \times, but does not create a tuplet bracket; see Scaling durations.

In this example, music with the time signatures of 3/4, 9/8, and 10/8 are used in parallel. In the second staff, shown durations are multiplied by 2/3, as 2/3 * 9/8 = 3/4, and in the third staff, shown durations are multiplied by 3/5, as 3/5 * 10/8 = 3/4. It will often be necessary to insert beams manually, as the duration scaling affects the autobeaming rules.

\relative c' <<
  \new Staff {
    \time 3/4
    c4 c c |
    c 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. c4. \times 2/3 { c8[ c c] } c4
    }
  }
>>

[image of music]

Staves with different time signatures, unequal bar lengths

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 c' <<
  \new Staff {
    \time 3/4
    c4 c c |
    c c c |
  }
  \new Staff {
    \time 2/4
    c4 c |
    c c |
    c c |
  }
  \new Staff {
    \time 3/8
    c4. |
    c8 c c |
    c4. |
    c8 c c |
  }
>>

[image of music]

Selected Snippets

Compound time signatures

Odd 20th century time signatures (such as "5/8") can often be played as compound time signatures (e.g. "3/8 + 2/8"), which combine two or more inequal metrics. LilyPond can make such music quite easy to read and play, by explicitly printing the compound time signatures and adapting the automatic beaming behavior. (Graphic measure grouping indications can also be added; see the appropriate snippet in this database.)

#(define ((compound-time one two num) grob)
  (grob-interpret-markup grob
    (markup #:override '(baseline-skip . 0) #:number
      (#:line (
          (#:column (one num))
          #:vcenter "+"
          (#:column (two num))))
      )))

\relative c' {
  \override Staff.TimeSignature #'stencil = #(compound-time "2" "3" "8")
  \time 5/8
  #(override-auto-beam-setting '(end 1 8 5 8) 1 4)
  c8 d e fis gis
  c8 fis, gis e d
  c8 d e4 gis8
}

[image of music]

See also

Music Glossary: polymetric, polymetric time signature, meter.

Notation Reference: Time signature, Scaling durations.

Snippets: Rhythms.

Internals Reference: TimeSignature, Timing_translator, Default_bar_line_engraver, Staff.

Known issues and warnings

When using different time signatures in parallel, notes at the same moment will be be placed at the same horizontal location. However, the bar lines in the different staves will cause the note spacing to be less regular in each of the individual staves than would be normal without the different time signatures.


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. In the following example, notes crossing the bar lines are split and tied.

\new Voice \with {
  \remove "Note_heads_engraver"
  \consists "Completion_heads_engraver"
}

{ c2. c8 d4 e f g a b c8 c2 b4 a g16 f4 e d c8. c2 }

[image of music]

This engraver splits all running notes at the bar line, and inserts ties. One of its uses is to debug complex scores: if the measures are not entirely filled, then the ties show exactly how much each measure is off.

See also

Music Glossary: tie

Learning Manual: Engravers explained, Adding and removing engravers.

Snippets: Rhythms.

Internals Reference: Note_heads_engraver, Completion_heads_engraver, Forbid_line_break_engraver.

Known issues and warnings

Not all durations (especially those containing tuplets) can be represented exactly with normal notes and dots, but the Completion_heads_engraver will not insert tuplets.

The Completion_heads_engraver only affects notes; it does not split rests.


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" {
      \time 4/4
      c4 e8 f g2
      r4 g g f
      g1
    }
  }
  \new Lyrics {
    \lyricsto "myRhythm" {
      This is my song
      I like to sing
    }
  }
>>

[image of music]

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
  }
>>

[image of music]

Predefined commands

\improvisationOn, \improvisationOff.

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.
    }
  }
>>

[image of music]

See also

Snippets: Rhythms.

Internals Reference: RhythmicStaff, Pitch_squash_engraver.


1.2.4 Beams


Automatic beams

By default, beams are inserted automatically:

\time 2/4 c8 c c c
\time 6/8 c c c c8. c16 c8

[image of music]

If these automatic decisions are not satisfactory, beaming can be entered explicitly; see Manual beams. It is also possible to define beaming patterns that differ from the defaults. The default beaming rules for most common time signatures are defined in ‘scm/auto-beam.scm’. If there are no beaming rules defined for a particular beam’s duration in the time signature being used, its beaming is controlled by the values of three context properties, measureLength, beatLength and beatGrouping. Both the beaming rules and the context properties can be overridden, see Setting automatic beam behavior.

Note: If beams are used to indicate melismata in songs, then automatic beaming should be switched off with autoBeamOff and the beams indicated manually.

Automatic beaming may be turned off and on with \autoBeamOff and \autoBeamOn commands:

c4 c8 c8. c16 c8. c16 c8
\autoBeamOff
c4 c8 c8. c16 c8.
\autoBeamOn
c16 c8

[image of music]

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
}

[image of music]

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
}

[image of music]

See also

Notation Reference: Manual beams, Setting automatic beam behavior.

Installed Files: ‘scm/auto-beam.scm’.

Snippets: Rhythms.

Internals Reference: Beam.

Known issues and warnings

Automatically kneed cross-staff beams cannot be used together with hidden staves. See Hiding staves.

Beams can collide with note heads and accidentals in other voices


Setting automatic beam behavior

The placement of automatic beams is determined by the rules described in Automatic beams. There are two mutually exclusive ways in which these rules may be modified. The first, modifying the grouping of beats, applies to uncommon time signatures, i.e. those for which there are no predefined rules defining the beam end points. The second method, modifying the specification of the beam end points, can be used for any time signature. This second method must be used for those time signatures and beam durations combinations for which beam ending rules are pre-defined, unless these have all been reverted. There are predefined rules for time signatures of 3/2, 3/4, 4/4, 2/4, 4/8, 4/16, 6/8, 9/8 and 12/8.

Modifying the grouping of beats

If there are no beam-ending rules defined for the beam duration of a particular beam in the time signature in use, its beaming is controlled by three context properties: measureLength, beatLength and beatGrouping. These properties may be set in the Score, Staff or Voice contexts to delimit their scope. The default values are set while processing \time commands, so the \set commands must be placed after all \time commands.

These determine the beaming as follows:

Beams may begin anywhere (unless a beam is already active). Beams end at a time determined by the values of beatGrouping and beatLength, as follows:

Note: These three properties become effective for a particular beam only if there are no beam-ending rules predefined for that beam’s duration in the time signature in use, or if these beam-ending rules have all been reverted.

By default the measureLength and beatLength are derived from the time signature set by the \time command. The measureLength is set to be exactly the same length as the measure length given by the time signature, and the beatLength is set to be the same as one over the denominator of the time signature.

The default value of beatGrouping is taken from a table in ‘scm/music-functions.scm’. To find this, see Other sources of information. It defines the beat grouping for 5/8, 6/8, 8/8, 9/8 and 12/8 time signatures.

Both measureLength and beatLength are moments, units 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.

beatGrouping is a list of integers giving the number of beats in each group.

Selected Snippets

Grouping beats

Beaming patterns may be altered with the beatGrouping property:

\relative c'' {
  \time 5/16
  #(override-auto-beam-setting '(end * * 5 16) 5 16)
  \set beatGrouping = #'(2 3)
  c8^"(2+3)" c16 c8
  \set beatGrouping = #'(3 2)
  c8^"(3+2)" c16 c8
}

[image of music]

Specifying context with beatGrouping

By specifying the context, the effect of beatGrouping can be limited to the context specified, and the values which may have been set in higher-level contexts can be overridden. The \set commands must be placed after all \time commands:

\score {
  \new Staff <<
    \time 7/8
    \new Voice {
      \relative c'' {
        \set Staff.beatGrouping = #'(2 3 2)
        a8 a a a a a a
      }
    }
    \new Voice {
      \relative c' {
        \voiceTwo
        \set beatGrouping = #'(1 3 3)
        f8 f f f f f f
      }
    }
  >>
}

[image of music]

Using beatLength and beatGrouping

The property measureLength determines where bar lines should be inserted and, with beatLength and beatGrouping, how automatic beams should be generated for beam durations and time signatures for which no beam-ending rules are defined. This example shows several ways of controlling beaming by setting these properties. The explanations are shown as comments in the code.

\relative c'' {
  \time 3/4
  % The default in 3/4 time is to beam in three groups
  % each of a quarter note length
  a16 a a a a a a a a a a a

  \time 12/16
  % No auto-beaming is defined for 12/16
  a16 a a a a a a a a a a a

  \time 3/4
  % Change time signature symbol, but retain underlying 3/4 beaming
  \set Score.timeSignatureFraction = #'(12 . 16)
  a16 a a a a a a a a a a a

  % The 3/4 time default grouping of (1 1 1) and beatLength of 1/8
  % are not consistent with a measureLength of 3/4, so the beams
  % are grouped at beatLength intervals
  \set Score.beatLength = #(ly:make-moment 1 8)
  a16 a a a a a a a a a a a

  % Specify beams in groups of (3 3 2 3) 1/16th notes
  % 3+3+2+3=11, and 11*1/16<>3/4, so beatGrouping does not apply,
  % and beams are grouped at beatLength (1/16) intervals
  \set Score.beatLength = #(ly:make-moment 1 16)
  \set Score.beatGrouping = #'(3 3 2 3)
  a16 a a a a a a a a a a a

  % Specify beams in groups of (3 4 2 3) 1/16th notes
  % 3+4+2+3=12, and 12*1/16=3/4, so beatGrouping applies
  \set Score.beatLength = #(ly:make-moment 1 16)
  \set Score.beatGrouping = #'(3 4 2 3)
  a16 a a a a a a a a a a a
}

[image of music]

Sub-dividing beams

The beams of consecutive 16th (or shorter) notes are, by default, not sub-divided. That is, the three (or more) beams stretch unbroken over entire groups of notes. This behavior can be modified to sub-divide the beams into sub-groups by setting the property subdivideBeams. When set, multiple beams will be sub-divided at intervals defined by the current value of beatLength by reducing the multiple beams to just one beam between the sub-groups. Note that beatLength 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 make-moment function, as shown here:

\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 beatLength = #(ly:make-moment 1 8)
  c32[ c c c c c c c]

  % Set beam sub-group length to a sixteenth note
  \set beatLength = #(ly:make-moment 1 16)
  c32[ c c c c c c c]
}

[image of music]

Conducting signs, measure grouping signs

Options to group beats within a bar are available through the Scheme function set-time-signature, which takes three arguments: the number of beats, the beat length, and the internal grouping of beats in the measure. If the Measure_grouping_engraver is included, the function will also create MeasureGrouping signs. Such signs ease reading rhythmically complex modern music. In the example, the 9/8 measure is subdivided in 2, 2, 2 and 3. This is passed to set-time-signature as the third argument: '(2 2 2 3):

\score {
  \relative c'' {
    #(set-time-signature 9 8 '(2 2 2 3))
    #(revert-auto-beam-setting '(end * * 9 8) 3 8)
    #(override-auto-beam-setting '(end 1 8 9 8) 1 4)
    #(override-auto-beam-setting '(end 1 8 9 8) 2 4)
    #(override-auto-beam-setting '(end 1 8 9 8) 3 4)
    g8 g d d g g a( bes g) |
    #(set-time-signature 5 8 '(3 2))
    a4. g4
  }
  \layout {
    \context {
      \Staff
      \consists "Measure_grouping_engraver"
    }
  }
}

[image of music]

Modifying the beam end points

In common time signatures, automatic beams can start on any note but can end at only a few positions within the measure, namely at durations specified by the properties in autoBeamSettings. These properties consist of a list of rules defining where beams can end. The default autoBeamSettings rules are defined in ‘scm/auto-beam.scm’. To find this, see Other sources of information.

This method must be used for the time signatures for which beam-ending rules are defined by default, unless these have all been reverted. It is also particularly suitable for many other time signatures if the time signature of the measures changes frequently, or if the beaming should be different for different beam durations.

In order to add a rule to the list, use

#(override-auto-beam-setting
  '(beam-limit
    beam-numerator  beam-denominator
    time-signature-numerator time-signature-denominator)
  moment-numerator moment-denominator [context])

where

For example, if automatic beams should always end on the first quarter note, whatever the time signature or beam duration, use

a8 a a a a a a a
#(override-auto-beam-setting '(end * * * *) 1 4)
a8 a a a a a a a

[image of music]

You can force the beam settings to take effect only on beams whose shortest note is a certain duration

\time 2/4
% end 1/16 beams for all time signatures at the 1/16 moment
#(override-auto-beam-setting '(end 1 16 * *) 1 16)
a16 a a a a a a a |
a32 a a a a16 a a a a a |
% end 1/32 beams for all time signatures at the 1/16 moment
#(override-auto-beam-setting '(end 1 32 * *) 1 16)
a32 a a a a16 a a a a a |

[image of music]

You can force the beam settings to take effect only in certain time signatures

\time 5/8
% end beams of all durations in 5/8 time signature at the 2/8 moment
#(override-auto-beam-setting '(end * * 5 8) 2 8)
c8 c d d d
\time 4/4
e8 e f f e e d d
\time 5/8
c8 c d d d

[image of music]

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
% Context not specified - does not work correctly
#(override-auto-beam-setting '(end * * 7 8) 3 8)
#(override-auto-beam-setting '(end * * 7 8) 4 8)
#(override-auto-beam-setting '(end * * 7 8) 5 8)
<< {a8 a a a16 a a a a8 a} \\ {f4. f8 f f f} >>

% Works correctly with context specified
#(override-auto-beam-setting '(end * * 7 8) 3 8 'Staff)
#(override-auto-beam-setting '(end * * 7 8) 4 8 'Staff)
#(override-auto-beam-setting '(end * * 7 8) 5 8 'Staff)
<< {a8 a a a16 a a a a8 a} \\ {f4. f8 f f f} >>

[image of music]

Note: If any unexpected beam behavior occurs, check the default automatic beam settings in ‘scm/auto-beam.scm’ for possible interference, because the beam endings defined there will still apply in addition to your own.

Any unwanted or conflicting default endings must be reverted for your time signature(s). Existing auto-beam rules are removed by using

#(revert-auto-beam-setting
  '(beam-limit
    beam-numerator  beam-denominator
    time-signature-numerator time-signature-denominator)
  moment-numerator moment-denominator [context])

beam-limit, beam-numerator, beam-denominator, time-signature-numerator, time-signature-denominator, moment-numerator, moment-denominator and context are the same as above.

\time 4/4
a16 a a a a a a a a a a a a a a a
% undo a rule ending 1/16 beams in 4/4 time at 1/4 moment
#(revert-auto-beam-setting '(end 1 16 4 4) 1 4)
a16 a a a a a a a a a a a a a a a

[image of music]

The rule in a revert-auto-beam-setting statement must exactly match the original rule. That is, no wildcard expansion is taken into account.

\time 1/4
#(override-auto-beam-setting '(end 1 16 1 4) 1 8)
a16 a a a
#(revert-auto-beam-setting '(end 1 16 * *) 1 8) % this won't revert it!
a a a a
#(revert-auto-beam-setting '(end 1 16 1 4) 1 8) % this will
a a a a

[image of music]

Selected Snippets

Beam grouping in 7/8 time

There are no default automatic beam groupings specified for 7/8 time, so if automatic beams are required the grouping must be specified. For example, to group all beams 2-3-2 in 7/8 time, specify beam endings at 2/8 and 5/8:

\relative c'' {
  \time 7/8
  % rhythm 2-3-2
  a8 a a a a a a
  #(override-auto-beam-setting '(end * * 7 8) 2 8)
  #(override-auto-beam-setting '(end * * 7 8) 5 8)
  a8 a a a a a a
}

[image of music]

Reverting default beam endings

To typeset beams grouped 3-4-3-2 in 12/8 it is necessary first to override the default beam endings in 12/8, and then to set up the new beaming endings:

\relative c'' {
  \time 12/8

  % Default beaming
  a8 a a a a a a a a a a a

  % Revert default values in scm/auto-beam.scm for 12/8 time
  #(revert-auto-beam-setting '(end * * 12 8) 3 8)
  #(revert-auto-beam-setting '(end * * 12 8) 3 4)
  #(revert-auto-beam-setting '(end * * 12 8) 9 8)
  a8 a a a a a a a a a a a

  % Set new values for beam endings
  #(override-auto-beam-setting '(end * * 12 8) 3 8)
  #(override-auto-beam-setting '(end * * 12 8) 7 8)
  #(override-auto-beam-setting '(end * * 12 8) 10 8)
  a8 a a a a a a a a a a a
}

[image of music]

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
  #(score-override-auto-beam-setting '(end * * 5 4) 3 8)
  #(score-override-auto-beam-setting '(end * * 5 4) 7 8)
  <<
    \new Staff {
      c8 c c c c c c c c c
    }
    \new Staff {
      % Modify beaming for just this staff
      #(override-auto-beam-setting '(end * * 5 4) 6 8 'Staff)
      #(revert-auto-beam-setting '(end * * 5 4) 7 8 'Staff)
      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
          #(override-auto-beam-setting '(end * * 5 4) 6 8)
          #(revert-auto-beam-setting '(end * * 5 4) 7 8)
          a8 a a a a a a a a a
        }
      >>
    }
  >>
}

[image of music]

Predefined commands

\autoBeamOff, \autoBeamOn.

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.

See also

Snippets: Rhythms.


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 ]

{
  r4 r8[ g' a r8] r8 g[ | a] r8
}

[image of music]

Individual notes may be marked with \noBeam to prevent them from being beamed:

\time 2/4 c8 c\noBeam c c

[image of music]

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.

a8[ r16 f g a]
a8[ r16
\set stemLeftBeamCount = #2
\set stemRightBeamCount = #1
f
\set stemLeftBeamCount = #1
g a]

[image of music]

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 c'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
      c16[]
    }
    
    % Example 3
    \new RhythmicStaff {
      c16 c
      \set stemRightBeamCount = #2
      c16 r r
      \set stemLeftBeamCount = #2
      c16 c c
    }
    
    % Example 4
    \new RhythmicStaff {
      c16 c
      \set stemRightBeamCount = #2
      c16 r
      c16[]
      r16
      \set stemLeftBeamCount = #2
      c16 c
    }
  >>
}

[image of music]


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 featheredDurations 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.

\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] }

[image of music]

The spacing in the printed output represents the note durations only approximately, but the MIDI output is exact.

Known issues and warnings

The \featherDurations command only works with very short music snippets, and when numbers in the fraction are small.

See also

Snippets: Rhythms.


1.2.5 Bars


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:

e4 d c2 \bar "|."

[image of music]

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 which 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

\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. Such insertions do not affect the calculation and placement of subsequent automatic bar lines.

The simple bar line and five types of double bar line are available for manual insertion:

f1 \bar "|" g \bar "||" a \bar ".|" b \bar ".|." c \bar "|.|" d \bar "|." e

[image of music]

together with dotted and dashed bar lines:

f1 \bar ":" g \bar "dashed" a

[image of music]

and five types of repeat bar line:

f1 \bar "|:" g \bar ":|:" a \bar ":|.|:" b \bar ":|.:" c \bar ":|" d

[image of music]

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.

\override Score.RehearsalMark #'padding = #3
c c c c
\bar "||:"
c c c c \break
\bar "||:"
c c c c

[image of music]

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 {
      e'4 d'
      \bar "||"
      f' e'
    }
    \new Staff { \clef bass c4 g e g }
  >>
  \new Staff { \clef bass c2 c2 }
>>

[image of music]

Selected Snippets

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.

Snippets: Rhythms.

Internals Reference: BarLine (created at Staff level), SpanBar (across staves), Timing_translator (for Timing properties).


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:

c1 c c c
\break
\set Score.currentBarNumber = #50
c1 c c c

[image of music]

Selected Snippets

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:

\override Score.BarNumber #'break-visibility = #'#(#t #t #t)
\set Score.currentBarNumber = #11
\bar ""  % Permit first bar number to be printed
c1 c c c
\break
c c c c

[image of music]

and here the bar numbers are printed every two measures except at the end of the line:

\override Score.BarNumber #'break-visibility = #'#(#f #t #t)
\set Score.currentBarNumber = #11
\bar ""  % Permit first bar number to be printed
% Print a bar number every second measure
\set Score.barNumberVisibility = #(every-nth-bar-number-visible 2)
c1 c c c c
\break
c c c c c

[image of music]

The size of the bar number may be changed. This is illustrated in the following example, which also shows how to enclose bar numbers in boxes and circles, and shows an alternative way of specifying #(#f #t #t) for break-visibility.

% Prevent bar numbers at the end of a line and permit them elsewhere
\override Score.BarNumber #'break-visibility
  = #end-of-line-invisible

% Increase the size of the bar number by 2
\override Score.BarNumber #'font-size = #2
\repeat unfold 3 { c1 } \bar "|"

% 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 3 { c1 } \bar "|"

% 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 "|."

[image of music]

Bar numbers by default are left-aligned to their parent object. This is usually the left edge of a line or, if numbers are printed within a line, the left bar line of the measure. The numbers may also be positioned directly on the bar line or right-aligned to the bar line:

\set Score.currentBarNumber = #111
\override Score.BarNumber #'break-visibility = #'#(#t #t #t)
% 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 = #0
c1 c1
% Right-align bar numbers
\override Score.BarNumber #'self-alignment-X = #-1
c1 c1

[image of music]

Bar numbers can be removed entirely by removing the Bar_number_engraver from the Score context.

\layout {
  \context {
    \Score
    \remove "Bar_number_engraver"
  }
}
\relative c''{
  c4 c c c \break
  c4 c c c
}

[image of music]

See also

Snippets: Rhythms.

Internals Reference: BarNumber.

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.


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 |

Bar checks can also be used in lyrics, for example

\lyricmode {
  \time 2/4
  Twin -- kle | Twin -- kle |
}

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.

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 pipeSymbol. 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.

pipeSymbol = \bar "||"
{
  c'2 c'2 |
  c'2 c'2
  c'2 | c'2
  c'2 c'2
}

[image of music]

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.


Rehearsal marks

To print a rehearsal mark, use the \mark command

c1 \mark \default
c1 \mark \default
c1 \mark #8
c1 \mark \default
c1 \mark \default

[image of music]

The letter ‘I’ is skipped in accordance with engraving traditions. If you wish to include the letter ‘I’, then use

\set Score.markFormatter = #format-mark-alphabet

The mark is incremented automatically if you use \mark \default, but you can also use an integer argument to set the mark manually. The value to use is stored in the property rehearsalMark.

The style is defined by the property markFormatter. It is a function taking the current mark (an integer) and the current context as argument. It should return a markup object. In the following example, markFormatter is set to a pre-defined procedure. After a few measures, it is set to a procedure that produces a boxed number.

\set Score.markFormatter = #format-mark-numbers
c1 \mark \default
c1 \mark \default
\set Score.markFormatter = #format-mark-box-numbers
c1 \mark \default
\set Score.markFormatter = #format-mark-circle-numbers
c1 \mark \default
\set Score.markFormatter = #format-mark-circle-letters
c1

[image of music]

The file ‘scm/translation-functions.scm’ contains the definitions of format-mark-numbers (the default format), format-mark-box-numbers, format-mark-letters and format-mark-box-letters. 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"

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

c1 \mark \markup { \musicglyph #"scripts.segno" }
c1 \mark \markup { \musicglyph #"scripts.coda" }
c1 \mark \markup { \musicglyph #"scripts.ufermata" }
c1

[image of music]

See The Feta font, for a list of symbols which may be printed with \musicglyph.

For common tweaks to the positioning of rehearsal marks, see Formatting text.

See also

Notation Reference: The Feta font, Formatting text.

Installed Files: ‘scm/translation-functions.scm’ contains the definition of format-mark-numbers and format-mark-letters. They can be used as inspiration for other formatting functions.

Snippets: Rhythms.

Internals Reference: RehearsalMark.


1.2.6 Special rhythmic concerns


Grace notes

Grace notes are ornaments that are written out. Grace notes are printed in a smaller font and take up no logical time in a measure.

c4 \grace c16 c4
\grace { c16[ d16] } c2

[image of music]

Lilypond also supports two special types of grace notes, the acciaccatura–an unmeasured grace note indicated by a slurred small note with a slashed stem–and the appoggiatura, which takes a fixed fraction of the main note and appears in small print without a slash.

\grace c8 b4
\acciaccatura d8 c4
\appoggiatura e8 d4
\acciaccatura { g16[ f] } e4

[image of music]

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 { e2 \grace { c16[ d e f] } e2 }
   \new Staff { c2 \grace { g8[ b] } c2 } >>

[image of music]

If you want to end a note with a grace, use the \afterGrace command. It takes two arguments: the main note, and the grace notes following the main note.

c1 \afterGrace d1 { c16[ d] } c1

[image of music]

This will put the grace notes after a space lasting 3/4 of the length of the main note. The default fraction 3/4 can be changed by setting afterGraceFraction. The following example shows the results from setting the space at the default, at 15/16, and finally at 1/2 of the main note.

<<
  \new Staff {
    c1 \afterGrace d1 { c16[ d] } c1
  }
  \new Staff {
    #(define afterGraceFraction (cons 15 16))
    c1 \afterGrace d1 { c16[ d] } c1
  }
  \new Staff {
    #(define afterGraceFraction (cons 1 2))
    c1 \afterGrace d1 { c16[ d] } c1
  }
>>

[image of music]

The space between the main note and the grace note may also be specified using spacers. The following example places the grace note after a space lasting 7/8 of the main note.

\new Voice {
  << { d1^\trill_( }
     { s2 s4. \grace { c16[ d] } } >>
  c1)
}

[image of music]

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 overriden and then reverted.

\new Voice {
  \acciaccatura {
    \stemDown
    f16->
    \stemNeutral
  }
  g4 e c2
}

[image of music]

Selected Snippets

The slash through the stem found in acciaccaturas can be applied in other situations:

\relative c'' {
  \override Stem #'stroke-style = #"grace"
  c8( d2) e8( f4)
}

[image of music]

The layout of grace expressions can be changed throughout the music using the function add-grace-property. The following example undefines the Stem direction for this grace, so that stems do not always point up.

\relative c'' {
  \new Staff {
    #(add-grace-property 'Voice 'Stem 'direction ly:stem::calc-direction)
    #(remove-grace-property 'Voice 'Stem 'direction)
    \new Voice {
       \acciaccatura { f16 } g4
       \grace { d16[ e] } f4
       \appoggiatura { a,32[ b c d] } e2
    }
  }
}

[image of music]

Another option is to change the variables startGraceMusic, stopGraceMusic, startAcciaccaturaMusic, stopAcciaccaturaMusic, startAppoggiaturaMusic, stopAppoggiaturaMusic. The default values of these can be seen in the file ly/grace-init.ly. By redefining them other effects may be obtained.

Grace notes may be forced to align with regular notes in other staves:

\relative c'' {
  <<
    \override Score.SpacingSpanner #'strict-grace-spacing = ##t
    \new Staff {
      c4
      \afterGrace c4 { c16[ c8 c16] }
      c4 r
    }
    \new Staff {
      c16 c c c c c c c c4 r
    }
  >>
}

[image of music]

See also

Music Glossary: grace notes, acciaccatura, appoggiatura.

Installed Files: ‘ly/grace-init.ly’.

Snippets: Rhythms.

Internals Reference: GraceMusic.

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 { e4 \bar "|:" \grace c16 d2. }
   \new Staff { c4 \bar "|:" d2. } >>

[image of music]

This can be remedied by inserting grace skips of the corresponding durations in the other staves. For the above example

<< \new Staff { e4 \bar "|:" \grace c16 d2. }
   \new Staff { c4 \bar "|:" \grace s16 d2. } >>

[image of music]

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.


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' {
  c4 d8 e f g g4
  f2 g4 g
}

\new GrandStaff <<
  \new Staff {
    \MyCadenza c'1
    \MyCadenza c'1
  }
  \new Staff {
    #(ly:export (mmrest-of-length MyCadenza))
    c'1
    #(ly:export (skip-of-length MyCadenza))
    c'1
  }
>>

[image of music]

See also

Music Glossary: cadenza.

Snippets: Rhythms.


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.

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 whenever measureLength 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.

\set Score.measureLength = #(ly:make-moment 5 4)
c1 c4
c1 c4
c4 c4
\set Score.measurePosition = #(ly:make-moment 5 8)
b4 b4 b8
c4 c1

[image of music]

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

This manual: Bar numbers, Unmetered music

Snippets: Rhythms.

Internals Reference: Timing_translator, Score


1.3 Expressive marks

[image of music]

This section lists various expressive marks that can be created in a score.


1.3.1 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

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:

c4\staccato c\mordent b2\turn
c1\fermata

[image of music]

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:

c4-^  c-+  c--  c-|
c4->  c-.  c2-_

[image of music]

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.

Selected Snippets

Modifying default values for articulation shorthand notation

The shorthands are defined in ‘ly/script-init.ly’, where the variables dashHat, dashPlus, dashDash, dashBar, 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-+ }

[image of music]

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 }
}

[image of music]

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. The value of halign is used to position the turn horizontally.

\relative c'' {
  \once \override TextScript #'avoid-slur = #'inside
  \once \override TextScript #'outside-staff-priority = ##f
  c2(^\markup \tiny \override #'(baseline-skip . 1) {
    \halign #-4
    \center-column {
      \sharp
      \musicglyph #"scripts.turn"
    }
  }
  d4.) c8
}

[image of music]

See also

Music Glossary: tenuto, accent, staccato, portato.

Notation Reference: Direction and placement, List of articulations, Trills.

Installed Files: ‘scm/script.scm’.

Snippets: Expressive marks.

Internals Reference: Script, TextScript.


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, \fp, \sf, \sff, \sp, \spp, \sfz, and \rfz. The dynamic marks may be manually placed above or below the staff, see Direction and placement.

c2\ppp c\mp
c2\rfz c^\mf
c2_\spp c^\ff

[image of music]

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 \>. Hairpins are engraved by default using this notation.

c2\< c\!
d2\< d\f
e2\< e\>
f2\> f\!
e2\> e\mp
d2\> d\>
c1\!

[image of music]

Spacer rests are needed to engrave multiple marks on one note.

c4\< c\! d\> e\!
<< f1 { s4 s4\< s4\> s4\! } >>

[image of music]

In some situations the \espressivo articulation mark may be the appropriate choice to indicate a crescendo and decrescendo on one note:

c2 b4 a
g1\espressivo

[image of music]

Crescendos and decrescendos can be engraved as textual markings instead of hairpins. Dashed lines are printed to indicate their extent. The built-in commands that enable these text modes are \crescTextCresc, \dimTextDecresc, \dimTextDecr, and \dimTextDim. The corresponding \crescHairpin and \dimHairpin commands will revert to hairpins again:

\crescTextCresc
c2\< d | e f\!
\dimTextDecresc
e2\> d | c b\!
\crescHairpin
c2\< d | e f\!
\dimHairpin
e2\> d\!

[image of music]

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.

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\!
}

[image of music]

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\!
  \override Hairpin #'minimum-length = #5
  << f1 { s4 s\< s\> s\! } >>
}

[image of music]

Printing hairpins using al niente notation

Hairpins 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\!
}

[image of music]

Vertically aligned dynamics and textscripts

By setting the 'Y-extent property to a suitable value, all DynamicLineSpanner objects (hairpins and dynamic texts) can be aligned to a common reference point, regardless of their actual extent. This way, every element will be vertically aligned, thus producing a more pleasing output.

The same idea is used to align the text scripts along their baseline.

music = \relative c'' {
  c2\p^\markup { gorgeous } c\f^\markup { fantastic }
  c4\p c\f\> c c\!\p
}

{
  \music \break
  \override DynamicLineSpanner #'staff-padding = #2.0
  \override DynamicLineSpanner #'Y-extent = #'(-1.5 . 1.5)
  \override TextScript #'Y-extent = #'(-1.5 . 1.5)
  \music
}

[image of 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 #'dash-period = #-1.0
  \crescTextCresc
  c1\< | d | b | c\!
}

[image of music]

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 'hairpin, and other possible values include 'line, 'dashed-line and 'dotted-line:

\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
}

[image of music]

See also

Music Glossary: al niente, crescendo, decrescendo, hairpin.

Learning Manual: Articulation and dynamics.

Notation Reference: Direction and placement, New dynamic marks, What goes into the MIDI output?, Controlling MIDI dynamics.

Snippets: Expressive marks.

Internals Reference: DynamicText, Hairpin, DynamicLineSpanner.


New dynamic marks

The easiest way to create dynamic indications is to use \markup objects.

moltoF = \markup { molto \dynamic f }

\relative c' {
  <d e>16_\moltoF <d e>
  <d e>2..
}

[image of music]

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' {
  c1_\roundF
  c1_\boxF
}

[image of music]

Simple, centered dynamic marks are easily created with the make-dynamic-script function. The dynamic font only contains the characters f,m,p,r,s and z.

sfzp = #(make-dynamic-script "sfzp")
\relative c' {
  c4 c c\sfzp c
}

[image of music]

In general, make-dynamic-script takes any markup object as its argument. In the following example, using make-dynamic-script ensures 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 } }
roundFdynamic = #(make-dynamic-script roundF)
boxFdynamic = #(make-dynamic-script boxF)
\relative c' {
  c4_\roundFdynamic\< d e f
  g,1_\boxFdynamic
}

[image of music]

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 c' {
  <d e>16 <d e>
  <d e>2..\moltoF
}

[image of music]

Font settings in markup mode are described in Selecting font and font size.

See also

Notation Reference: Formatting text, Selecting font and font size, Markup construction in Scheme, What goes into the MIDI output?, Controlling MIDI dynamics.

Snippets: Expressive marks.


1.3.2 Curves

This section explains how to create various expressive marks that are curved: normal slurs, phrasing slurs, breath marks, falls, and doits.


Slurs

Slurs are entered using parentheses:

f4( g a) a8 b(
a4 g2 f4)
<c e>2( <b d>2)

[image of music]

Slurs may be manually placed above or below the notes, see Direction and placement.

c2( d)
\slurDown
c2( d)
\slurNeutral
c2( d)

[image of music]

Simultaneous or overlapping slurs are not permitted, but a phrasing slur can overlap a slur. This permits two slurs to be printed at once. For details, see Phrasing slurs.

Slurs can be solid, dotted, or dashed. Solid is the default slur style:

c4( e g2)
\slurDashed
g4( e c2)
\slurDotted
c4( e g2)
\slurSolid
g4( e c2)

[image of music]

Predefined commands

\slurUp, \slurDown, \slurNeutral, \slurDashed, \slurDotted, \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>)
}

[image of music]

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
}

[image of music]

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.


Phrasing slurs

Phrasing slurs (or phrasing marks) that indicate a musical sentence are written using the commands \( and \) respectively:

c4\( d( e) f(
e2) d\)

[image of music]

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 slurs may be manually placed above or below the notes, see Direction and placement.

c4\( g' c,( b) | c1\)
\phrasingSlurUp
c4\( g' c,( b) | c1\)

[image of music]

Simultaneous or overlapping phrasing slurs are not permitted.

Phrasing slurs can be solid, dotted, or dashed. Solid is the default style for phrasing slurs:

c4\( e g2\)
\phrasingSlurDashed
g4\( e c2\)
\phrasingSlurDotted
c4\( e g2\)
\phrasingSlurSolid
g4\( e c2\)

[image of music]

Predefined commands

\phrasingSlurUp, \phrasingSlurDown, \phrasingSlurNeutral, \phrasingSlurDashed, \phrasingSlurDotted, \phrasingSlurSolid.

See also

Learning Manual: On the un-nestedness of brackets and ties.

Notation Reference: Direction and placement.

Snippets: Expressive marks.

Internals Reference: PhrasingSlur.


Breath marks

Breath marks are entered using \breathe:

c2. \breathe d4

[image of music]

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
}

[image of music]

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
}

[image of music]

See also

Music Glossary: caesura.

Notation Reference: Divisiones.

Snippets: Expressive marks.

Internals Reference: BreathingSign.


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.

c2-\bendAfter #+4
c2-\bendAfter #-4
c2-\bendAfter #+8
c2-\bendAfter #-8

[image of music]

The dash - immediately preceding the \bendAfter command is required when writing falls and doits.

Selected Snippets

Adjusting the shape of falls and doits

The shortest-duration-space property may have to 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 #-3
  c2-\bendAfter #+8
  c2-\bendAfter #-6
}

[image of music]

See also

Music Glossary: fall, doit.

Snippets: Expressive marks.


1.3.3 Lines

This section explains how to create various expressive marks that follow a linear path: glissandos, arpeggios, and trills.


Glissando

A glissando is created by attaching \glissando to a note:

g2\glissando g'
c2\glissando c,

[image of music]

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 "|"
}

[image of 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.


Arpeggio

An arpeggio on a chord (also known as a broken chord) is denoted by appending \arpeggio to the chord construct:

<c e g c>1\arpeggio

[image of music]

Different types of arpeggios may be written. \arpeggioNormal reverts to a normal arpeggio:

<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

[image of music]

Special bracketed arpeggio symbols can be created:

<c e g c>2
\arpeggioBracket
<c e g c>2\arpeggio
\arpeggioParenthesis
<c e g c>2\arpeggio
\arpeggioNormal
<c e g c>2\arpeggio

[image of music]

Arpeggios can be explicitly written out with ties. For more information, see Ties.

Predefined commands

\arpeggio, \arpeggioArrowUp, \arpeggioArrowDown, \arpeggioNormal, \arpeggioBracket, \arpeggioParenthesis.

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
    }
  }
>>

[image of music]

Creating cross-staff arpeggios in other contexts

Cross-staff arpeggios can be created in contexts other than PianoStaff if the Span_arpeggio_engraver is included in the Score context.

\score {
  \new StaffGroup {
    \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"
    }
  }
}

[image of music]

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 moved 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 }
  >>
}

[image of music]

See also

Music Glossary: arpeggio.

Notation Reference: Ties.

Snippets: Expressive marks.

Internals Reference: Arpeggio, PianoStaff.

Known issues and warnings

It is not possible to mix connected arpeggios and unconnected arpeggios in one PianoStaff at the same point in time.

The parenthesis-style arpeggio brackets do not work for cross-staff arpeggios.


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:

d1~\startTrillSpan
d1
c2\stopTrillSpan r2

[image of music]

In the following example, a trill is combined with grace notes. The syntax of this construct and the method to precisely position the grace notes are described in Grace notes.

c1 \afterGrace
d1\startTrillSpan { c32[ d]\stopTrillSpan }
e2 r2

[image of music]

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.

\pitchedTrill e2\startTrillSpan fis
d\stopTrillSpan

[image of music]

In the following example, the second pitched trill is ambiguous; the accidental of the trilled note is not printed. As a workaround, the accidentals of the trilled notes can be forced. The second measure illustrates this method:

\pitchedTrill eis4\startTrillSpan fis
g\stopTrillSpan
\pitchedTrill eis4\startTrillSpan fis
g\stopTrillSpan
\pitchedTrill eis4\startTrillSpan fis
g\stopTrillSpan
\pitchedTrill eis4\startTrillSpan fis!
g\stopTrillSpan

[image of music]

Predefined commands

\startTrillSpan, \stopTrillSpan.

See also

Music Glossary: trill.

Notation Reference: Articulations and ornamentations, Grace notes.

Snippets: Expressive marks.

Internals Reference: TrillSpanner.


1.4 Repeats

[image of music]

Repetition is a central concept in music, and multiple notations exist for repetitions. LilyPond supports the following kinds of repeats:

volta

The repeated music is not written out but enclosed between repeat bar lines. If the repeat is at the beginning of a piece, a repeat bar line is only printed at the end of the repeat. Alternative endings (volte) are printed left to right with brackets. This is the standard notation for repeats with alternatives.

unfold

The repeated music is fully written out, as many times as specified by repeatcount. This is useful when entering repetitious music.

percent

These are beat or measure repeats. They look like single slashes or percent signs.

tremolo

This is used to write tremolo beams.


1.4.1 Long repeats

This section discusses how to input long (usually multi-measure) repeats. The repeats can take two forms: repeats enclosed between repeat signs; or written out repeats, used to input repetitious music. Repeat signs can also be controlled manually.


Normal repeats

The syntax for a normal repeat is

\repeat volta repeatcount musicexpr

where musicexpr is a music expression. Alternate endings can be produced using \alternative. In order to delimit the alternate endings, the group of alternatives must be enclosed in a set of braces. If there are more repeats than there are alternate endings, the earliest repeats are given the first alternative.

Normal repeats without alternate endings:

\repeat volta 2 { c4 d e f }
c2 d
\repeat volta 2 { d4 e f g }

[image of music]

Normal repeats with alternate endings:

\repeat volta 4 { c4 d e f }
\alternative {
  { d2 e }
  { f2 g }
}
c1

[image of music]

Repeats with upbeats can be entered in two ways:

\partial 4
e |
\repeat volta 4 { c2 d | e2 f | }
\alternative {
  { g4 g g e }
  { a4 a a a | b2. }
}

[image of music]

or

\partial 4
\repeat volta 4 { e4 | c2 d | e2 f | }
\alternative {
  { \partial 4*3 g4 g g }
  { a4 a a a | b2. }
}

[image of music]

Ties may be added to a second ending:

c1
\repeat volta 2 { c4 d e f ~ }
\alternative {
  { f2 d }
  { f2\repeatTie f, }
}

[image of music]

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 }
  }
}

[image of music]

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' } }
>>

[image of music]

See also

Music Glossary: repeat, volta.

Notation Reference: Bar lines, Modifying context plug-ins.

Snippets: Repeats.

Internals Reference: VoltaBracket, RepeatedMusic, VoltaRepeatedMusic, UnfoldedRepeatedMusic.

Known issues and warnings

A nested repeat like

\repeat …
\repeat …
\alternative

is ambiguous, since it is is not clear to which \repeat the \alternative belongs. This ambiguity is resolved by always having the \alternative belong to the inner \repeat. For clarity, it is advisable to use braces in such situations.

Timing information is not remembered at the start of an alternative, so after a repeat timing information must be reset by hand; for example, by setting Score.measurePosition or entering \partial. Similarly, slurs are also not repeated.


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.

c1
\set Score.repeatCommands = #'(start-repeat)
d4 e f g
c1

[image of music]

As per standard engraving practice, repeat signs are not printed at the beginning of a piece.

end-repeat

Print a :| bar line:

c1
d4 e f g
\set Score.repeatCommands = #'(end-repeat)
c1

[image of music]

(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.

f4 g a b
\set Score.repeatCommands = #'((volta "2"))
g4 a g a
\set Score.repeatCommands = #'((volta #f))
c1

[image of music]

Multiple repeat commands may occur at the same point:

f4 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))

[image of music]

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'' {
  c1
  \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))
}

[image of music]

Selected Snippets

Printing a repeat sign at the beginning of a piece

A |: bar line can be printed at the beginning of a piece, by overriding the relevant property:

\relative c'' {
  \once \override Score.BreakAlignment #'break-align-orders =
        #(make-vector 3 '(instrument-name
                          left-edge
                          ambitus
                          span-bar
                          breathing-sign
                          clef
                          key-signature
                          time-signature
                          staff-bar
                          custos
                          span-bar))
  \bar "|:"
  c1
  d1
  d4 e f g
}

[image of music]

See also

Notation Reference: Bar lines, Formatting text.

Snippets: Repeats.

Internals Reference: VoltaBracket, RepeatedMusic, VoltaRepeatedMusic.


Written-out repeats

By using the unfold command, repeats can be used to simplify the writing out of repetitious music. The syntax is

\repeat unfold repeatcount musicexpr

where musicexpr is a music expression and repeatcount is the number of times musicexpr is repeated.

c1
\repeat unfold 2 { c4 d e f }
c1

[image of music]

Unfold repeats can be made with alternate endings. If there are more repeats than there are alternate endings, the first alternative ending is applied to the earliest endings.

c1
\repeat unfold 2 { g4 f e d }
  \alternative {
    { cis2 g' }
    { cis,2 b }
  }
c1

[image of music]

See also

Snippets: Repeats.

Internals Reference: RepeatedMusic, UnfoldedRepeatedMusic.


1.4.2 Short repeats

This section discusses how to input short repeats. Short repeats can take two basic forms: repeats of a single note to two measures, represented by slashes or percent signs; and tremolos.


Percent repeats

Repeated short patterns of notes are supported. The music is printed once, and the pattern is replaced with a special sign. Patterns that are shorter than one measure are replaced by slashes, and patterns of one or two measures are replaced by percent-like signs. The syntax is

\repeat percent number musicexpr

where musicexpr is a music expression.

\repeat percent 4 { c4 }
\repeat percent 2 { b4 a g f }
\repeat percent 2 { c2 es | f4 fis g c | }

[image of music]

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 }
}

[image of music]

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 }
}

[image of music]

Isolated percent repeats

Isolated percents can also be printed. This is done by entering a multi-measure rest with a different print function:

\relative c'' {
  \override MultiMeasureRest #'stencil
    = #ly:multi-measure-rest::percent
  \override MultiMeasureRest #'thickness = #0.48
  R1
}

[image of music]

See also

Music Glossary: percent repeat, simile.

Snippets: Repeats.

Internals Reference: RepeatSlash, PercentRepeat, DoublePercentRepeat, DoublePercentRepeatCounter, PercentRepeatCounter, PercentRepeatedMusic.

Known issues and warnings

Only three kinds of percent repeats are supported: a single slash representing a single beat (regardless of the duration of the repeated notes); a single slash with dots representing one full measure; and two slashes with dots crossing a bar line representing two full measures. Neither multiple slashes representing single beat repeats consisting of sixteenth or shorter notes, nor two slashes with dots representing single beat repeats consisting of notes of varying durations, are supported.


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:

\repeat tremolo 8 { c16 d }
\repeat tremolo 6 { c16 d }
\repeat tremolo 2 { c16 d }

[image of music]

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

[image of music]

The same output can be obtained by adding ‘:[number]’ after the note. The number indicates the duration of the subdivision, and it must be at least 8. A number value of 8 gives one line across the note stem. If the length is omitted, the last value (stored in tremoloFlags) is used

c2:8 c:32
c: c:

[image of music]

See also

Snippets: Repeats.

Known issues and warnings

Cross-staff tremolos do not work well.


1.5 Simultaneous notes

[image of music]

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

This section discusses simultaneous notes inside the same voice.


Chorded notes

A chord is formed by enclosing a set of pitches between < and >. A chord may be followed by a duration and/or a set of articulations, just like simple notes:

<c e g>2 <c f a>4-> <e g c>-.

[image of music]

Relative mode can be used for pitches in chords. The octave of each pitch is chosen using the preceding pitch as a reference except in the case of the first pitch in a chord: the reference for the first pitch is the first pitch of the preceding chord.

For more information about chords, see Chord notation.

See also

Music Glossary: chord.

Learning Manual: Combining notes into chords.

Notation Reference: Chord notation.

Snippets: Simultaneous notes.


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
  << {a4 b g2} {d4 g c,2} >>
}

[image of music]

% single first note
a << {a4 b g}  {d4 g c,} >>

[image of music]

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.

The following example shows how simultaneous expressions can generate multiple staves implicitly:

% no single first note
<< {a4 b g2}  {d4 g2 c,4} >>

[image of music]

Here different rhythms cause no problems.


Clusters

A cluster indicates a continuous range of pitches to be played. They can be denoted as the envelope of a set of notes. They are entered by applying the function \makeClusters to a sequence of chords, e.g.,

\makeClusters { <g b>2 <c g'> }

[image of music]

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.


1.5.2 Multiple voices

This section discusses simultaneous notes in multiple voices or multiple staves.


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"
    { \voiceOne r8 r16 g e8. f16 g8[ c,] f e16 d }
  \new Voice= "second"
    { \voiceTwo d16 c d8~ d16 b c8~ c16 b c8~ c16 b8. }
>>

[image of music]

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:

<<
  \new Voice = "melody" {
    a4
    <<
      {
        \voiceOne
        g f
      }
      \new Voice {
        \voiceTwo
        d2
      }
    >>
    \oneVoice
    e4
  }
  \new Lyrics \lyricsto "melody" {
  This is my song.
  }
>>

[image of music]

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 contruct 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:

<<
  { r8 r16 g e8. f16 g8[ c,] f e16 d }
  \\
  { d16 c d8~ d16 b c8~ c16 b c8~ c16 b8. }
>>

[image of music]

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.

<<
  { r8 g g  g g f16 ees f8 d }
  \\
  { ees,8 r ees r d r d r }
  \\
  { d'8 s c s bes s a s }
>>

[image of music]

In all but the simplest works it is advisable to create explicit Voice contexts as explained in Contexts and engravers and Explicitly instantiating 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 <<
  { e4 f8 d e16 f g8 d4 }
  { c4 d8 b c16 d e8 b4 }
>>

[image of music]

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.

Snippets: Simultaneous notes.


Voice styles

Voices may be given distinct colors and shapes, allowing them to be easily identified:

<<
  { \voiceOneStyle d4 c2 b4 }
  \\
  { \voiceTwoStyle e,2 e }
  \\
  { \voiceThreeStyle b2. c4 }
  \\
  { \voiceFourStyle g'2 g }
>>

[image of music]

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.


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.

<<
  {
    c8 d e d c d c4
    g'2 fis
  } \\ {
    c2 c8. b16 c4
    e,2 r
  } \\ {
    \oneVoice
    s1
    e8 a b c d2
  }
>>

[image of music]

Notes with different note heads may be merged, with the exception of half-note heads and quarter-note heads:

<<
  {
    \mergeDifferentlyHeadedOn
    c8 d e d c d c4
    g'2 fis
  } \\ {
    c2 c8. b16 c4
    e,2 r
  } \\ {
    \oneVoice
    s1
    e8 a b c d2
  }
>>

[image of music]

Note heads with different dots may be merged:

<<
  {
    \mergeDifferentlyHeadedOn
    \mergeDifferentlyDottedOn
    c8 d e d c d c4
    g'2 fis
  } \\ {
    c2 c8. b16 c4
    e,2 r
  } \\ {
    \oneVoice
    s1
    e8 a b c d2
  }
>>

[image of music]

The half note and eighth note at the start of the second measure are incorrectly merged because \mergeDifferentlyHeadedOn cannot successfully complete the merge when three or more notes line up in the same column, and in this case a warning is given. To allow the merge to work properly 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.

<<
  {
    \mergeDifferentlyHeadedOn
    \mergeDifferentlyDottedOn
    c8 d e d c d c4
    \shiftOn
    g'2 fis
  } \\ {
    c2 c8. b16 c4
    e,2 r
  } \\ {
    \oneVoice
    s1
    e8 a b c d2
  }

>>

[image of music]

The \shiftOn, \shiftOnn, and \shiftOnnn commands specify the degree to which chords of the current voice should be shifted. The outer voices (normally: voices one and two) have \shiftOff, while the inner voices (three and four) have \shiftOn. \shiftOnn and \shiftOnnn define further shift levels.

Notes are only merged if they have opposing stem directions (e.g. in Voice 1 and 2).

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
  <<
    { \voiceOne
      a4. a8
      e'4 e4. e8
      f4 d4. c8
    } \\ {
      \voiceThree
      f,2
      bes4 a2
      a4 s2
    } \\ {
      \voiceFive
      s2
      g4 g2
      f4 f2
    } \\ {
      \voiceTwo
      d2
      d4 cis2
      d4 bes2
    }
  >>
}

[image of music]

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
  }
>>

[image of music]

See also

Music Glossary: polyphony.

Learning Manual: Multiple notes at once, Voices contain music, Collisions of objects.

Snippets: Simultaneous notes.

Internals Reference: NoteColumn, NoteCollision, RestCollision.

Known issues and warnings

When using \mergeDifferentlyHeadedOn with an upstem eighth or a shorter note, and a downstem half note, the eighth note stem gets a slightly wrong offset because of the different width of the half note head symbol.

There is no support for chords where the same note occurs with different accidentals in the same chord. In this case, it is recommended to use enharmonic transcription, or to use special cluster notation (see Clusters).


Automatic part combining

Automatic part combining is used to merge two parts of music onto a staff. It is aimed at typesetting orchestral scores. When the two parts are identical for a period of time, only one is shown. In places where the two parts differ, they are typeset as separate voices, and stem directions are set automatically. Also, solo and a due parts are identified and marked by default.

The syntax for part combining is:

\partcombine musicexpr1 musicexpr2

The following example demonstrates the basic functionality of the part combiner: putting parts on one staff and setting stem directions and polyphony. The same variables are used for the independent parts and the combined staff.

instrumentOne = \relative c' {
  c4 d e f
  R1
  d'4 c b a
  b4 g2 f4
  e1
}

instrumentTwo = \relative g' {
  R1
  g4 a b c
  d c b a
  g f( e) d
  e1
}

<<
  \new Staff \instrumentOne
  \new Staff \instrumentTwo
  \new Staff \partcombine \instrumentOne \instrumentTwo
>>

[image of music]

The notes in the third measure appear only once, although they were specified in both parts. Stem, slur, and tie directions are set automatically, depending whether there is a solo or unison. When needed in polyphony situations, the first part (with context called one) always 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 unisono (a due) parts are marked by default with the text “a2”.

Both arguments to \partcombine will be interpreted as Voice contexts. If using relative octaves, \relative should be specified for both music expressions, i.e.,

\partcombine
  \relative … musicexpr1
  \relative … musicexpr2

A \relative section that is outside of \partcombine has no effect on the pitches of musicexpr1 and musicexpr2.

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 "false". 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.

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 {
      \set Staff.instrumentName = "Standard polyphony  "
      << \musicUp \\ \musicDown >>
    }
    \new Staff \with { printPartCombineTexts = ##f } {
      \set Staff.instrumentName = "PartCombine without texts  "
      \partcombine \musicUp \musicDown
    }
    \new Staff {
      \set Staff.instrumentName = "PartCombine with texts  "
      \partcombine \musicUp \musicDown
    }
    >>
  >>
  \layout {
    indent = 6.0\cm
    \context {
      \Score
      \override SystemStartBar #'collapse-height = #30
    }
  }
}

[image of music]

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
    }
>>

[image of music]

See also

Music Glossary: a due, part.

Notation Reference: Writing parts.

Snippets: Simultaneous notes.

Internals Reference: PartCombineMusic, Voice.

Known issues and warnings

\partcombine can only accept two voices.

When printPartCombineTexts is set, if the two voices play the same notes on and off, the part combiner may typeset a2 more than once in a measure.

\partcombine cannot be inside \times.

\partcombine cannot be inside \relative.

Internally, the \partcombine interprets both arguments as Voices and decides when the parts can be combined. When they have different durations they cannot be combined and are given the names one and two. Consequently, if the arguments switch to differently named Voice contexts, the events in those will be ignored. Likewise, partcombining isn’t designed to work with lyrics; when one of the voices is explicitly named in order to attach lyrics to it, the partcombining stops working.

\partcombine only observes onset times of notes. It cannot determine whether a previously started note is playing or not, leading to various problems.


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.~   e'4            r16 e'8.~   e'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.~   d'4            r16 d'8.~   d'4            |
  c'2                        c'2                        |

}
\new StaffGroup <<
  \new Staff << \voiceA \\ \voiceB >>
  \new Staff { \clef bass \voiceC }
>>

[image of music]

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.~ e4       r16 e8.~  e4        |
  c2                c                   |

  % Bar 2
  r8 a,16 d f a, d f r8 a,16 d f a, d f |
  r16 d8.~  d4       r16 d8.~  d4       |
  c2                 c                  |

 }
\new StaffGroup <<
  \new Staff << \relative c'' \voiceA \\ \relative c' \voiceB >>
  \new Staff \relative c' { \clef bass \voiceC }
>>

[image of music]

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
       >>
     }
  >>
}

[image of music]

See also

Learning Manual: Organizing pieces with variables.

Snippets: Simultaneous notes.


1.6 Staff notation

[image of music]

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

This section describes the different methods of creating and grouping staves.


Instantiating new staves

Staves (singular: staff) are created with the \new or \context commands. For details, see Creating contexts.

The basic staff context is Staff:

\new Staff { c4 d e f }

[image of music]

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 }
}

[image of music]

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 }

[image of music]

TabStaff creates a tablature with six strings in standard guitar tuning. For details, see Default tablatures.

\new TabStaff { c4 d e f }

[image of music]

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 { c4 d e f e d }

[image of music]

New single staff contexts may be defined. For details, see Defining new contexts.

See also

Music Glossary: staff, staves.

Notation Reference: Creating 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.


Grouping staves

Various contexts exist to group single staves together in order to form multi-stave 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 { c1 c }
  \new Staff { c1 c }
>>

[image of music]

In the StaffGroup context, the group is started with a bracket and bar lines are drawn through all the staves.

\new StaffGroup <<
  \new Staff { c1 c }
  \new Staff { c1 c }
>>

[image of music]

In a ChoirStaff, the group starts with a bracket, but bar lines are not connected.

\new ChoirStaff <<
  \new Staff { c1 c }
  \new Staff { c1 c }
>>

[image of music]

In a GrandStaff, the group begins with a brace, and bar lines are connected between the staves.

\new GrandStaff <<
  \new Staff { c1 c }
  \new Staff { c1 c }
>>

[image of music]

The PianoStaff is identical to a GrandStaff, except that it supports printing the instrument name directly. For details, see Instrument names.

\new PianoStaff <<
  \set PianoStaff.instrumentName = #"Piano"
  \new Staff { c1 c }
  \new Staff { c1 c }
>>

[image of music]

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 ChoirStaffGroup context.

\score {
  \new StaffGroup { << 
  \set StaffGroup.systemStartDelimiter = #'SystemStartSquare
    \new Staff { c'4 d' e' f' }
    \new Staff { c'4 d' e' f' }
  >> }
}

[image of music]

Display bracket with only one staff in a system If there is only one staff in one of the staff types ChoirStaff or StaffGroup, the bracket and the starting bar line will not be displayed as standard behavior. This can be changed by overriding the relevant properties.

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.

\markup \left-column {
  \score {
    \new StaffGroup <<
      % Must be lower than the actual number of staff lines
      \override StaffGroup.SystemStartBracket #'collapse-height = #1
      \override Score.SystemStartBar #'collapse-height = #1
      \new Staff {
        c'1
      }
    >>
    \layout { }
  }
  \score {
    \new PianoStaff <<
      \override PianoStaff.SystemStartBrace #'collapse-height = #1
      \override Score.SystemStartBar #'collapse-height = #1
      \new Staff {
        c'1
      }
    >>
    \layout { }
  }
}

[image of music]

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 by setting the transparent property.

global = {
  \override Staff.BarLine #'transparent = ##t
  s1 s
  % the final bar line is not interrupted
  \revert Staff.BarLine #'transparent
  \bar "|."
}
\new StaffGroup \relative c'' {
  <<
    \new Staff { << \global { c1 c } >> }
    \new Staff { << \global { c c } >> }
  >>
}

[image of music]

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.


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 { c2 c | c2 c }
  \new StaffGroup <<
    \new Staff { g2 g | g2 g }
    \new StaffGroup \with {
      systemStartDelimiter = #'SystemStartSquare
    }
    <<
      \new Staff { e2 e | e2 e }
      \new Staff { c2 c | c2 c }
    >>
  >>
>>

[image of music]

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'' <<
  \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 }
>>

[image of music]

See also

Notation Reference: Grouping staves, Instrument names, Defining new contexts.

Snippets: Staff notation.

Internals Reference: StaffGroup, ChoirStaff, SystemStartBar, SystemStartBrace, SystemStartBracket, SystemStartSquare.


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

The lines of a staff belong to the StaffSymbol grob. StaffSymbol properties can be modified to change the appearance of a staff, but they must be modified before the staff is created.

The number of staff lines may be changed. The clef position and the position of middle C may need to be modified to fit the new staff. For an explanation, refer to the snippet section in Clef.

\new Staff \with {
  \override StaffSymbol #'line-count = #3
}
{ d4 d d d }

[image of music]

Staff line thickness can be modified. The thickness of ledger lines and stems are also affected, since they depend on staff line thickness.

\new Staff \with {
  \override StaffSymbol #'thickness = #3
}
{ e4 d c b }

[image of music]

Ledger line thickness can be set independently of staff line thickness. In the example the two numbers are factors multiplying the staff line thickness and the staff line spacing. The two contributions are added to give the ledger line thickness.

\new Staff \with {
  \override StaffSymbol #'ledger-line-thickness = #'(1 . 0.2)
}
{ e4 d c b }

[image of music]

The distance between staff lines can be changed. This setting affects the spacing of ledger lines as well.

\new Staff \with {
  \override StaffSymbol #'staff-space = #1.5
}
{ a4 b c d }

[image of music]

Further details about the properties of StaffSymbol can be found in staff-symbol-interface.

Modifications to staff properties in the middle of a score can be placed between \stopStaff and \startStaff:

c2 c
\stopStaff
\override Staff.StaffSymbol #'line-count = #2
\startStaff
b2 b
\stopStaff
\revert Staff.StaffSymbol #'line-count
\startStaff
a2 a

[image of music]

In general, \startStaff and \stopStaff can be used to stop or start a staff in the middle of a score.

c4 b a2
\stopStaff
b4 c d2
\startStaff
e4 d c2

[image of music]

Predefined commands

\startStaff, \stopStaff.

Selected Snippets

Making some staff lines thicker than the others

For pedagogical 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'
}

[image of music]

See also

Music Glossary: line, ledger line, staff.

Notation Reference: Clef.

Snippets: Staff notation.

Internals Reference: StaffSymbol, staff-symbol-interface.

Known issues and warnings

When setting vertical staff line positions manually, bar lines are always centered on position 0, so the maximum distance between the outermost bar lines in either direction must be equal.


Ossia staves

Ossia staves can be set by creating a new simultaneous staff in the appropriate location:

\new Staff \relative c'' {
  c4 b d c
  <<
    { c4 b d c }
    \new Staff { e4 d f e }
  >>
  c4 b c2
}

[image of music]

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'' {
  c4 b d c
  <<
    { c4 b d c }

    \new Staff \with {
      \remove "Time_signature_engraver"
      alignAboveContext = #"main"
      fontSize = #-3
      \override StaffSymbol #'staff-space = #(magstep -3)
      \override StaffSymbol #'thickness = #(magstep -3)
      firstClef = ##f
    }
    { e4 d f e }
  >>
  c4 b c2
}

[image of music]

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"
    \override Clef #'transparent = ##t
    fontSize = #-3
    \override StaffSymbol #'staff-space = #(magstep -3)
    \override StaffSymbol #'thickness = #(magstep -3)
  }
  { \stopStaff s1*6 }

  \new Staff \relative c' {
    c4 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
  }
>>

[image of music]

Using the \RemoveEmptyStaffContext 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. In this case, spacer rests do not need to be used at all; only \startStaff and \stopStaff are necessary. For more information about \RemoveEmptyStaffContext, see Hiding staves.

<<
  \new Staff = ossia \with {
    \remove "Time_signature_engraver"
    \override Clef #'transparent = ##t
    fontSize = #-3
    \override StaffSymbol #'staff-space = #(magstep -3)
    \override StaffSymbol #'thickness = #(magstep -3)
  }
  \new Staff \relative c' {
    c4 b c2
    e4 f e2
    g4 a g2 \break
    <<
      { c4 b c2 }
      \context Staff = ossia {
        c4 e8 d c2 \stopStaff
      }
    >>
    g4 a g2
    e4 d c2
  }
>>

\layout {
  \context {
    \RemoveEmptyStaffContext
    \override VerticalAxisGroup #'remove-first = ##t
  }
}

[image of music]

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"
      } {
        \times 4/6 {
          \override TextScript #'padding = #3
          c8[^"ossia above" d e d e f]
        }
      }
    >>
  }
>>

[image of music]

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.


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 c''' { a8 f e16 d c b a2 }

[image of music]

Empty staves can be hidden by setting the \RemoveEmptyStaffContext command in the \layout block. In orchestral scores, this style is known as ‘Frenched Score’. By default, this command hides and removes all empty staves in a score except for those in the first system.

Note: A staff is considered empty when it contains only multi-measure rests, skips, spacer rests, or a combination of these elements.

\layout {
  \context {
    \RemoveEmptyStaffContext
  }
}

\relative c' <<
  \new Staff {
    e4 f g a \break
    b1 \break
    a4 b c2
  }
  \new Staff {
    c,4 d e f \break
    R1 \break
    f4 g c,2
  }
>>

[image of music]

\RemoveEmptyStaffContext can also be used to create ossia sections for a staff. For details, see Ossia staves.

The \AncientRemoveEmptyStaffContext command may be used to hide empty staves in ancient music contexts. Similarly, \RemoveEmptyRhythmicStaffContext may be used to hide empty RhythmicStaff contexts.

Predefined commands

\RemoveEmptyStaffContext, \AncientRemoveEmptyStaffContext, \RemoveEmptyRhythmicStaffContext.

Selected Snippets

Removing the first empty line

The first empty staff can also be removed from the score by setting the VerticalAxisGroup property remove-first. This can be done globally inside the \layout block, or locally inside the specific staff that should be removed. In the latter case, you have to specify the context (Staff applies only to the current staff) in front of the property.

The lower staff of the second staff group is not removed, because the setting applies only to the specific staff inside of which it is written.

\layout {
  \context { 
    \RemoveEmptyStaffContext 
    % To use the setting globally, uncomment the following line:
    % \override VerticalAxisGroup #'remove-first = ##t
  }
}
\new StaffGroup <<
  \new Staff \relative c' {
    e4 f g a \break
    c1
  }
  \new Staff {
    % To use the setting globally, comment this line,
    % uncomment the line in the \layout block above
    \override Staff.VerticalAxisGroup #'remove-first = ##t
    R1 \break
    R
  }
>>
\new StaffGroup <<
  \new Staff \relative c' {
    e4 f g a \break
    c1
  }
  \new Staff {
    R1 \break
    R
  }
>>

[image of music]

See also

Music Glossary: Frenched staff.

Notation Reference: Staff symbol, Ossia staves.

Snippets: Staff notation.

Internals Reference: ChordNames, FiguredBass, Lyrics, Staff, VerticalAxisGroup, Staff_symbol_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:

\override StaffSymbol #'stencil = ##f
\override NoteHead #'no-ledgers = ##t

1.6.3 Writing parts

This section explains how to insert tempo indications and instrument names into a score. Methods to quote other voices and format cue notes are also described.


Metronome marks

A basic metronome mark is simple to write:

\tempo 4 = 120
c2 d
e4. d8 c2

[image of music]

Tempo indications with text can be used instead:

\tempo "Allegretto"
c4 e d c
b4. a16 b c4 r4

[image of music]

Combining a metronome mark and text will automatically place the metronome mark within parentheses:

\tempo "Allegro" 4 = 160
g4 c d e
d4 b g2

[image of music]

In general, the text can be any markup object:

\tempo \markup { \italic Faster } 4 = 132
a8-. r8 b-. r gis-. r a-. r

[image of music]

A parenthesized metronome mark with no textual indication may be written by including an empty string in the input:

\tempo "" 8 = 96
d4 g e c

[image of music]

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 { 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
}

[image of music]

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 { }
}

[image of music]

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
}

[image of music]

For more details, see Formatting text.

See also

Music Glossary: metronome, metronomic indication, tempo indication, metronome mark.

Notation Reference: Formatting text, MIDI output.

Snippets: Staff notation.

Internals Reference: MetronomeMark.


Instrument names

Instrument names can be printed on the left side of staves in the Staff and PianoStaff contexts. The value of instrumentName is used for the first staff, and the value of shortInstrumentName is used for all succeeding staves.

\set Staff.instrumentName = #"Violin "
\set Staff.shortInstrumentName = #"Vln "
c4.. g'16 c4.. g'16
\break
c1

[image of music]

Markup mode can be used to create more complicated instrument names:

\set Staff.instrumentName = \markup {
  \column { "Clarinetti"
            \line { "in B" \smaller \flat } } }
c4 c,16 d e f g2

[image of music]

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 {
    \set Staff.instrumentName = #"Flute"
    f2 g4 f
  }
  \new Staff {
    \set Staff.instrumentName = \markup \center-column {
      Clarinet
      \line { "in B" \smaller \flat }
    }
    c4 b c2
  }
>>

[image of music]

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 Horizontal dimensions.

\layout {
  indent = 3.0\cm
  short-indent = 1.5\cm
}

\relative c'' <<
  \new Staff {
    \set Staff.instrumentName = #"Alto Flute in G"
    \set Staff.shortInstrumentName = #"Fl."
    f2 g4 f \break
    g4 f g2
  }
  \new Staff {
    \set Staff.instrumentName = #"Clarinet"
    \set Staff.shortInstrumentName = #"Clar."
    c,4 b c2 \break
    c2 b4 c
  }
>>

[image of music]

To add instrument names to other contexts (such as GrandStaff, ChoirStaff, or StaffGroup), Instrument_name_engraver must be added to that context. For details, see Modifying context plug-ins.

Instrument names may be changed in the middle of a piece:

\set Staff.instrumentName = #"First"
\set Staff.shortInstrumentName = #"one"
c1 c c c \break
c1 c c c \break
\set Staff.instrumentName = #"Second"
\set Staff.shortInstrumentName = #"two"
c1 c c c \break
c1 c c c \break

[image of music]

If an instrument switch is needed, \addInstrumentDefinition may be used in combination with \instrumentSwitch to create a detailed list of the necessary changes for the switch. The \addInstrumentDefinition command has two arguments: an identifying string, and an association list of context properties and values to be used for the instrument. It must be placed in the toplevel scope. \instrumentSwitch is used in the music expression to declare the instrument switch:

\addInstrumentDefinition #"contrabassoon"
  #`((instrumentTransposition . ,(ly:make-pitch -1 0 0))
     (shortInstrumentName . "Cbsn.")
     (clefGlyph . "clefs.F")
     (middleCPosition . 6)
     (clefPosition . 2)
     (instrumentCueName . ,(make-bold-markup "cbsn."))
     (midiInstrument . "bassoon"))

\new Staff \with {
  instrumentName = #"Bassoon"
}
\relative c' {
  \clef tenor
  \compressFullBarRests
  c2 g'
  R1*16
  \instrumentSwitch "contrabassoon"
  c,,2 g \break
  c,1 ~ | c1
}

[image of music]

See also

Notation Reference: Horizontal dimensions, Modifying context plug-ins.

Snippets: Staff notation.

Internals Reference: InstrumentName, PianoStaff, Staff.


Quoting other voices

It is very common for one voice to double some of the music from another voice. For example, the first and second violins may play the same notes during a passage of music. In LilyPond this is accomplished by letting one voice quote the other voice without having to re-enter it.

Before a part can be quoted, the \addQuote command must be used to initialize the quoted fragment. This command must be used in the toplevel scope. The first argument is an identifying string, and the second is a music expression:

flute = \relative c'' {
  a4 gis g gis
}
\addQuote "flute" { \flute }

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 that indicates the duration of the quote, usually spacer rests or multi-measure rests. The corresponding music from the quoted voice is inserted into the music expression:

flute = \relative c'' {
  a4 gis g gis
}
\addQuote "flute" { \flute }

\relative c' {
  c4 cis \quoteDuring #"flute" { s2 }
}

[image of music]

If the music expression used for \quoteDuring contains anything but a spacer rest or multi-measure rest, a polyphonic situation is created, which is often not desirable:

flute = \relative c'' {
  a4 gis g gis
}
\addQuote "flute" { \flute }

\relative c' {
  c4 cis \quoteDuring #"flute" { c4 b }
}

[image of music]

Quotations recognize instrument transposition settings for both the source and target instruments if the \transposition command is used. For details about \transposition, see Instrument transpositions.

clarinet = \relative c'' {
  \transposition bes
  a4 gis g gis
}
\addQuote "clarinet" { \clarinet }

\relative c' {
  c4 cis \quoteDuring #"clarinet" { s2 }
}

[image of music]

It is possible to tag quotations with unique names in order to process them in different ways. For details about this procedure, see Using tags.

Selected Snippets

Quoting another voice with transposition Quotations take into account the transposition of both source and target. In this example, all instruments play sounding middle C; the target is an instrument in F. The target part may be transposed using \transpose. In this case, all the pitches (including the quoted ones) are transposed.

\addQuote clarinet {
  \transposition bes
  \repeat unfold 8 { d'16 d' d'8 }
}

\addQuote sax {
  \transposition es'
  \repeat unfold 16 { a8 }
}

quoteTest = {
  % french horn
  \transposition f
  g'4
  << \quoteDuring #"clarinet" { \skip 4 } s4^"clar." >>
  << \quoteDuring #"sax" { \skip 4 } s4^"sax." >>
  g'4
}

{
  \set Staff.instrumentName =
    \markup {
      \center-column { Horn \line { in F } }
    }
  \quoteTest
  \transpose c' d' << \quoteTest s4_"up a tone" >>
}

[image of music]

Quoting another voice The quotedEventTypes property determines the music event types that are quoted. The default value is (note-event rest-event), which means that only notes and rests of the quoted voice appear in the \quoteDuring expression. In the following example, a 16th rest is not quoted since rest-event is not in quotedEventTypes.

quoteMe = \relative c' {
  fis4 r16 a8.-> b4\ff c
}
\addQuote quoteMe \quoteMe

original = \relative c'' {
  c8 d s2
  \once \override NoteColumn #'ignore-collision = ##t
  es8 gis8
}

<<
  \new Staff {
    \set Staff.instrumentName = #"quoteMe"
    \quoteMe
  }
  \new Staff {
    \set Staff.instrumentName = #"orig"
    \original
  }
  \new Staff \relative c'' <<
    \set Staff.instrumentName = #"orig+quote"
    \set Staff.quotedEventTypes =
      #'(note-event articulation-event)
    \original
    \new Voice {
      s4
      \set fontSize = #-4
      \override Stem #'length-fraction = #(magstep -4)
      \quoteDuring #"quoteMe" { \skip 2. }
    }
  >>
>>

[image of music]

See also

Notation Reference: Instrument transpositions, Using tags.

Snippets: Staff notation.

Internals Reference: QuoteMusic, Voice.

Known issues and warnings

Only the contents of the first Voice occurring in an \addQuote command will be considered for quotation, so music cannot contain \new and \context Voice statements that would switch to a different Voice.

Quoting grace notes is broken and can even cause LilyPond to crash.

Quoting nested triplets may result in poor notation.

In earlier versions of LilyPond (pre 2.11), addQuote was written entirely in lower-case letters: \addquote.


Formatting cue notes

The previous section explains how to create quotations. The \cueDuring command is a more specialized form of \quoteDuring, being particularly useful for inserting cue notes into a part. The syntax is as follows:

\cueDuring #partname #voice music

This command copies the corresponding measures from partname into a CueVoice context. The CueVoice is created implicitly, and occurs simultaneously with music, which creates a polyphonic situation. The voice argument determines whether the cue notes should be notated as a first or second voice; UP corresponds to the first voice, and DOWN corresponds to the second.

oboe = \relative c'' {
  r2 r8 d16 f e g f a
  g8 g16 g g2.
}
\addQuote "oboe" { \oboe }

\new Voice \relative c'' {
  \cueDuring #"oboe" #UP { R1 }
  g2 c,
}

[image of music]

In the above example, the Voice context had to be explicitly declared, or else the entire music expression would belong to the CueVoice context.

The name of the cued instrument can be printed by setting the instrumentCueName property in the CueVoice context.

oboe = \relative c''' {
  g4 r8 e16 f e4 d
}
\addQuote "oboe" { \oboe }

\new Staff \relative c'' <<
  \new CueVoice \with {
    instrumentCueName = "ob."
  }
  \new Voice {
    \cueDuring #"oboe" #UP { R1 }
    g4. b8 d2
  }
>>

[image of music]

In addition to printing the name of the cued instrument, when cue notes end, the name of the original instrument should be printed, and any other changes introduced by the cued part should be undone. This can be accomplished by using \addInstrumentDefinition and \instrumentSwitch. For an example and explanation, see Instrument names.

The \killCues command removes cue notes from a music expression. This can be useful if cue notes need to be removed from a part but may be restored at a later time.

flute = \relative c''' {
  r2 cis2 r2 dis2
}
\addQuote "flute" { \flute }

\new Voice \relative c'' {
  \killCues {
    \cueDuring #"flute" #UP { R1 }
    g4. b8 d2
  }
}

[image of music]

The \transposedCueDuring command is useful for adding instrumental cues from a completely different register. The syntax is similar to \cueDuring, but it requires one extra argument to specify the transposition of the cued instrument. For more information about transposition, see Instrument transpositions.

piccolo = \relative c''' {
  \clef "treble^8"
  R1
  c8 c c e g2
  a4 g g2
}
\addQuote "piccolo" { \piccolo }

cbassoon = \relative c, {
  \clef "bass_8"
  c4 r g r
  \transposedCueDuring #"piccolo" #UP c,, { R1 }
  c4 r g r
}

<<
  \new Staff = "piccolo" \piccolo
  \new Staff = "cbassoon" \cbassoon
>>

[image of music]

It is possible to tag cued parts with unique names in order to process them in different ways. For details about this procedure, see Using tags.

See also

Notation Reference: Instrument transpositions, Instrument names, 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.


1.7 Editorial annotations

[image of music]

This section discusses the various ways to change the appearance of notes and add analysis or educational emphasis.


1.7.1 Inside the staff

This section discusses how to add emphasis to elements that are inside the staff.


Selecting notation font size

The font size of notation elements may be altered. It does not change the size of variable symbols, such as beams or slurs.

Note: For font sizes of text, see Selecting font and font size.

\huge
c4.-> d8---3
\large
c4.-> d8---3
\normalsize
c4.-> d8---3
\small
c4.-> d8---3
\tiny
c4.-> d8---3
\teeny
c4.-> d8---3

[image of music]

Internally, this sets the fontSize property. This in turn causes the font-size property to be set in all layout objects. The value of font-size is a number indicating the size relative to the standard size for the current staff height. Each step up is an increase of approximately 12% of the font size. Six steps is exactly a factor of two. The Scheme function magstep converts a font-size number to a scaling factor. The font-size property can also be set directly, so that only certain layout objects are affected.

\set fontSize = #3
c4.-> d8---3
\override NoteHead #'font-size = #-4
c4.-> d8---3
\override Script #'font-size = #2
c4.-> d8---3
\override Stem #'font-size = #-5
c4.-> d8---3

[image of music]

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, a 10pt font is selected.

The font-size property can only be set on layout objects that use fonts. These are the ones supporting the font-interface layout interface.

Predefined commands

\teeny, \tiny, \small, \normalsize, \large, \huge.

See also

Snippets: Editorial annotations.

Internals Reference: font-interface.


Fingering instructions

Fingering instructions can be entered using note-digit:

c4-1 d-2 f-4 e-3

[image of music]

Markup texts may be used for finger changes.

c4-1 d-2 f-4 c^\markup { \finger "2 - 3" }

[image of music]

A thumb-script can be added (e.g., in cello music) to indicate that a note should be played with the thumb.

<a_\thumb a'-3>2 <b_\thumb b'-3>

[image of music]

Fingerings for chords can also be added to individual notes of the chord by adding them after the pitches.

<c-1 e-2 g-3 b-5>2 <d-1 f-2 a-3 c-5>

[image of music]

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.

\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
}

[image of music]

Allowing fingerings to be printed inside the staff

By default, vertically oriented fingerings are positioned outside the staff. However, this behavior can be canceled.

\relative c' {
  <c-1 e-2 g-3 b-5>2
  \once \override Fingering #'staff-padding = #'()
  <c-1 e-2 g-3 b-5>2
}

[image of music]

Avoiding collisions with chord fingerings

Fingerings and string numbers applied to individual notes will automatically avoid beams and stems, but this is not true by default for fingerings and string numbers applied to the individual notes of chords. The following example shows how this default behavior can be overridden.

\relative c' {
  \set fingeringOrientations = #'(up)
  \set stringNumberOrientations = #'(up)
  \set strokeFingerOrientations = #'(up)
  
  % Default behavior
  r8
  <f c'-5>8
  <f c'\5>8
  <f c'-\rightHandFinger #2 >8
  
  % Corrected to avoid collisions
  r8
  \override Fingering #'add-stem-support = ##t
  <f c'-5>8
  \override StringNumber #'add-stem-support = ##t
  <f c'\5>8
  \override StrokeFinger #'add-stem-support = ##t
  <f c'-\rightHandFinger #2 >8
}

[image of music]

See also

Notation Reference: Direction and placement

Snippets: Editorial annotations.

Internals Reference: FingeringEvent, fingering-event, Fingering_engraver, New_fingering_engraver, Fingering.


Hidden notes

Hidden (or invisible or transparent) notes can be useful in preparing theory or composition exercises.

c4 d
\hideNotes
e4 f
\unHideNotes
g a
\hideNotes
b
\unHideNotes
c

[image of music]

Notation objects which are attached to invisible notes are still visible.

c4( d)
\hideNotes
e4(\p f)--

[image of music]

Predefined commands

\hideNotes, \unHideNotes.

See also

Snippets: Editorial annotations.

Internals Reference: Note_spacing_engraver, NoteSpacing.


Coloring objects

Individual objects may be assigned colors. Valid color names are listed in the List of colors.

\override NoteHead #'color = #red
c4 c
\override NoteHead #'color = #(x11-color 'LimeGreen)
d
\override Stem #'color = #blue
e

[image of music]

The full range of colors defined for X11 can be accessed by using the Scheme function x11-color. The function takes one argument; this can be a symbol in the form ’FooBar or a string in the form "FooBar". The first form is quicker to write and is more efficient. However, using the second form it is possible to access X11 colors by the multi-word form of its name.

If x11-color cannot make sense of the parameter then the color returned defaults to black.

\override Staff.StaffSymbol #'color = #(x11-color 'SlateBlue2)
\set Staff.instrumentName = \markup {
  \with-color #(x11-color 'navy) "Clarinet"
}

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

[image of music]

Exact RGB colors can be specified using the Scheme function rgb-color.

\override Staff.StaffSymbol #'color = #(x11-color 'SlateBlue2)
\set Staff.instrumentName = \markup {
  \with-color #(x11-color 'navy) "Clarinet"
}

\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

[image of music]

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 normal colors are recommended (i.e., #blue, #green, #red).

Notes in a chord cannot be colored with \override; use \tweak instead, see The \tweak command.


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.

c2 \parenthesize d
c2 \parenthesize <c e g>
c2 <c \parenthesize e g>

[image of music]

Non-note objects may be parenthesized as well.

c2-\parenthesize -. d
c2 \parenthesize r

[image of music]

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.


Stems

Whenever a note is found, a Stem object is created automatically. For whole notes and rests, they are also created but made invisible.

Predefined commands

\stemUp, \stemDown, \stemNeutral.

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
}

[image of music]

See also

Notation Reference: Direction and placement.

Snippets: Editorial annotations.

Internals Reference: Stem_engraver, Stem, stem-interface.


1.7.2 Outside the staff

This section discusses how to add emphasis to elements in the staff from outside of the staff.


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" }
{
  \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.
}

[image of music]

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 normally influences note spacing, but this can be altered:

\new Voice \with { \consists "Balloon_engraver" }
{
  \balloonLengthOff
  \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.
}

[image of music]

Predefined commands

\balloonLengthOn, \balloonLengthOff.

See also

Snippets: Editorial annotations.

Internals Reference: Balloon_engraver, BalloonTextItem, balloon-interface.


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 c'' {
      \stemUp
      c4. d8 e8 f g4
    }
    \new Staff \relative c {
      \clef bass
      \stemDown
      c4 g' f e
    }
  >>
}

[image of music]

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
    }
  }
}

[image of music]

See also

Snippets: Editorial annotations.

Internals Reference: Grid_line_span_engraver, Grid_point_engraver, GridLine, GridPoint, grid-line-interface, grid-point-interface.


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'' {
  c2\startGroup
  d\stopGroup
}

[image of music]

Analysis brackets may be nested.

\layout {
  \context {
    \Voice
    \consists "Horizontal_bracket_engraver"
  }
}
\relative c'' {
  c4\startGroup\startGroup
  d4\stopGroup
  e4\startGroup
  d4\stopGroup\stopGroup
}

[image of music]

See also

Snippets: Editorial annotations.

Internals Reference: Horizontal_bracket_engraver, HorizontalBracket, horizontal-bracket-interface, Staff.


1.8 Text

[image of music]

This section explains how to include text (with various formatting) in music scores.

Some text elements that are not dealt with here are discussed in other specific sections: Vocal music, Titles and headers.


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 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.

a8^"pizz." g f e a4-"scherz." f

[image of music]

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.

a8^\markup { \italic pizz. } g f e
a4_\markup { \tiny scherz. \bold molto } f

[image of music]

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.

a8^"pizz." g f e
\textLengthOn
a4_"scherzando" f

[image of music]

Predefined commands

\textLengthOn, \textLengthOff.

See also

Notation Reference: Formatting text, Direction and placement.

Snippets: Text.

Internals Reference: TextScript.

Known issues and warnings

Checking to make sure that text scripts and lyrics are within the margins is a relatively large computational task. To speed up processing, LilyPond does not perform such calculations by default; to enable it, use

\override Score.PaperColumn #'keep-inside-line = ##t

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:

\override TextSpanner #'(bound-details left text) = "rit."
b1\startTextSpan
e,\stopTextSpan

[image of music]

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.

\override TextSpanner #'(bound-details left text) =
  \markup { \upright "rit." }
b1\startTextSpan c
e,\stopTextSpan

[image of music]

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.

See also

Notation Reference: Line styles, Dynamics.

Snippets: Text.

Internals Reference: TextSpanner.


Text marks

Various text elements may be added to a score using the syntax described in Rehearsal marks:

c4
\mark "Allegro"
c c c

[image of music]

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:

<c e>1
\mark \markup { \italic { colla parte } }
<d f>2 <e g>
<c f aes>1

[image of music]

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:

<bes f>2 <aes d>
\mark \markup { \musicglyph #"scripts.ufermata" }
<e g>1

[image of music]

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.

\mark "Allegro"
c1 c
\mark "assai" \break
c  c

[image of music]

Selected Snippets

Printing marks at the end of a line or a score

Marks can be printed at the end of the current line, instead of the beginning of the following line. This is particularly useful when a mark has to be added at the end of a score – when there is no next line.

In such cases, the right end of the mark has to be aligned with the final bar line, as demonstrated on the second line of this example.

\relative c'' {  
  \override Score.RehearsalMark #'break-visibility = #begin-of-line-invisible
  g2 c
  d,2 a'
  \mark \default
  \break
  g2 b,
  c1 \bar "||"
  \override Score.RehearsalMark #'self-alignment-X = #RIGHT  
  \mark "D.C. al Fine"
}

[image of music]

Aligning marks with various notation objects If specified, text marks may be aligned with notation objects other than bar lines. These objects include ambitus, breathing-sign, clef, custos, staff-bar, left-edge, key-cancellation, key-signature, and time-signature.

In such cases, text marks will be horizontally centered above the object. However this can be changed, as demonstrated on the second line of this example (in a score with multiple staves, this setting should be done for all the staves).

\relative c' {
  e1
  
  % the RehearsalMark will be centered above the Clef
  \override Score.RehearsalMark #'break-align-symbols = #'(clef)
  \key a \major
  \clef treble
  \mark "↓"
  e1
  
  % the RehearsalMark will be centered above the TimeSignature
  \override Score.RehearsalMark #'break-align-symbols = #'(time-signature)
  \key a \major
  \clef treble
  \time 3/4
  \mark "↓"
  e2.
  
  % the RehearsalMark will be centered above the KeySignature
  \override Score.RehearsalMark #'break-align-symbols = #'(key-signature)
  \key a \major
  \clef treble
  \time 4/4
  \mark "↓"
  e1

  \break
  e1
  
  % the RehearsalMark will be aligned with the left edge of the KeySignature
  \once \override Score.KeySignature #'break-align-anchor-alignment = #LEFT
  \mark "↓"
  \key a \major
  e1
  
  % the RehearsalMark will be aligned with the right edge of the KeySignature
  \once \override Score.KeySignature #'break-align-anchor-alignment = #RIGHT
  \key a \major
  \mark "↓"
  e1
  
  % the RehearsalMark will be aligned with the left edge of the KeySignature
  % and then shifted right by one unit.
  \once \override Score.KeySignature #'break-align-anchor = #1
  \key a \major
  \mark "↓"
  e1
}

[image of music]

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"
    }
  }
}

[image of music]

See also

Notation Reference: Rehearsal marks, Formatting text, Music notation inside markup, The Feta font.

Snippets: Text.

Internals Reference: RehearsalMark.

Known issues and warnings

If a mark is entered at the end of the last bar of the score (where there is no next line), then the mark will not be printed at all.


Separate text

A \markup block can exist by itself, outside of any any \score block, as a “top-level expression”. This syntax is described in File structure.

\markup {
  Tomorrow, and tomorrow, and tomorrow...
}

[image of music]

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
}

[image of music]

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, \markuplines.

Selected Snippets

Stand-alone two-column markup

Stand-alone text may be arranged in several columns using \markup commands:

\markup {
 \fill-line {
  \hspace #1.0
  \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 {
   \line { \italic {"O sacred feast"} }
   \line { \italic {"in which Christ is received,"} }
   \line { \italic {"the memory of His Passion is renewed,"} }
   \line { \italic {"the mind is filled with grace," } }
   \line { \italic {"and a pledge of future glory is given to us." }}
   \line { \italic {"Amen."}}
  }
  \hspace #1.0
 }
}

[image of music]

See also

Notation Reference: Formatting text, File structure, Multiple scores in a book, Multi-page markup.

Snippets: Text.

Internals Reference: TextScript.


1.8.2 Formatting text

This section presents basic and advanced text formatting, using the \markup mode specific syntax.


Text markup introduction

A \markup block is used to typeset text with an extensible syntax called “markup mode”.

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.

a1-\markup intenso
a2^\markup { poco \italic più forte  }
c e1
d2_\markup { \italic "string. assai" }
e
b1^\markup { \bold { molto \italic  agitato } }
c

[image of music]

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.

a1^"\italic markup..."
a_\markup { \italic "... prints \"italic\" letters!" }
a a

[image of music]

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:

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" } }

[image of music]

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
}

[image of music]

An exhaustive list of \markup-specific commands can be found in Text markup commands.

See also

Notation Reference: Text markup commands.

Snippets: Text.

Installed files: ‘scm/markup.scm’.

Known issues and warnings

Syntax errors for markup mode can be confusing.


Selecting font and font size

Basic font switching is supported in markup mode:

d1^\markup {
  \bold { Più mosso }
  \italic { non troppo \underline Vivo }
}
r2 r4 r8
d,_\markup { \italic quasi \smallCaps Tromba }
f1 d2 r

[image of music]

The size of the characters can also be altered in different ways:

The following example demonstrates these three methods:

f1_\markup {
  \tiny espressivo
  \large e
  \normalsize intenso
}
a^\markup {
  \fontsize #5 Sinfonia
  \fontsize #2 da
  \fontsize #3 camera
}
bes^\markup { (con
  \larger grande
  \smaller emozione
  \magnify #0.6 { e sentimento } )
}
d c2 r8 c bes a g1

[image of music]

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) }  }
  }
}

[image of music]

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. }
  }
}

[image of music]

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 }
    }
  }
}

[image of music]

An exhaustive list of font switching, 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.

Snippets: Text.

Internals Reference: TextScript.

Installed files: ‘scm/define-markup-commands.scm’.


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.

d1-\markup { poco }
f
d-\markup { \left-align poco }
f
d-\markup { \center-align { poco } }
f
d-\markup { \right-align poco }

[image of music]

Horizontal alignment may be fine-tuned using a numeric value:

a1-\markup { \halign #-1 poco }
e'
a,-\markup { \halign #0 poco }
e'
a,-\markup { \halign #0.5 poco }
e'
a,-\markup { \halign #2 poco }

[image of music]

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 is a bit more complex. As stated above, markup objects can be moved as a whole; however, it is also possible to move specific elements inside a markup block. In this case, the element to be moved needs to be preceded with an anchor point, that can be another markup element or an invisible object. The following example demonstrates these two possibilities; the last markup in this example has no anchor point, and therefore is not moved.

d2^\markup {
  Acte I
  \raise #2 { Scène 1 }
}
a'
g_\markup {
  \null
  \lower #4 \bold { Très modéré }
}
a
d,^\markup {
  \raise #4 \italic { Une forêt. }
}
a'4 a g2 a

[image of music]

Some commands can affect both the horizontal and vertical alignment of text objects in markup mode. Any object affected by these commands must be preceded with an anchor point:

d2^\markup {
  Acte I
  \translate #'(-1 . 2) "Scène 1"
}
a'
g_\markup {
  \null
  \general-align #Y #3.2 \bold "Très modéré"
}
a
d,^\markup {
  \null
  \translate-scaled #'(-1 . 2) \teeny "Une forêt."
}
a'4 a g2 a

[image of music]

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 }
  }
}

[image of music]

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 }
}

[image of music]

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)
    }
  }
}

[image of music]

An exhaustive list of text alignment commands can be found in Align.

See also

Learning Manual: Moving objects.

Notation Reference: Align, Text marks.

Snippets: Text.

Internals Reference: TextScript.

Installed files: ‘scm/define-markup-commands.scm’.


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
  }
}

[image of music]

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"
  }
  \pad-around #3
      "String quartet keeps very even time,
Flute quartet keeps very uneven time."
}

[image of music]

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
  }
}

[image of music]

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 explicitely specify the size of the drawing, as demonstrated below:

c1^\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

[image of music]

An exhaustive list of graphics-specific commands can be found in Graphic.

See also

Notation Reference: Graphic, Editorial annotations.

Snippets: Text.

Internals Reference: TextScript.

Installed files: ‘scm/define-markup-commands.scm’, ‘scm/stencil.scm’.


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:

a2 a^\markup {
  \note #"4" #1
  =
  \note-by-number #1 #1 #1.5
}
b1_\markup {
  \natural \semiflat \flat
  \sesquiflat \doubleflat
}
\glissando
a1_\markup {
  \natural \semisharp \sharp
  \sesquisharp \doublesharp
}
\glissando b

[image of music]

Other notation objects may also be printed in markup mode:

g1 bes
ees-\markup {
  \finger 4
  \tied-lyric #"~"
  \finger 1
}
fis_\markup { \dynamic rf }
bes^\markup {
  \beam #8 #0.1 #0.5
}
cis
d-\markup {
  \markalphabet #8
  \markletter #8
}

[image of music]

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 Feta font.

c2
c'^\markup { \musicglyph #"eight" }
c,4
c,8._\markup { \musicglyph #"clefs.G_change" }
c16
c2^\markup { \musicglyph #"timesig.neomensural94" }

[image of music]

Another way of printing non-text glyphs is described in Fonts explained.

The markup mode also supports diagrams for specific instruments:

c1^\markup {
  \fret-diagram-terse #"x;x;o;2;3;2;"
}
c^\markup {
  \harp-pedal #"^-v|--ov^"
}
c
c^\markup {
  \combine
    \musicglyph #"accordion.accDiscant"
    \combine
      \raise #0.5 \musicglyph #"accordion.accDot"
      \raise #1.5 \musicglyph #"accordion.accDot"
}

[image of music]

Such diagrams are documented in Instrument Specific Markup.

A whole score can even be nested inside a markup object. In such a case, the nested \score block must contain a \layout block, as demonstrated here:

c4 d^\markup {
  \score {
    \relative c' { c4 d e f }
    \layout { }
  }
}
e f |
c d e f

[image of music]

An exhaustive list of music notation related commands can be found in Music.

See also

Notation Reference: Music, The Feta font, Fonts explained.

Snippets: Text.

Internals Reference: TextScript.

Installed files: ‘scm/define-markup-commands.scm’, ‘scm/fret-diagrams.scm’, ‘scm/harp-pedals.scm’.


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:

\markuplines {
  \justified-lines {
    A very long text of justified lines.
    ...
  }
  \wordwrap-lines {
    Another very long paragraph.
    ...
  }
  ...
}

[image of music]

This syntax accepts a list of markups, that can be

An exhaustive list of markup list commands can be found in Text markup list commands.

See also

Notation Reference: Text markup list commands, New markup list command definition.

Snippets: Text.

Internals Reference: TextScript.

Installed files: ‘scm/define-markup-commands.scm’.

Predefined commands

\markuplines.


1.8.3 Fonts

This section presents the way fonts are handled, and how they may be changed in scores.


Fonts explained

Fonts are handled through several libraries. FontConfig is used to detect available fonts on the system; the selected fonts are rendered using Pango.

Music notation fonts can be described as a set of specific glyphs, ordered in several families. The following syntax allows various LilyPond feta non-text fonts to be used directly in markup mode:

a1^\markup {
  \vcenter {
    \override #'(font-encoding . fetaBraces)
    \lookup #"brace120"
    \override #'(font-encoding . fetaNumber)
    \column { 1 3 }
    \override #'(font-encoding . fetaDynamic)
    sf
    \override #'(font-encoding . fetaMusic)
    \lookup #"noteheads.s0petrucci"
  }
}

[image of music]

A simpler, but more limited syntax is also described in Music notation inside markup.

Three families of text fonts are made available: the roman (serif) font, that defaults to New Century Schoolbook, the sans font and the monospaced typewriter font – these last two families are determined by the Pango installation.

Each family may include different shapes and series. The following example demonstrates the ability to select alternate families, shapes, series and sizes. The value supplied to font-size is the required change from the default size.

\override Score.RehearsalMark #'font-family = #'typewriter
\mark \markup "Ouverture"
\override Voice.TextScript #'font-shape = #'italic
\override Voice.TextScript #'font-series = #'bold
d2.^\markup "Allegro"
\override Voice.TextScript #'font-size = #-3
c4^smaller

[image of music]

A similar syntax may be used in markup mode, however in this case it is preferable to use the simpler syntax explained in Selecting font and font size:

\markup {
  \column {
    \line {
      \override #'(font-shape . italic)
      \override #'(font-size . 4)
      Idomeneo,
    }
    \line {
      \override #'(font-family . typewriter)
      {
        \override #'(font-series . bold)
        re
        di
      }
      \override #'(font-family . sans)
      Creta
    }
  }
}

[image of music]

Although it is easy to switch between preconfigured fonts, it is also possible to use other fonts, as explained in the following sections: Single entry fonts and Entire document fonts.

See also

Notation Reference: The Feta font, Music notation inside markup, Selecting font and font size, Font.


Single entry fonts

Any font that is installed on the operating system and recognized by FontConfig may be used in a score, using the following syntax:

\override Staff.TimeSignature #'font-name = #"Charter"
\override Staff.TimeSignature #'font-size = #2
\time 3/4

a1_\markup {
  \override #'(font-name . "Vera Bold")
    { Vera Bold }
}

[image of music]

The following command displays a list of all available fonts on the operating system:

lilypond -dshow-available-fonts x

The last argument of the command can be anything, but has to be present.

See also

Notation Reference: Fonts explained, Entire document fonts.

Snippets: Text.

Installed files: ‘lily/font-config-scheme.cc’.


Entire document fonts

It is possible to change the fonts to be used as the default fonts in the roman, sans and typewriter font families by specifying them, in that order, as shown in the example below. For an explanation of fonts, see Fonts explained.

\paper  {
  myStaffSize = #20
  #(define fonts
    (make-pango-font-tree "Times New Roman"
                          "Nimbus Sans"
                          "Luxi Mono"
                           (/ myStaffSize 20)))
}

\relative c'{
  c1-\markup {
    roman,
    \sans sans,
    \typewriter typewriter. }
}

[image of music]

See also

Notation Reference: Fonts explained, Single entry fonts, Selecting font and font size, Font.


2. Specialist notation

This chapter explains how to create musical notation for specific types of instrument or in specific styles.


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

This section discusses issues related to vocal music in general, and to some particular styles of vocal music.


References for vocal music and lyrics

Various issues may arise when engraving vocal music. Some of these are discussed in this section, while others are explained elsewhere:


Opera

TBC


Song books

TBC

Selected Snippets

Simple lead sheet

When put together, chord names, a melody, and lyrics form a lead sheet:

<<
  \chords { c2 g:sus4 f e }
  \relative c'' {
    a4 e c8 e r4
    b2 c4( d)
  }
  \addlyrics { One day this shall be free __ }
>>

[image of music]

See also

Notation Reference: Chord notation.


Spoken music

Such effects as ‘parlato’ or ‘Sprechgesang’ require perfomers to speak without pitch but still with rhythm; these are notated by cross note heads, as demonstrated in Special note heads.


Chants

TBC


Ancient vocal music

TBC

See also

Notation Reference: Ancient notation.


2.1.2 Entering lyrics


Lyrics explained

Since LilyPond input files are text, there is at least one issue to consider when working with vocal music: song texts must be interpreted as text, not notes. For example, the input d should be interpreted as a one letter syllable, not the note D. Therefore, a special lyric mode has to be used, either explicitely or using some abbreviated methods.

Lyrics are entered in a special input mode, which can be introduced by the keyword \lyricmode, or by using \addlyrics or \lyricsto. In this mode you can enter lyrics, with punctuation and accents, and the input d is not parsed as a pitch, but rather as a one letter syllable. Syllables are entered like notes, but with pitches replaced by text. For example,

\lyricmode { Twin-4 kle4 twin- kle litt- le star2 }

There are two main methods to specify the horizontal placement of the syllables, either by specifying the duration of each syllable explicitly, like in the example above, or by automatically aligning the lyrics to a melody or other voice of music, using \addlyrics or \lyricsto.

A word or syllable of lyrics begins with an alphabetic character, and ends with any space or digit. The following characters can be any character that is not a digit or white space.

Any character that is not a digit or white space will be regarded as part of the syllable; one important consequence of this is that a word can end with }, which often leads to the following mistake:

\lyricmode { 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.

Similarly, a period which follows an alphabetic sequence is included in the resulting string. As a consequence, spaces must be inserted around property commands: do not write

\override Score.LyricText #'font-shape = #'italic

but instead use

\override Score . LyricText #'font-shape = #'italic

In order to assign more than one syllable to a single note, you can surround them with quotes or use a _ character, to get spaces between syllables, or use tilde symbol (~) to get a lyric tie.

\time 3/4
\relative c' { c2 e4 g2 e4 }
\addlyrics { gran- de_a- mi- go }
\addlyrics { pu- "ro y ho-" nes- to }
\addlyrics { pu- ro~y~ho- nes- to }

[image of music]

The lyric tie is implemented with the Unicode character U+203F; therefore a font that includes this glyph (such as DejaVuLGC) has to be used. More explanations about text and non-text fonts can be found in Fonts.

To enter lyrics with characters from non-English languages, or with accented and special characters (such as the heart symbol or slanted quotes), simply insert the characters directly into the input file and save it with UTF-8 encoding. See Text encoding, for more info.

\relative c' { e4 f e d e f e2 }
\addlyrics { He said: “Let my peo ple go”. }

[image of music]

To use normal quotes in lyrics, add a backslash before the quotes. For example,

\relative c' { \time 3/4 e4 e4. e8 d4 e d c2. }
\addlyrics { "\"I" am so lone- "ly\"" said she }

[image of music]

The full definition of a word start in Lyrics mode is somewhat more complex.

A word in Lyrics mode begins with: an alphabetic character, _, ?, !, :, ', the control characters ^A through ^F, ^Q through ^W, ^Y, ^^, any 8-bit character with ASCII code over 127, or a two-character combination of a backslash followed by one of `, ', ", or ^.

To define variables containing lyrics, the function lyricmode must be used.

verseOne = \lyricmode { Joy to the world the Lord is come }
\score {
  <<
    \new Voice = "one" \relative c'' {
      \autoBeamOff
      \time 2/4
      c4 b8. a16 g4. f8 e4 d c2
    }
    \addlyrics { \verseOne }
  >>
}

See also

Notation Reference: Fonts.

Internals Reference: LyricText, LyricSpace.


Setting simple songs

The easiest way to add lyrics to a melody is to append

\addlyrics { the lyrics }

to a melody. Here is an example,

\time 3/4
\relative c' { c2 e4 g2. }
\addlyrics { play the game }

[image of music]

More stanzas can be added by adding more \addlyrics sections

\time 3/4
\relative c' { c2 e4 g2. }
\addlyrics { play the game }
\addlyrics { speel het spel }
\addlyrics { joue le jeu }

[image of music]

The command \addlyrics cannot handle polyphony settings. For these cases you should use \lyricsto and \lyricmode, as will be introduced in Lyrics explained.


Working with lyrics and variables

To define variables containing lyrics, the function \lyricmode must be used. You do not have to enter durations though, if you add \addlyrics or \lyricsto when invoking your variable.

verseOne = \lyricmode { Joy to the world the Lord is come }
\score {
 <<
   \new Voice = "one" \relative c'' {
     \autoBeamOff
     \time 2/4
     c4 b8. a16 g4. f8 e4 d c2
   }
   \addlyrics { \verseOne }
 >>
}

For different or more complex orderings, the best way is to setup the hierarchy of staves and lyrics first, e.g.,

\new ChoirStaff <<
  \new Voice = "soprano" { music }
  \new Lyrics = "sopranoLyrics" { s1 }
  \new Lyrics = "tenorLyrics" { s1 }
  \new Voice = "tenor" { music }
>>

and then combine the appropriate melodies and lyric lines

\context Lyrics = sopranoLyrics \lyricsto "soprano"
the lyrics

The final input would resemble

<<\new ChoirStaff << setup the music >>
 \lyricsto "soprano" etc
 \lyricsto "alto" etc
etc
>>

See also

Internals Reference: LyricCombineMusic, Lyrics.


2.1.3 Aligning lyrics to a melody

Aligning of text with melodies can be made automatically, but if you specify the durations of the syllables it can also be made manually. Lyrics aligning and typesetting are prepared with the help of skips, hyphens and extender lines.

Lyrics are printed by interpreting them in the context called Lyrics.

\new Lyrics \lyricmode …

There are two main methods to specify the horizontal placement of the syllables:


Automatic syllable durations

The lyrics can be aligned under a given melody automatically. This is achieved by combining the melody and the lyrics with the \lyricsto expression

\new Lyrics \lyricsto name

This aligns the lyrics to the notes of the Voice context called name, which must already exist. Therefore normally the Voice is specified first, and then the lyrics are specified with \lyricsto. The command \lyricsto switches to \lyricmode mode automatically, so the \lyricmode keyword may be omitted.

The following example uses different commands for entering lyrics.

<<
  \new Voice = "one" \relative c'' {
    \autoBeamOff
    \time 2/4
    c4 b8. a16 g4. f8 e4 d c2
  }

% not recommended: left aligns syllables
  \new Lyrics \lyricmode { Joy4 to8. the16 world!4. the8 Lord4 is come.2 }

% wrong: durations needed
  \new Lyrics \lyricmode { Joy to the earth! the Sa -- viour reigns. }

%correct
  \new Lyrics \lyricsto "one" { No more let sins and sor -- rows grow. }
>>

[image of music]

The second stanza is not properly aligned because the durations were not specified. A solution for that would be to use \lyricsto.

The \addlyrics command is actually just a convenient way to write a more complicated LilyPond structure that sets up the lyrics.

{ MUSIC }
\addlyrics { LYRICS }

is the same as

\new Voice = "blah" { music }
\new Lyrics \lyricsto "blah" { LYRICS }

Manual syllable durations

Lyrics can also be entered without \addlyrics or \lyricsto. In this case, syllables are entered like notes – but with pitches replaced by text – and the duration of each syllable must be entered explicitly. For example:

play2 the4 game2.
sink2 or4 swim2.

The alignment to a melody can be specified with the associatedVoice property,

\set associatedVoice = #"lala"

The value of the property (here: "lala") should be the name of a Voice context. Without this setting, extender lines will not be formatted properly.

Here is an example demonstrating manual lyric durations,

<< \new Voice = "melody" {
    \time 3/4
    c2 e4 g2.
 }
 \new Lyrics \lyricmode {
   \set associatedVoice = #"melody"
   play2 the4 game2.
 } >>

[image of music]

See also

Internals Reference: Lyrics.


Multiple syllables to one note

In order to assign more than one syllable to a single note, you can surround them with quotes or use a _ character, to get spaces between syllables, or use tilde symbol (~) to get a lyric tie1.

\time 3/4
\relative c' { c2 e4 g2 e4 }
\addlyrics { gran- de_a- mi- go }
\addlyrics { pu- "ro y ho-" nes- to }
\addlyrics { pu- ro~y~ho- nes- to }

[image of music]

See also

Internals Reference: LyricCombineMusic.


Multiple notes to one syllable

Sometimes, particularly in Medieval music, several notes are to be sung on one single syllable; such vocalises are called melismas, or melismata.

You can define melismata entirely in the lyrics, by entering _ for every extra note that has to be added to the melisma.

Additionaly, you can make an extender line to be typeset to indicate the melisma in the score, writing a double underscore next to the first syllable of the melisma. This example shows the three elements that are used for this purpose (all of them surrounded by spaces): double hyphens to separate syllables in a word, underscores to add notes to a melisma, and a double underscore to put an extender line.

{ \set melismaBusyProperties = #'()
 c d( e) f f( e) e e  }
\addlyrics
 { Ky -- _ _ ri __ _ _ _  e }

[image of music]

In this case, you can also have ties and slurs in the melody if you set melismaBusyProperties, as is done in the example above.

However, the \lyricsto command can also detect melismata automatically: it only puts one syllable under a tied or slurred group of notes. If you want to force an unslurred group of notes to be a melisma, insert \melisma after the first note of the group, and \melismaEnd after the last one, e.g.,

<<
  \new Voice = "lala" {
    \time 3/4
    f4 g8
    \melisma
    f e f
    \melismaEnd
    e2
  }
  \new Lyrics \lyricsto "lala" {
    la di __ daah
  }
>>

[image of music]

In addition, notes are considered a melisma if they are manually beamed, and automatic beaming (see Setting automatic beam behavior) is switched off.

A complete example of a SATB score setup is in section Vocal ensembles.

Predefined commands

\melisma, \melismaEnd.

See also

Known issues and warnings

Melismata are not detected automatically, and extender lines must be inserted by hand.


Skipping notes

Making a lyric line run slower than the melody can be achieved by inserting \skips into the lyrics. For every \skip, the text will be delayed another note. The \skip command must be followed by a valid duration, but this is ignored when \skip is used in lyrics.

For example,

\relative c' { c c g' }
\addlyrics {
  twin -- \skip 4
  kle
}

[image of music]


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).

See also

Internals Reference: LyricExtender, LyricHyphen


Lyrics and repeats

TBC


2.1.4 Specific uses of lyrics

Often, different stanzas of one song are put to one melody in slightly differing ways. Such variations can still be captured with \lyricsto.


Divisi lyrics

You can display alternate (or divisi) lyrics by naming voice contexts and attaching lyrics to those specific contexts.

\score{ <<
  \new Voice = "melody" {
    \relative c' {
      c4
      <<
        { \voiceOne c8 e }
        \new Voice = "splitpart" { \voiceTwo c4 }
      >>
      \oneVoice c4 c | c
    }
  }
  \new Lyrics \lyricsto "melody" { we shall not o- ver- come }
  \new Lyrics \lyricsto "splitpart" { will }
>> }

[image of music]

You can use this trick to display different lyrics for a repeated section.

\score{ <<
  \new Voice = "melody" \relative c' {
    c2 e | g e | c1 |
    \new Voice = "verse" \repeat volta 2 {c4 d e f | g1 | }
    a2 b | c1}
  \new Lyrics = "mainlyrics" \lyricsto melody \lyricmode {
    do mi sol mi do
    la si do }
  \context Lyrics = "mainlyrics" \lyricsto verse \lyricmode {
   do re mi fa sol }
  \new Lyrics = "repeatlyrics" \lyricsto verse \lyricmode {
   dodo rere mimi fafa solsol }
>>
}

[image of music]


Lyrics independent of notes

In some complex vocal music, it may be desirable to place lyrics completely independently of notes. Music defined inside lyricrhythm disappears into the Devnull context, but the rhythms can still be used to place the lyrics.

voice = {
  c''2
  \tag #'music { c''2 }
  \tag #'lyricrhythm { c''4. c''8 }
  d''1
}

lyr = \lyricmode { I like my cat! }

<<
  \new Staff \keepWithTag #'music \voice
  \new Devnull="nowhere" \keepWithTag #'lyricrhythm \voice
  \new Lyrics \lyricsto "nowhere" \lyr
  \new Staff { c'8 c' c' c' c' c' c' c'
  c' c' c' c' c' c' c' c' }
>>

[image of music]

This method is recommended only if the music in the Devnull context does not contain melismata. Melismata are defined by the Voice context. Connecting lyrics to a Devnull context makes the voice/lyrics links to get lost, and so does the info on melismata. Therefore, if you link lyrics to a Devnull context, the implicit melismata get ignored.


Spacing out syllables

To increase the spacing between lyrics, set the minimum-distance property of LyricSpace.

{
  c c c c
  \override Lyrics.LyricSpace #'minimum-distance = #1.0
  c c c c
}
\addlyrics {
  longtext longtext longtext longtext
  longtext longtext longtext longtext
}

[image of music]

To make this change for all lyrics in the score, set the property in the layout.

\score {
  \relative c' {
  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
    }
  }
}

[image of music]

Selected Snippets

Checking to make sure that text scripts and lyrics are within the margins is a relatively large computational task. To speed up processing, LilyPond does not perform such calculations by default; to enable it, use

\override Score.PaperColumn #'keep-inside-line = ##t

To make lyrics avoid bar lines as well, use

\layout {
  \context {
    \Lyrics
      \consists "Bar_engraver"
      \consists "Separating_line_group_engraver"
      \override BarLine #'transparent = ##t
  }
}

Centering lyrics between staves

TBC


2.1.5 Stanzas


Adding stanza numbers

Stanza numbers can be added by setting stanza, e.g.,

\new Voice {
  \time 3/4 g2 e4 a2 f4 g2.
} \addlyrics {
  \set stanza = #"1. "
  Hi, my name is Bert.
} \addlyrics {
  \set stanza = #"2. "
  Oh, ché -- ri, je t'aime
}

[image of music]

These numbers are put just before the start of the first syllable.


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
>>

[image of music]


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 {
  \time 3/4 g2 e4 a2 f4 g2.
} \addlyrics {
  \set vocalName = #"Bert "
  Hi, my name is Bert.
} \addlyrics {
  \set vocalName = #"Ernie "
  Oh, ché -- ri, je t'aime
}

[image of music]


Stanzas with different rhythms

Ignoring melismata

One possibility is that the text has a melisma in one stanza, but multiple syllables in another one. One solution is to make the faster voice ignore the melisma. This is done by setting ignoreMelismata in the Lyrics context.

<<
  \relative c' \new Voice = "lahlah" {
    \set Staff.autoBeaming = ##f
    c4
    \slurDotted
    f8.[( g16])
    a4
  }
  \new Lyrics \lyricsto "lahlah" {
    more slow -- ly
  }
  \new Lyrics \lyricsto "lahlah" {
    go
    \set ignoreMelismata = ##t
    fas -- ter
    \unset ignoreMelismata
    still
  }
>>

[image of music]

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.

Switching to an alternative melody

More complex variations in text underlay are possible. It is possible to switch the melody for a line of lyrics during the text. This is done by setting the associatedVoice property. In the example

[image of music]

the text for the first stanza is set to a melody called ‘lahlah’,

\new Lyrics \lyricsto "lahlah" {
  Ju -- ras -- sic Park
}

The second stanza initially is set to the lahlah context, but for the syllable ‘ran’, it switches to a different melody. This is achieved with

\set associatedVoice = alternative

Here, alternative is the name of the Voice context containing the triplet.

This command must be one syllable too early, before ‘Ty’ in this case. In other words, changing the associatedVoice happens one step later than expected. This is for technical reasons, and it is not a bug.

\new Lyrics \lyricsto "lahlah" {
  \set associatedVoice = alternative % applies to "ran"
  Ty --
  ran --
  no --
  \set associatedVoice = lahlah % applies to "rus"
  sau -- rus Rex
}

The underlay is switched back to the starting situation by assigning lahlah to associatedVoice.


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 two different ways to force linebreaks when using \markup.

melody = \relative c' {
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{
  \line{ Verse 2. }
  \line{ All the children laughed and played }
  \line{ To see a lamb at school. }
  }
}
\markup{
  \wordwrap-string #"
  Verse 3.

  Mary took it home again,

  It was against the rule."
}

[image of music]


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' {
  c 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 {
    \hspace #0.1 % moves the column off the left margin;
        % can be removed if space on the page is tight
     \column {
      \line { \bold "2."
        \column {
          "This is verse two."
          "It has two lines."
        }
      }
      \hspace #0.1 % adds vertical spacing between verses
      \line { \bold "3."
        \column {
          "This is verse three."
          "It has two lines."
        }
      }
    }
    \hspace #0.1  % adds horizontal spacing between columns;
        % if they are still too close, add more " " pairs
        % until the result looks good
     \column {
      \line { \bold "4."
        \column {
          "This is verse four."
          "It has two lines."
        }
      }
      \hspace #0.1 % adds vertical spacing between verses
      \line { \bold "5."
        \column {
          "This is verse five."
          "It has two lines."
        }
      }
    }
  \hspace #0.1 % gives some extra space on the right margin;
      % can be removed if page space is tight
  }
}

[image of music]

See also

Internals Reference: LyricText, StanzaNumber.


2.2 Keyboard and other multi-staff instruments

[image of music]

This section discusses several aspects of music notation that are unique to keyboard instruments and other instruments notated on many staves, such as harps and vibraphones. For the purposes of this section this entire group of multi-staff instruments is called “keyboards” for short, even though some of them do not have a keyboard.


2.2.1 Common notation for keyboards

This section discusses notation issues that may arise for most keyboard instruments.


References for keyboards

Keyboard instruments are usually notated with Piano staves. These are two or more normal staves coupled with a brace. The same notation is also used for other keyed instruments. Organ music is normally written with two staves inside a PianoStaff group and third, normal staff for the pedals.

The staves in keyboard music are largely independent, but sometimes voices can cross between the two staves. This section discusses notation techniques particular to keyboard music.

Several common issues in keyboard music are covered elsewhere:

See also

Learning Manual: Real music example, Other uses for tweaks.

Notation Reference: Grouping staves, Instrument names, Collision resolution, Writing music in parallel, Fingering instructions, List of articulations, Grid lines, Ties, Arpeggio, Tremolo repeats.

Internals Reference: PianoStaff.

Snippets: Keyboards.

Known issues and warnings

Dynamics are not automatically centered, but workarounds do exist. One option is the ‘piano centered dynamics’ template under Piano templates; another option is to increase the staff-padding of dynamics as discussed in objects Moving objects.


Changing staff manually

Voices can be switched between staves manually, using the command

\change Staff = staffname

The string staffname is the name of the staff. It switches the current voice from its current staff to the staff called staffname. Typical values for staffname are "up" and "down", or "RH" and "LH".

Cross-staff notes are beamed automatically:

\new PianoStaff <<
  \new Staff = "up" {
    <e' c'>8
    \change Staff = "down"
    g8 fis g
    \change Staff = "up"
    <g'' c''>8
    \change Staff = "down"
    e8 dis e
    \change Staff = "up"
  }
  \new Staff = "down" {
    \clef bass
    % keep staff alive
    s1
  }
>>

[image of music]

If the beaming needs to be tweaked, make any changes to the stem directions first. The beam positions are then measured from the center of the staff that is closest to the beam. For a simple example of beam tweaking, see notation Fixing overlapping notation.

See also

Learning Manual: Fixing overlapping notation.

Notation Reference: Stems, Automatic beams.

Snippets: Keyboards.

Internals Reference: Beam, ContextChange.


Changing staff automatically

Voices can be made to switch automatically between the top and the bottom staff. The syntax for this is

\autochange …music

This will create two staves inside the current staff group (usually a PianoStaff), called "up" and "down". The lower staff will be in the bass clef by default. The autochanger switches on the basis of the pitch (middle C is the turning point), and it looks ahead skipping over rests to switch in advance.

\new PianoStaff {
  \autochange {
    g4 a b c'
    d'4 r a g
  }
}

[image of music]

A \relative section that is outside of \autochange has no effect on the pitches of the music, so if necessary, put \relative inside \autochange.

If additional control is needed over the individual staves, they can be created manually with the names "up" and "down". The \autochange command will then switch its voice between the existing staves.

Note: If staves are created manually, they must be named "up" and "down".

For example, staves must be created manually in order to place a key signature in the lower staff:

\new PianoStaff <<
  \new Staff = "up" {
    \new Voice = "melOne" {
      \key g \major
      \autochange \relative c' {
        g8 b a c b d c e
        d8 r fis, g a2
      }
    }
  }
  \new Staff = "down" {
    \key g \major
    \clef bass
  }
>>

[image of music]

See also

Notation Reference: Changing staff manually.

Snippets: Keyboards.

Internals Reference: AutoChangeMusic.

Known issues and warnings

The staff switches may not end up in optimal places. For high quality output, staff switches should be specified manually.

Chords will not be split across the staves; they will be assigned to a staff based on the first note named in the chord construct.


Staff-change lines

Whenever a voice switches to another staff, a line connecting the notes can be printed automatically:

\new PianoStaff <<
  \new Staff = "one" {
    \showStaffSwitch
    c1
    \change Staff = "two"
    b2 a
  }
  \new Staff = "two" {
    \clef bass
    s1*2
  }
>>

[image of music]

Predefined commands

\showStaffSwitch, \hideStaffSwitch.

See also

Snippets: Keyboards.

Internals Reference: Note_head_line_engraver, VoiceFollower.


Cross-staff stems

Chords that cross staves may be produced:

\new PianoStaff <<
  \new Staff {
    \relative c' {
      f8 e4 d8 d f e4
    }
  }
  \new Staff {
    \relative c' {
      << {
        \clef bass
        % stems may overlap the other staff
        \override Stem #'cross-staff = ##t
        % extend the stems to reach other other staff
        \override Stem #'length = #12
        % do not print extra flags
        \override Stem #'flag-style = #'no-flag
        % prevent beaming as needed
        a8 g4 f8 f bes\noBeam g4
      }
      \\
      {
        f,2 bes4 c
      } >>
    }
  }
>>

[image of music]

Selected Snippets

Indicating cross-staff chords with arpeggio bracket

An arpeggio bracket can indicate that notes on two different staves are to be played with the same hand. In order to do this, the PianoStaff must be set to accept cross-staff arpeggios and the arpeggios must be set to the bracket shape in the PianoStaff context.

(Debussy, Les collines d’Anacapri, m. 65)

\paper { ragged-right = ##t }

\new PianoStaff <<
  \set PianoStaff.connectArpeggios = ##t
  \override PianoStaff.Arpeggio #'stencil = #ly:arpeggio::brew-chord-bracket
  \new Staff {
    \relative c' {
      \key b \major
      \time 6/8
      b8-.(\arpeggio fis'-.\> cis-. e-. gis-. b-.)\!\fermata^\laissezVibrer
      \bar "||"
    }
  }
  \new Staff {
    \relative c' {
      \clef bass
      \key b \major
      <<
        {
          <a e cis>2.\arpeggio
        }
        \\
        {
          <a, e a,>2.
        }
      >>
    }
  }
>>

[image of music]

See also

Snippets: Keyboards.

Internals Reference: Stem.


2.2.2 Piano

This section discusses notation issues that relate most directly to the piano.


Piano pedals

Pianos generally have three pedals that alter the way sound is produced: sustain, sostenuto (sos.), and una corda (U.C.). Sustain pedals are also found on vibraphones and celestas.

c4\sustainOn d e g
<c, f a>1\sustainOff
c4\sostenutoOn e g c,
<bes d f>1\sostenutoOff
c4\unaCorda d e g
<d fis a>1\treCorde

[image of music]

There are three styles of pedal indications: text, bracket, and mixed. The sustain pedal and the una corda pedal use the text style by default while the sostenuto pedal uses mixed by default.

c4\sustainOn g c2\sustainOff
\set Staff.pedalSustainStyle = #'mixed
c4\sustainOn g c d
d\sustainOff\sustainOn g, c2\sustainOff
\set Staff.pedalSustainStyle = #'bracket
c4\sustainOn g c d
d\sustainOff\sustainOn g, c2
\bar "|."

[image of music]

The placement of the pedal commands matches the physical movement of the sustain pedal during piano performance. Pedalling to the final bar line is indicated by omitting the final pedal up command.

See also

Notation Reference: Ties.

Snippets: Keyboards.

Internals Reference: SustainPedal, SustainPedalLineSpanner, SustainEvent, SostenutoPedal, SostenutoPedalLineSpanner, SostenutoEvent, UnaCordaPedal, UnaCordaPedalLineSpanner, UnaCordaEvent, PianoPedalBracket, Piano_pedal_engraver.


2.2.3 Accordion

This section discusses notation that is unique to the accordion.


Discant symbols

Accordions are often built with more than one set of reeds that may be in unison with, an octave above, or an octave below the written pitch. Each accordion maker has different names for the shifts that select the various reed combinations, such as oboe, musette, or bandonium, so a system of symbols has come into use to simplify the performance instructions.

Selected Snippets

Accordion-discant symbols

Accordion discant-specific symbols are added using \markup. The vertical placement of the symbols can be tweaked by changing the \raise arguments.

discant = \markup {
  \musicglyph #"accordion.accDiscant"
}
dot = \markup {
  \musicglyph #"accordion.accDot"
}

\layout { ragged-right = ##t }

% 16 voets register
accBasson = ^\markup {
  \combine
  \discant
  \raise #0.5 \dot
}

% een korig 8 en 16 voets register
accBandon = ^\markup {
  \combine
    \discant
    \combine
      \raise #0.5 \dot
      \raise #1.5 \dot
}

accVCello = ^\markup {
  \combine
    \discant
    \combine
      \raise #0.5 \dot
      \combine
        \raise #1.5 \dot
        \translate #'(1 . 0) \raise #1.5 \dot
}

% 4-8-16 voets register
accHarmon = ^\markup {
  \combine
    \discant
    \combine
      \raise #0.5 \dot
      \combine
        \raise #1.5 \dot
        \raise #2.5 \dot
}

accTrombon = ^\markup {
  \combine
    \discant
    \combine
      \raise #0.5 \dot
      \combine
        \raise #1.5 \dot
        \combine
          \translate #'(1 . 0) \raise #1.5 \dot
          \translate #'(-1 . 0) \raise #1.5 \dot
}

% eenkorig 4 en 16 voets register
accOrgan = ^\markup {
  \combine
    \discant
    \combine
      \raise #0.5 \dot
      \raise #2.5 \dot
}

accMaster = ^\markup {
  \combine
    \discant
    \combine
      \raise #0.5 \dot
      \combine
        \raise #1.5 \dot
        \combine
          \translate #'(1 . 0) \raise #1.5 \dot
          \combine
            \translate #'(-1 . 0) \raise #1.5 \dot
            \raise #2.5 \dot
}

accAccord = ^\markup {
  \combine
    \discant
    \combine
      \raise #1.5 \dot
      \combine
        \translate #'(1 . 0) \raise #1.5 \dot
        \combine
          \translate #'(-1 . 0) \raise #1.5 \dot
          \raise #2.5 \dot
}

accMusette = ^\markup {
  \combine
    \discant
    \combine
      \raise #1.5 \dot
      \combine
        \translate #'(1 . 0) \raise #1.5 \dot
        \translate #'(-1 . 0) \raise #1.5 \dot
}

accCeleste = ^\markup {
  \combine
    \discant
    \combine
      \raise #1.5 \dot
      \translate #'(-1 . 0) \raise #1.5 \dot
}

accOboe = ^\markup {
  \combine
    \discant
    \combine
      \raise #1.5 \dot
      \raise #2.5 \dot
}

accClarin = ^\markup {
  \combine
    \discant
    \raise #1.5 \dot
}

accPiccolo = ^\markup {
    \combine
       \discant 
       \raise #2.5 \dot
}

accViolin = ^\markup {
  \combine
    \discant
    \combine
      \raise #1.5 \dot
      \combine
        \translate #'(1 . 0) \raise #1.5 \dot
        \raise #2.5 \dot
}

\relative c'' {
  c4 d\accBasson e f
  c4 d\accBandon e f
  c4 d\accVCello e f
  c4 d\accHarmon e f
  c4 d\accTrombon e f
  \break
  c4 d\accOrgan e f
  c4 d\accMaster e f
  c4 d\accAccord e f
  c4 d\accMusette e f
  c4 d\accCeleste e f
  \break
  c4 d\accOboe e f
  c4 d\accClarin e f
  c4 d\accPiccolo e f
  c4 d\accViolin e f
}

[image of music]

See also

Snippets: Keyboards.


2.2.4 Harp

This section discusses notation issues that are unique to the harp.


References for harps

Some common characteristics of harp music are covered elsewhere:

See also

Notation Reference: Tremolo repeats Glissando Arpeggio Harmonics


Harp pedals

Harps have seven strings per octave that may be sounded at the natural, flattened, or sharpened pitch. In lever harps, each string is adjusted individually, but in pedal harps every string with the same pitch name is controlled by a single pedal. From the player’s left to right, the pedals are D, C, and B on the left and E, F, G, and A on the right. The position of the pedals may be indicated with text marks:

\textLengthOn
cis1_\markup \concat \vcenter { [D \flat C \sharp B|E \sharp F \sharp G A \flat] }
c!1_\markup \concat \vcenter {[ C \natural ]}

[image of music]

or pedal diagrams:

\textLengthOn
cis1_\markup { \harp-pedal #"^v-|vv-^" }
c!1_\markup { \harp-pedal #"^o--|vv-^" }

[image of music]

The \harp-pedal command accepts a string of characters, where ^ is the highest pedal position (flattened pitch), - is the middle pedal postion (natural pitch), v is the lowest pedal position (sharpened pitch), and | is the divider. A prefixed o will circle the following pedal symbol.

See also

Notation Reference: Text scripts Instrument Specific Markup


2.3 Unfretted string instruments

[image of music]

This section provides information and references which are helpful when writing for unfretted string instruments, principally orchestral strings.


2.3.1 Common notation for unfretted strings

There is little specialist notation for unfretted string instruments. The music is notated on a single staff, and usually only a single voice is required. Two voices might be required for some double-stopped or divisi passages.


References for unfretted strings

Most of the notation which is useful for orchestral strings and other bowed instruments is covered elsewhere:

See also

Learning Manual: String quartet.

Notation Reference: Text scripts, Fingering instructions, Chorded notes, Arpeggio.

Snippets: Unfretted strings.


Bowing indications

Bowing indications are created as articulations, which are described in Articulations and ornamentations.

The bowing commands, \upbow and \downbow, are used with slurs as follows:

c4(\downbow d) e(\upbow f)

[image of music]

and the following example shows three ways in which an open A string on a violin might be indicated:

a4 \open
a^\markup { \teeny "II" }
a2^\markup { \small "sul A" }

[image of music]

Predefined commands

\downbow, \upbow, \open.

See also

Notation Reference: Articulations and ornamentations, Slurs.


Harmonics

Natural harmonics

Natural harmonics can be notated in several ways. A diamond-shaped note head generally means to touch the string where you would stop the note if it were not a diamond.

Note: Harmonics must be defined inside a chord construct even if there is only a single note.

Dotted harmonics indicated with \harmonic do not show the dots. The context property harmonicDots should be set if dots are required.

<d\harmonic>4 <e\harmonic>2.
\set harmonicDots = ##t
<d\harmonic>4 <e\harmonic>2.

[image of music]

Alternatively a normal note head is shown at the pitch to be sounded together with a small circle to indicate it should be played as a harmonic:

d2^\flageolet d_\flageolet

[image of music]

A smaller circle may be created, see the snippet list in References for unfretted strings.

Artificial harmonics

Artificial harmonics are notated with two notes, one with a normal note head indicating the stopped position and one with an open diamond note head to indicate the harmonic position.

<e a\harmonic>2  <c g'\harmonic>

[image of music]

See also

Music Glossary: harmonics.

Notation Reference: Special note heads, References for unfretted strings.


Snap (Bartók) pizzicato

Selected Snippets

Snap-pizzicato markup ("Bartok pizzicato")

A snap-pizzicato (also known as "Bartok pizzicato") is a "strong pizzicato where the string is plucked vertically by snapping and rebounds off the fingerboard of the instrument" (Wikipedia). It is denoted by a cicle with a vertical line going from the center upwards outside the circle. While Lilypond does not have a pre-defined command to created this markup, it is easy to create a definition and place it directly into the lilypond file.

#(define-markup-command (snappizz layout props) ()
  (interpret-markup layout props
    (markup #:stencil
      (ly:stencil-translate-axis
        (ly:stencil-add
          (make-circle-stencil 0.7 0.1 #f)
          (ly:make-stencil
            (list 'draw-line 0.1 0 0.1 0 1)
            '(-0.1 . 0.1) '(0.1 . 1)))
        0.7 X))))

snapPizzicato = \markup \snappizz

% now it can be used as \snappizzicato after the note/chord
% Note that a direction (-, ^ or _) is required.
\relative c' {
  c4^\snapPizzicato
  % This does NOT work:
  %<c e g>\snapPizzicato
  <c' e g>-\snapPizzicato
  <c' e g>^\snapPizzicato
  <c, e g>_\snapPizzicato
}

[image of music]


2.4 Fretted string instruments

[image of music]

This section discusses several aspects of music notation that are unique to fretted string instruments.


2.4.1 Common notation for fretted strings

This section discusses common notation that is unique to fretted string instruments.


References for fretted strings

Music for fretted string instruments is normally notated on a single staff, either in traditional music notation or in tablature. Sometimes the two types are combined, and it is especially common in popular music to use chord diagrams above a staff of traditional notation. The guitar and the banjo are transposing instruments, sounding an octave lower than written. Scores for these instruments should use the "treble_8" clef. Some other elements pertinent to fretted string instruments are covered elsewhere:

See also

Notation Reference: Fingering instructions, Ties, Collision resolution, Instrument names, Writing music in parallel, Arpeggio, List of articulations, Clef.


String number indications

The string on which a note should be played may be indicated by appending \number to a note inside a chord construct <>.

Note: String numbers must be defined inside a chord construct even if there is only a single note.

\clef "treble_8"
<c\5>4 <e\4> <g\3>2
<c,\5 e\4 g\3>1

[image of music]

When fingerings and string indications are used together, their placement is controlled by the order in which the two items appear in the code:

\clef "treble_8"
<g\3-0>2
<g-0\3>

[image of music]

Selected Snippets

Controlling the placement of chord fingerings

The placement of fingering numbers can be controlled precisely.

\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
}

[image of music]

Allowing fingerings to be printed inside the staff

By default, vertically oriented fingerings are positioned outside the staff. However, this behavior can be canceled.

\relative c' {
  <c-1 e-2 g-3 b-5>2
  \once \override Fingering #'staff-padding = #'()
  <c-1 e-2 g-3 b-5>2
}

[image of music]

See also

Notation Reference: Fingering instructions.

Snippets: Fretted strings.

Internals Reference: StringNumber, Fingering.


Default tablatures

Tablature notation is used for notating music for plucked string instruments. Pitches are not denoted with note heads, but by numbers indicating on which string and fret a note must be played. LilyPond offers limited support for tablature.

The string number associated with a note is given as a backslash followed by a number. By default, string 1 is the highest, and the tuning defaults to the standard guitar tuning (with 6 strings). The notes are printed as tablature, by using TabStaff and TabVoice contexts

\new TabStaff {
  a,4\5 c'\2 a\3 e'\1
  e\4 c'\2 a\3 e'\1
}

[image of music]

When no string is specified for a note, the note is assigned to the highest string that can generate the note with a fret number greater than or equal to the value of minimumFret. The default value for minimumFret is 0.

\new StaffGroup <<
   \new Staff \relative c {
     \clef "treble_8"
     c16 d e f g4
     c,16 d e f g4
   }
   \new TabStaff \relative c {
     c16 d e f g4
     \set TabStaff.minimumFret = #5
     c,16 d e f g4
   }
>>

[image of music]

Harmonic indications and slides can be added to tablature notation.

\new TabStaff {
  \new TabVoice {
    <c g'\harmonic> d\2\glissando e\2
  }
}

[image of music]

Selected Snippets

Stem and beam behavior in tablature

The direction of stems is controlled the same way in tablature as in traditional notation. Beams can be made horizontal, as shown in this example.

\new TabStaff {
  \relative c {
    g16 b d g b d g b
    \stemDown
    \override Beam #'damping = #+inf.0
    g,,16 b d g b d g b
  }
}

[image of music]

Polyphony in tablature

Polyphony is created the same way in a TabStaff as in a regular staff.

upper = \relative c' {
  \time 12/8
  \key e \minor
  \voiceOne
  r4. r8 e, fis g16 b g e e' b c b a g fis e
}

lower = \relative c {
  \key e \minor
  \voiceTwo
  r16 e d c b a g4 fis8 e fis g a b c
}

\score {
  <<
    \new StaffGroup = "tab with traditional" <<
      \new Staff = "guitar traditional" <<
        \clef "treble_8"
        \context Voice = "upper" \upper
        \context Voice = "lower" \lower
      >>
      \new TabStaff = "guitar tab" <<
        \context TabVoice = "upper" \upper
        \context TabVoice = "lower" \lower
      >>
    >>
  >>
}

[image of music]

See also

Notation Reference: Stems.

Snippets: Fretted strings.

Internals Reference: TabNoteHead, TabStaff, TabVoice, Beam.

Known issues and warnings

Chords are not handled in a special way, and hence the automatic string selector may easily select the same string for two notes in a chord.

In order to handle \partcombine, a TabStaff must use specially-created voices:

melodia = \partcombine { e4 g g g }{ e4 e e e }
<<
  \new TabStaff <<
    \new TabVoice = "one" s1
    \new TabVoice = "two" s1
    \new TabVoice = "shared" s1
    \new TabVoice = "solo" s1
    { \melodia }
  >>
>>

[image of music]

Guitar special effects are limited to harmonics and slides.


Custom tablatures

LilyPond tabulature automatically calculates the fret for a note based on the string to which the note is assigned. In order to do this, the tuning of the strings must be specified. The tuning of the strings is given in the StringTunings property.

LilyPond comes with predefined string tunings for banjo, mandolin, guitar and bass guitar. Lilypond automatically sets the correct transposition for predefined tunings. The following example is for bass guitar, which sounds an octave lower than written.

<<
  \new Staff {
    \clef "bass_8"
    \relative c, {
      c4 d e f
    }
  }
  \new TabStaff {
    \set TabStaff.stringTunings = #bass-tuning
    \relative c, {
      c4 d e f
    }
  }
>>

[image of music]

The default string tuning is guitar-tuning, which is the standard EADGBE tuning. Some other predefined tunings are guitar-open-g-tuning, mandolin-tuning and banjo-open-g-tuning. The predefined string tunings are found in scm/output-lib.scm.

A string tuning is a Scheme list of string pitches, one for each string, ordered by string number from 1 to N, where string 1 is at the top of the tablature staff and string N is at the bottom. This ordinarily results in ordering from highest pitch to lowest pitch, but some instruments (e.g. ukulele) do not have strings ordered by pitch.

A string pitch in a string tuning list is the pitch difference of the open string from middle C measured in semitones. The string pitch must be an integer. Lilypond calculates the actual pitch of the string by adding the string tuning pitch to the actual pitch for middle C.

LilyPond automatically calculates the number of strings in the TabStaff as the number of elements in stringTunings.

Any desired string tuning can be created. For example, we can define a string tuning for a four-string instrument with pitches of a'', d'', g', and c':

mynotes = {
    c'4 e' g' c'' |
    e'' g'' b'' c'''
}

<<
  \new Staff {
    \clef treble
    \mynotes
  }
  \new TabStaff {
    \set TabStaff.stringTunings = #'(21 14 7 0)
    \mynotes
  }
>>

[image of music]

See also

Installed Files: ‘scm/output-lib.scm’.

Snippets: Fretted strings.

Internals Reference: Tab_note_heads_engraver.


Fret diagram markups

Fret diagrams can be added to music as a markup to the desired note. The markup contains information about the desired fret diagram. There are three different fret-diagram markup interfaces: standard, terse, and verbose. The three interfaces produce equivalent markups, but have varying amounts of information in the markup string. Details about the markup interfaces are found at Text markup commands.

The standard fret diagram markup string indicates the string number and the fret number for each dot to be placed on the string. In addition, open and unplayed (muted) strings can be indicated.

<<
  \context ChordNames {
     \chordmode {
       c1 d:m
     }
  }
  \context Staff {
    \clef "treble_8"
    < c e g c' e' > 1 ^\markup
      \fret-diagram #"6-x;5-3;4-2;3-o;2-1;1-o;"
    < d a d' f'> ^\markup
      \fret-diagram #"6-x;5-x;4-o;3-2;2-3;1-1;"
  }
>>

[image of music]

Barre indications can be added to the diagram from the fret-diagram markup string.

<<
  \context ChordNames {
     \chordmode {
       f1 g
     }
  }
  \context Staff {
    \clef "treble_8"
    < f, c f a c' f'>1 ^\markup
      \fret-diagram #"c:6-1-1;6-1;5-3;4-3;3-2;2-1;1-1;"
    < g, d g b d' g'> ^\markup
      \fret-diagram #"c:6-1-3;6-3;5-5;4-5;3-4;2-3;1-3;"
  }
>>

[image of music]

The size of the fret diagram, and the number of frets in the diagram can be changed in the fret-diagram markup string.

<<
  \context ChordNames {
     \chordmode {
       f1 g
     }
  }
  \context Staff {
    \clef "treble_8"
    < f, c f a c' f'>1 ^\markup
      \fret-diagram #"s:1.5;c:6-1-1;6-1;5-3;4-3;3-2;2-1;1-1;"
    < g, b, d g b g'> ^\markup
      \fret-diagram #"h:6;6-3;5-2;4-o;3-o;2-o;1-3;"
  }
>>

[image of music]

The number of strings in a fret diagram can be changed to accomodate different instruments such as banjos and ukeleles with the fret-diagram markup string.

<<
  \context ChordNames {
     \chordmode {
       a1
     }
  }
  \context Staff {
        %% A chord for ukelele
    a'1 ^\markup \fret-diagram #"w:4;4-2-2;3-1-1;2-o;1-o;"
  }
>>

[image of music]

Fingering indications can be added, and the location of fingering labels can be controlled by the fret-diagram markup string.

<<
  \context ChordNames {
     \chordmode {
       c1 d:m
     }
  }
  \context Staff {
    \clef "treble_8"
    < c e g c' e' > 1 ^\markup
      \fret-diagram #"f:1;6-x;5-3-3;4-2-2;3-o;2-1-1;1-o;"
    < d a d' f'> ^\markup
      \fret-diagram #"f:2;6-x;5-x;4-o;3-2-2;2-3-3;1-1-1;"
  }
>>

[image of music]

Dot radius and dot position can be controlled with the fret-diagram markup string.

<<
  \context ChordNames {
     \chordmode {
       c1 d:m
     }
  }
  \context Staff {
    \clef "treble_8"
    < c e g c' e' > 1 ^\markup
      \fret-diagram #"d:0.35;6-x;5-3;4-2;3-o;2-1;1-o;"
    < d a d' f'> ^\markup
      \fret-diagram #"p:0.2;6-x;5-x;4-o;3-2;2-3;1-1;"
  }
>>

[image of music]

The fret-diagram-terse markup string omits string numbers; the string number is implied by the presence of semicolons. There is one semicolon for each string in the diagram. The first semicolon corresponds to the highest string number and the last semicolon corresponds to the first string. Mute strings, open strings, and fret numbers can be indicated.

<<
  \context ChordNames {
     \chordmode {
       c1 d:m
     }
  }
  \context Staff {
    \clef "treble_8"
    < c e g c' e' > 1 ^\markup
      \fret-diagram-terse #"x;3;2;o;1;o;"
    < d a d' f'> ^\markup
      \fret-diagram-terse #"x;x;o;2;3;1;"
  }
>>

[image of music]

Barre indicators can be included in the fret-diagram-terse markup string.

<<
  \context ChordNames {
     \chordmode {
       f1 g
     }
  }
  \context Staff {
    \clef "treble_8"
    < f, c f a c' f'>1 ^\markup
      \fret-diagram-terse #"1-(;3;3;2;1;1-);"
    < g, d g b d' g'> ^\markup
      \fret-diagram-terse #"3-(;5;5;4;3;3-);"
  }
>>

[image of music]

Fingering indications can be included in the fret-diagram-terse markup string.

<<
  \context ChordNames {
     \chordmode {
       c1 d:m
     }
  }
  \context Staff {
    \override Voice.TextScript
      #'(fret-diagram-details finger-code) = #'below-string
    \clef "treble_8"
    < c e g c' e' > 1 ^\markup
      \fret-diagram-terse #"x;3-3;2-2;o;1-1;o;"
    < d a d' f'> ^\markup
      \fret-diagram-terse #"x;x;o;2-2;3-3;1-1;"
  }
>>

[image of music]

Other fret diagram properties must be adjusted using \override when using the fret-diagram-terse markup.

The fret-diagram-verbose markup string is in the format of a Scheme list. Each element of the list indicates an item to be placed on the fret diagram.

<<  \context ChordNames {
     \chordmode {
       c1 d:m
     }
  }
  \context Staff {
    \clef "treble_8"
    < c e g c' e' > 1 ^\markup
      \fret-diagram-verbose #'(
        (mute 6)
        (place-fret 5 3)
        (place-fret 4 2)
        (open 3)
        (place-fret 2 1)
        (open 1)
      )
    < d a d' f'> ^\markup
      \fret-diagram-verbose #'(
        (mute 6)
        (mute 5)
        (open 4)
        (place-fret 3 2)
        (place-fret 2 3)
        (place-fret 1 1)
      )
  }
>>

[image of music]

Fingering indications and barres can be included in a fret-diagram-verbose markup string. Unique to the fret-diagram-verbose interface is a capo indication that can be placed on the fret diagram. The capo indication is a thick bar that covers all strings. The fret with the capo will be the lowest fret in the fret diagram.

<<
  \context ChordNames {
     \chordmode {
       f1 g c
     }
  }
  \context Staff {
    \clef "treble_8"
    \override Voice.TextScript
      #'(fret-diagram-details finger-code) = #'below-string

    < f, c f a c' f'>1 ^\markup
      \fret-diagram-verbose #'(
        (place-fret 6 1)
        (place-fret 5 3)
        (place-fret 4 3)
        (place-fret 3 2)
        (place-fret 2 1)
        (place-fret 1 1)
        (barre 6 1 1)
      )
    < g, b, d g b g'> ^\markup
      \fret-diagram-verbose #'(
        (place-fret 6 3 2)
        (place-fret 5 2 1)
        (open 4)
        (open 3)
        (open 2)
        (place-fret 1 3 3)
      )
    < c e g c' e'> ^\markup
      \fret-diagram-verbose #'(
        (capo 3)
        (mute 6)
        (place-fret 4 5 1)
        (place-fret 3 5 2)
        (place-fret 2 5 3)
      )
   }
>>

[image of music]

All other fret diagram properties must be adjusted using \override when using the fret-diagram-verbose markup.

The graphical layout of a fret diagram can be customized according to user preference through the properties of the fret-diagram-interface. Details are found at fret-diagram-interface. For a fret diagram markup, the interface properties belong to Voice.TextScript.

Selected Snippets

Customizing markup fret diagrams Fret diagram properties can be set through 'fret-diagram-details. For markup fret diagrams, overrides can be applied to the Voice.TextScript object or directly to the markup.

<<
  \chords { c1 c c d }
  
  \new Voice = "mel" {
    \textLengthOn
    % Set global properties of fret diagram
    \override TextScript #'size = #'1.2
    \override TextScript
      #'(fret-diagram-details finger-code) = #'in-dot
    \override TextScript
      #'(fret-diagram-details dot-color) = #'white

    %% C major for guitar, no barre, using defaults
       % terse style
    c'1^\markup { \fret-diagram-terse #"x;3-3;2-2;o;1-1;o;" }

    %% C major for guitar, barred on third fret
       % verbose style
       % size 1.0
       % roman fret label, finger labels below string, straight barre
    c'1^\markup {
      % standard size
      \override #'(size . 1.0) {
        \override #'(fret-diagram-details . (
                     (number-type . roman-lower)
                     (finger-code . in-dot)
                     (barre-type . straight))) {
          \fret-diagram-verbose #'((mute 6)
                                   (place-fret 5 3 1)
                                   (place-fret 4 5 2)
                                   (place-fret 3 5 3)
                                   (place-fret 2 5 4)
                                   (place-fret 1 3 1)
                                   (barre 5 1 3))
        }
      }
    }

    %% C major for guitar, barred on third fret
       % verbose style
       % landscape orientation, arabic numbers, M for mute string
       % no barre, fret label down or left, small mute label font
    c'1^\markup {
      \override #'(fret-diagram-details . (
                   (finger-code . below-string)
                   (number-type . arabic)
                   (label-dir . -1)
                   (mute-string . "M")
                   (orientation . landscape)
                   (barre-type . none)
                   (xo-font-magnification . 0.4)
                   (xo-padding . 0.3))) {
        \fret-diagram-verbose #'((mute 6)
                                 (place-fret 5 3 1)
                                 (place-fret 4 5 2)
                                 (place-fret 3 5 3)
                                 (place-fret 2 5 4)
                                 (place-fret 1 3 1)
                                 (barre 5 1 3))
      }
    }

    %% simple D chord
       % terse style
       % larger dots, centered dots, fewer frets
       % label below string
    d'1^\markup {
      \override #'(fret-diagram-details . (
                   (finger-code . below-string)
                   (dot-radius . 0.35)
                   (dot-position . 0.5)
                   (fret-count . 3))) {
        \fret-diagram-terse #"x;x;o;2-1;3-2;2-3;"
      }
    }
  }
>>

[image of music]

See also

Notation Reference: Text markup commands.

Snippets: Fretted strings.

Internals Reference: fret-diagram-interface.


Predefined fret diagrams

Fret diagrams can be displayed using the FretBoards context. By default, the FretBoards context will display fret diagrams that are stored in a lookup table:

\include "predefined-guitar-fretboards.ly"
\context FretBoards {
  \chordmode {
    c1 d
  }
}

[image of music]

The default predefined fret diagrams are contained in the file predefined-guitar-fretboards.ly. Fret diagrams are stored based on the pitches of a chord and the value of stringTunings that is currently in use. predefined-guitar-fretboards.ly contains predefined fret diagrams only for guitar-tuning. Predefined fret diagrams can be added for other instruments or other tunings by following the examples found in predefined-guitar-fretboards.ly.

Chord pitches can be entered either as simultaneous music or using chord mode (see Chord mode overview).

\include "predefined-guitar-fretboards.ly"
\context FretBoards {
  \chordmode {c1}
  <c' e' g'>1
}

[image of music]

It is common that both chord names and fret diagrams are displayed together. This is achieved by putting a ChordNames context in parallel with a FretBoards context and giving both contexts the same music.

\include "predefined-guitar-fretboards.ly"
mychords = \chordmode{
  c1 f g
}

<<
  \context ChordNames {
    \mychords
  }
  \context FretBoards {
    \mychords
  }
>>

[image of music]

Predefined fret diagrams are transposable, as long as a diagram for the transposed chord is stored in the fret diagram table.

\include "predefined-guitar-fretboards.ly"
mychords = \chordmode{
  c1 f g
}

mychordlist = {
  \mychords
  \transpose c e { \mychords}
}
<<
  \context ChordNames {
    \mychordlist
  }
  \context FretBoards {
    \mychordlist
  }
>>

[image of music]

The predefined fret diagram table contains seven chords (major, minor, augmented, diminished, dominant seventh, major seventh, minor seventh) for each of 17 keys. A complete list of the predefined fret diagrams is shown in Predefined fretboard diagrams. If there is no entry in the table for a chord, the FretBoards engraver will calculate a fret-diagram using the automatic fret diagram functionality described in Automatic fret diagrams.

\include "predefined-guitar-fretboards.ly"
mychords = \chordmode{
  c1 c:9
}

<<
  \context ChordNames {
    \mychords
  }
  \context FretBoards {
    \mychords
  }
>>

[image of music]

Fret diagrams can be added to the fret diagram table. To add a diagram, you must specify the chord for the diagram, the tuning to be used, and a definition for the diagram. The diagram definition can be either a fret-diagram-terse definition string or a fret-diagram-verbose marking list.

\include "predefined-guitar-fretboards.ly"

\storePredefinedDiagram \chordmode {c:9}
                        #guitar-tuning
                        #"x;3-2;2-1;3-3;3-4;x;"

mychords = \chordmode{
  c1 c:9
}

<<
  \context ChordNames {
    \mychords
  }
  \context FretBoards {
    \mychords
  }
>>

[image of music]

Different fret diagrams for the same chord name can be stored using different octaves of pitches.

\include "predefined-guitar-fretboards.ly"

\storePredefinedDiagram \chordmode {c'}
                        #guitar-tuning
                        #(offset-fret 2 (chord-shape 'bes guitar-tuning))

mychords = \chordmode{
  c1 c'
}

<<
  \context ChordNames {
    \mychords
  }
  \context FretBoards {
    \mychords
  }
>>

[image of music]

In addition to fret diagrams, LilyPond stores an internal list of chord shapes. The chord shapes are fret diagrams that can be shifted along the neck to different posistions to provide different chords. Chord shapes can be added to the internal list and then used to define predefined fret diagrams. Because they can be moved to various positions on the neck, chord shapes will normally not contain any open strings. Like fret diagrams, chord shapes can be entered as either fret-diagram-terse strings or fret-diagram-verbose marking lists.

\include "predefined-guitar-fretboards.ly"

% add a new chord shape

\addChordShape #'powerf #guitar-tuning #"1-1;3-3;3-4;x;x;x;"

% add some new chords based on the power chord shape

\storePredefinedDiagram \chordmode {f'}
                        #guitar-tuning
                        #(chord-shape 'powerf guitar-tuning) 
\storePredefinedDiagram \chordmode {g'}
                        #guitar-tuning
                        #(offset-fret 2 (chord-shape 'powerf guitar-tuning))

mychords = \chordmode{
  f1 f' g g'
}

<<
  \context ChordNames {
    \mychords
  }
  \context FretBoards {
    \mychords
  }
>>

[image of music]

The graphical layout of a fret diagram can be customized according to user preference through the properties of the fret-diagram-interface. Details are found at fret-diagram-interface. For a predefined fret diagram, the interface properties belong to FretBoards.FretBoard.

Selected Snippets

Customizing fretboard fret diagrams Fret diagram properties can be set through 'fret-diagram-details. For FretBoard fret diagrams, overrides are applied to the FretBoards.FretBoard object. Like Voice, FretBoards is a bottom level context, therefore can be omitted in property overrides.

\include "predefined-guitar-fretboards.ly"
\storePredefinedDiagram \chordmode { c' }
                        #guitar-tuning
                        #"x;1-1-(;3-2;3-3;3-4;1-1-);"
<<
  \new ChordNames {
    \chordmode { c1 c c d }
  }
  \new FretBoards {
    % Set global properties of fret diagram
    \override FretBoards.FretBoard #'size = #'1.2
    \override FretBoard
      #'(fret-diagram-details finger-code) = #'in-dot
    \override FretBoard
      #'(fret-diagram-details dot-color) = #'white
    \chordmode {
      c
      \once \override FretBoard #'size = #'1.0
      \once \override FretBoard
        #'(fret-diagram-details barre-type) = #'straight
      \once \override FretBoard
        #'(fret-diagram-details dot-color) = #'black
      \once \override FretBoard
        #'(fret-diagram-details finger-code) = #'below-string
      c'
      \once \override FretBoard
        #'(fret-diagram-details barre-type) = #'none
      \once \override FretBoard
        #'(fret-diagram-details number-type) = #'arabic
      \once \override FretBoard
        #'(fret-diagram-details orientation) = #'landscape
      \once \override FretBoard
        #'(fret-diagram-details mute-string) = #"M"
      \once \override FretBoard
        #'(fret-diagram-details label-dir) = #LEFT
      \once \override FretBoard
        #'(fret-diagram-details dot-color) = #'black
      c'
      \once \override FretBoard
        #'(fret-diagram-details finger-code) = #'below-string
      \once \override FretBoard
        #'(fret-diagram-details dot-radius) = #0.35
      \once \override FretBoard
        #'(fret-diagram-details dot-position) = #0.5
      \once \override FretBoard
        #'(fret-diagram-details fret-count) = #3
      d
    }
  }
  \new Voice {
    c'1 c' c' d'
  }
>>

[image of music]

Defining predefined fretboards for other instruments Predefined fret diagrams can be added for new instruments in addition to the standards used for guitar. This file shows how this is done by defining a new string-tuning and a few predefined fretboards for the Venezuelan cuatro.

This file also shows how fingerings can be included in the chords used as reference points for the chord lookup, and displayed in the fret diagram and the TabStaff, but not the music.

These fretboards are not transposable because they contain string information. This is planned to be corrected in the future.

% add FretBoards for the Cuatro
%   Note: This section could be put into a separate file
%      predefined-cuatro-fretboards.ly
%      and \included into each of your compositions

cuatroTuning = #'(11 18 14 9)

dSix = { <a\4 b\1 d\3 fis\2> }
dMajor = { <a\4 d\1 d\3 fis \2> }
aMajSeven = { <a\4 cis\1 e\3 g\2> }
dMajSeven = { <a\4 c\1 d\3 fis\2> }
gMajor = { <b\4 b\1 d\3 g\2> }

\storePredefinedDiagram \dSix
                        #cuatroTuning
                        #"o;o;o;o;"
\storePredefinedDiagram \dMajor
                        #cuatroTuning
                        #"o;o;o;3-3;"
\storePredefinedDiagram \aMajSeven
                        #cuatroTuning
                        #"o;2-2;1-1;2-3;"
\storePredefinedDiagram \dMajSeven
                        #cuatroTuning
                        #"o;o;o;1-1;"
\storePredefinedDiagram \gMajor
                        #cuatroTuning
                        #"2-2;o;1-1;o;"

% end of potential include file /predefined-cuatro-fretboards.ly


#(set-global-staff-size 16)

primerosNames = \chordmode {
  d:6 d a:maj7 d:maj7 
  g
}
primeros = {
  \dSix \dMajor \aMajSeven \dMajSeven
  \gMajor
}

\score {
  <<
    \new ChordNames {
      \set chordChanges = ##t
      \primerosNames
    }

    \new Staff {
      \new Voice \with {
        \remove "New_fingering_engraver"
      } 
      \relative c'' {
        \primeros
      }
    }

    \new FretBoards {
      \set stringTunings = #cuatroTuning
      \override FretBoard
        #'(fret-diagram-details string-count) = #'4
      \override FretBoard
        #'(fret-diagram-details finger-code) = #'in-dot
      \primeros
    }

    \new TabStaff \relative c'' {
      \set TabStaff.stringTunings = #cuatroTuning
      \primeros
    }
    
  >>

  \layout { 
    \context {
      \Score
      \override SpacingSpanner
        #'base-shortest-duration = #(ly:make-moment 1 16)
    }
  }
  \midi { }
}

[image of music]

See also

Notation Reference: Custom tablatures, Automatic fret diagrams, Chord mode overview, Predefined fretboard diagrams.

Installed Files: ‘ly/predefined-guitar-fretboards.ly’, ‘ly/predefined-guitar-ninth-fretboards.ly’.

Snippets: Fretted strings.

Internals Reference: fret-diagram-interface.


Automatic fret diagrams

Fret diagrams can be automatically created from entered notes using the FretBoards context. If no predefined diagram is available for the entered notes in the active stringTunings, this context calculates strings and frets that can be used to play the notes.

<<
  \context ChordNames {
     \chordmode {
       f1 g
     }
  }
  \context FretBoards {
    < f, c f a c' f'>1
    < g,\6 b, d g b g'>
  }
  \context Staff {
    \clef "treble_8"
    < f, c f a c' f'>1
    < g, b, d g b' g'>
  }
>>

[image of music]

As no predefined diagrams are loaded by default, automatic calculation of fret diagrams is the default behavior. Once default diagrams are loaded, automatic calculation can be enabled and disabled with predefined commands:

\storePredefinedDiagram <c e g c' e'>
                        #guitar-tuning
                        #"x;3-1-(;5-2;5-3;5-4;3-1-1);"
<<
  \context ChordNames {
     \chordmode {
       c1 c c
     }
  }
  \context FretBoards {
    <c e g c' e'>1
    \predefinedFretboardsOff
    <c e g c' e'>
    \predefinedFretboardsOn
    <c e g c' e'>
  }
  \context Staff {
    \clef "treble_8"
    <c e g c' e'>1
    <c e g c' e'>
    <c e g c' e'>
  }
>>

[image of music]

Sometimes the fretboard calculator will be unable to find an accceptable diagram. This can often be remedied by manually assigning a note to a string. In many cases, only one note need be manually placed on a string; the rest of the notes will then be placed appropriately by the FretBoards context.

Fingerings can be added to FretBoard fret diagrams.

<<
  \context ChordNames {
     \chordmode {
       c1 d:m
     }
  }
  \context FretBoards {
    < c-3 e-2 g c'-1 e' > 1
    < d a-2 d'-3 f'-1>
  }
  \context Staff {
    \clef "treble_8"
    < c e g c' e' > 1
    < d a d' f'>
  }
>>

[image of music]

The minimum fret to be used in calculating strings and frets for the FretBoard context can be set with the minimumFret property.

<<
  \context ChordNames {
     \chordmode {
       d1:m d:m
     }
  }
  \context FretBoards {
    < d a d' f'>
    \set FretBoards.minimumFret = #5
    < d a d' f'>
  }
  \context Staff {
    \clef "treble_8"
    < d a d' f'>
    < d a d' f'>
  }
>>

[image of music]

The strings and frets for the FretBoards context depend on the stringTunings property, which has the same meaning as in the TabStaff context. See Custom tablatures for information on the stringTunings property.

The graphical layout of a fret diagram can be customized according to user preference through the properties of the fret-diagram-interface. Details are found at fret-diagram-interface. For a FretBoards fret diagram, the interface properties belong to FretBoards.FretBoard.

Predefined commands

\predefinedFretboardsOff, \predefinedFretboardsOn.

See also

Notation Reference: Custom tablatures.

Snippets: Fretted strings.

Internals Reference: fret-diagram-interface.


Right-hand fingerings

Right-hand fingerings p-i-m-a must be entered within a chord construct <> for them to be printed in the score, even when applied to a single note.

Note: There must be a hyphen after the note and a space before the closing >.

\clef "treble_8"
<c-\rightHandFinger #1 >4
<e-\rightHandFinger #2 >
<g-\rightHandFinger #3 >
<c-\rightHandFinger #4 >
<c,-\rightHandFinger #1 e-\rightHandFinger #2
  g-\rightHandFinger #3 c-\rightHandFinger #4 >1

[image of music]

For convenience, you can abbreviate \rightHandFinger to something short, for example RH,

#(define RH rightHandFinger)

Selected Snippets

Placement of right-hand fingerings

It is possible to exercise greater control over the placement of right-hand fingerings by setting a specific property, as demonstrated in the following example.

#(define RH rightHandFinger)

\relative c {
  \clef "treble_8"
  
  \set strokeFingerOrientations = #'(up down)
  <c-\RH #1 e-\RH #2 g-\RH #3 c-\RH #4 >4
  
  \set strokeFingerOrientations = #'(up right down)
  <c-\RH #1 e-\RH #2 g-\RH #3 c-\RH #4 >4
  
  \set strokeFingerOrientations = #'(left)
  <c-\RH #1 e-\RH #2 g-\RH #3 c-\RH #4 >2
}

[image of music]

Fingerings, string indications, and right-hand fingerings

This example combines left-hand fingering, string indications, and right-hand fingering.

#(define RH rightHandFinger)

\relative c {
  \clef "treble_8"
  <c-3\5-\RH #1 >4
  <e-2\4-\RH #2 >4
  <g-0\3-\RH #3 >4
  <c-1\2-\RH #4 >4
}

[image of music]

See also

Snippets: Fretted strings.

Internals Reference: StrokeFinger.


2.4.2 Guitar

Most of the notational issues associated with guitar music are covered sufficiently in the general fretted strings section, but there are a few more worth covering here. Occasionally users want to create songbook-type documents having only lyrics with chord indications above them. Since Lilypond is a music typesetter, it is not recommended for documents that have no music notation in them. A better alternative is a word processor, text editor, or, for experienced users, a typesetter like GuitarTeX.


Indicating position and barring

This example demonstrates how to include guitar position and barring indications.

\clef "treble_8"
b16 d g b e
\textSpannerDown
\override TextSpanner #'(bound-details left text) = #"XII "
  g16\startTextSpan
  b16 e g e b g\stopTextSpan
e16 b g d

[image of music]

See also

Notation Reference: Text spanners.

Snippets: Fretted strings, Expressive marks.


Indicating harmonics and dampened notes

Special note heads can be used to indicate dampened notes or harmonics. Harmonics are normally further explained with a text markup.

\relative c' {
  \clef "treble_8"
  \override Staff.NoteHead #'style = #'cross
  g8 a b c b4
  \override Staff.NoteHead #'style = #'harmonic-mixed
  d^\markup { \italic { \fontsize #-2 { "harm. 12" }}} <g b>1
}

[image of music]

See also

Snippets: Fretted strings.

Notation Reference: Special note heads, Note head styles.


2.4.3 Banjo


Banjo tablatures

LilyPond has basic support for the five-string banjo. When making tablatures for five-string banjo, use the banjo tablature format function to get correct fret numbers for the fifth string:

\new TabStaff <<
  \set TabStaff.tablatureFormat = #fret-number-tablature-format-banjo
  \set TabStaff.stringTunings = #banjo-open-g-tuning
  {
    \stemDown
    g8 d' g'\5 a b g e d' |
    g4 d''8\5 b' a'\2 g'\5 e'\2 d' |
    g4
  }
>>

[image of music]

A number of common tunings for banjo are predefined in LilyPond: banjo-c-tuning (gCGBD), banjo-modal-tuning (gDGCD), banjo-open-d-tuning (aDF#AD) and banjo-open-dm-tuning (aDFAD).

These tunings may be converted to four-string banjo tunings using the four-string-banjo function:

\set TabStaff.stringTunings = #(four-string-banjo banjo-c-tuning)

See also

Snippets: Fretted strings.

The file ‘scm/output-lib.scm’ contains predefined banjo tunings.


2.5 Percussion


2.5.1 Common notation for percussion

Rhythmic music is primarily used for percussion and drum notation, but it can also be used to show the rhythms of melodies.


References for percussion

TODO add more.

See also

Notation Reference: Showing melody rhythms, Instantiating new staves. Percussion in MIDI.

Snippets: Percussion.


Basic percussion notation

Percussion notes may be entered in \drummode mode, which is similar to the standard mode for entering notes. The simplest way to enter percussion notes is to use the \drums command, which creates the correct context and entry mode for percussion:

\drums {
  hihat4 hh bassdrum bd
}

[image of music]

This is shorthand for:

\new DrumStaff {
  \drummode {
    hihat4 hh bassdrum bd
  }
}

[image of music]

Each piece of percussion has a full name and an abbreviated name, and both can be used in input files. The full list of percussion note names may be found in Percussion notes.

Note that the normal notation of pitches (such as cis4) in a DrumStaff context will cause an error message. Percussion clefs are added automatically to a DrumStaff contex, but other clefs may also be used.

There are a few issues concerning MIDI support for percussion instruments; for details please see Percussion in MIDI.

See also

Notation Reference: Percussion in MIDI, Percussion notes.

File: ‘ly/drumpitch-init.ly

Snippets: Percussion.


Drum rolls

Drum rolls are indicated with three slashes across the stem. For quarter notes or longer the three slashes are shown explicitly, eighth notes are shown with two slashes (the beam being the third), and drum rolls shorter than eighths have one stem slash to supplement the beams. This is achieved with the tremolo notation, :32, as described in Tremolo repeats. Here is an example of some snare rolls:

\drums {
  \time 2/4
  sn16 sn8 sn16 sn8 sn8:32 ~
  sn8 sn8 sn4:32 ~
  sn4 sn8 sn16 sn16
  sn4 r4
}

[image of music]

Sticking can be indicated by placing ^"R" or ^"L" after the note. The staff-padding property may be overridden to achieve a pleasing baseline.

\drums {
  \repeat unfold 2 {
    sn16 ^"L" sn^"R" sn^"L" sn^"L" sn^"R" sn^"L"  sn^"R" sn^"R"
  }
}

[image of music]

See also

Snippets: Percussion.


Pitched percussion

Certain pitched percussion instruments (e.g. xylophone, vibraphone, and timpani) are written using normal staves. This is covered in other sections of the manual.

See also

Notation Reference: Percussion in MIDI.

Snippets: Percussion.


Percussion staves

A percussion part for more than one instrument typically uses a multiline staff where each position in the staff refers to one piece of percussion. To typeset the music, the notes must be interpreted in DrumStaff and DrumVoice context.

up = \drummode {
  crashcymbal4 hihat8 halfopenhihat hh hh hh openhihat
}
down = \drummode {
  bassdrum4 snare8 bd r bd sn4
}
\new DrumStaff <<
  \new DrumVoice { \voiceOne \up }
  \new DrumVoice { \voiceTwo \down }
>>

[image of music]

The above example shows verbose polyphonic notation. The short polyphonic notation, described in I'm hearing Voices, can also be used if the voices are instantiated by hand first. For example,

\new DrumStaff <<
  \new DrumVoice = "1" { s1*2 }
  \new DrumVoice = "2" { s1*2 }
  \drummode {
    bd4 sn4 bd4 sn4
    << {
      \repeat unfold 16 hh16
    } \\ {
      bd4 sn4 bd4 sn4
    } >>
  }
>>

[image of music]

There are also other layout possibilities. To use these, set the property drumStyleTable in context DrumVoice. The following variables have been predefined:

drums-style

This is the default. It typesets a typical drum kit on a five-line staff:

[image of music]

The drum scheme supports six different toms. When there are fewer toms, simply select the toms that produce the desired result. For example, to get toms on the three middle lines you use tommh, tomml, and tomfh.

timbales-style

This typesets timbales on a two line staff:

[image of music]

congas-style

This typesets congas on a two line staff:

[image of music]

bongos-style

This typesets bongos on a two line staff:

[image of music]

percussion-style

To typeset all kinds of simple percussion on one line staves:

[image of music]


Custom percussion staves

If you do not like any of the predefined lists you can define your own list at the top of your file.

#(define mydrums '(
         (bassdrum     default   #f         -1)
         (snare        default   #f         0)
         (hihat        cross     #f         1)
         (pedalhihat   xcircle   "stopped"  2)
         (lowtom       diamond   #f         3)))
up = \drummode { hh8 hh hh hh hhp4 hhp }
down = \drummode { bd4 sn bd toml8 toml }

\new DrumStaff <<
  \set DrumStaff.drumStyleTable = #(alist->hash-table mydrums)
  \new DrumVoice { \voiceOne \up }
  \new DrumVoice { \voiceTwo \down }
>>

[image of music]

Selected Snippets

FIXME: MOVE ALL THESE TO LSR! -gp

Here are some examples:

Two Woodblocks, entered with wbh (high woodblock) and wbl (low woodblock)

% These lines define the position of the woodblocks in the stave;
% if you like, you can change it or you can use special note heads
% for the woodblocks.
#(define mydrums '((hiwoodblock default #t  3)
                   (lowoodblock default #t -2)))

woodstaff = {
  % This defines a staff with only two lines.
  % It also defines the positions of the two lines.
  \override Staff.StaffSymbol #'line-positions = #'(-2 3)

  % This is neccessary; if not entered, the barline would be too short!
  \override Staff.BarLine #'bar-size = #3
}

\new DrumStaff {
  \set DrumStaff.drumStyleTable = #(alist->hash-table mydrums)

  % with this you load your new drum style table
  \woodstaff

  \drummode {
    \time 2/4
    wbl8 wbl16 wbl wbh8-> wbl |
    wbl8 wbl16 wbh-> ~ wbh wbl16 r8 |
  }
}

[image of music]

Note that in this special case the length of the barline must altered with \override Staff.BarLine #'bar-size #number. Otherwise it would be too short. And you have also to define the positions of the two stafflines. For more information about these delicate things have a look at Staff symbol.

A tambourine, entered with ‘tamb’:

#(define mydrums '((tambourine default #t 0)))

tambustaff = {
  \override Staff.StaffSymbol #'line-positions = #'( 0 )
  \override Staff.BarLine #'bar-size = #3
  \set DrumStaff.instrumentName = #"Tambourine"
}

\new DrumStaff {
  \tambustaff
  \set DrumStaff.drumStyleTable = #(alist->hash-table mydrums)

  \drummode {
    \time 6/8
    tamb8. tamb16 tamb8 tamb tamb tamb |
    tamb4. tamb8 tamb tamb |
    % the trick with the scaled duration and the shorter rest
    % is neccessary for the correct ending of the trill-span!
    tamb2.*5/6 \startTrillSpan s8 \stopTrillSpan |
  }
}

[image of music]

Music for Tam-Tam (entered with ‘tt’):

#(define mydrums '((tamtam default #t 0)))

tamtamstaff = {
  \override Staff.StaffSymbol #'line-positions = #'( 0 )
  \override Staff.BarLine #'bar-size = #3
  \set DrumStaff.instrumentName = #"Tamtam"
}

\new DrumStaff {
  \tamtamstaff
  \set DrumStaff.drumStyleTable = #(alist->hash-table mydrums)

  \drummode {
    tt 1 \pp \laissezVibrer
  }
}

[image of music]

Two different bells, entered with ‘cb’ (cowbell) and ‘rb’ (ridebell)

#(define mydrums '((ridebell default #t  3)
                   (cowbell  default #t -2)))

bellstaff = {
  \override DrumStaff.StaffSymbol #'line-positions = #'(-2 3)
  \set DrumStaff.drumStyleTable = #(alist->hash-table mydrums)
  \override Staff.BarLine #'bar-size = #3
  \set DrumStaff.instrumentName = #"Different Bells"
}

\new DrumStaff {
  \bellstaff
  \drummode {
    \time 2/4
    rb8 rb cb cb16 rb-> ~ |
    rb16 rb8 rb16 cb8 cb |
  }
}

[image of music]

Here an short example by maestro Stravinsky (from ‘L’histoire du Soldat’)

#(define mydrums '((bassdrum   default #t  4)
                   (snare      default #t -4)
                   (tambourine default #t  0)))

global = {
  \time 3/8 s4.
  \time 2/4 s2*2
  \time 3/8 s4.
  \time 2/4 s2
}

drumsA = {
  \context DrumVoice <<
    { \global }
    { \drummode {
        \autoBeamOff
        \stemDown sn8 \stemUp tamb s8 |
        sn4 \stemDown sn4 |
        \stemUp tamb8 \stemDown sn8 \stemUp sn16 \stemDown sn \stemUp sn8 |
        \stemDown sn8 \stemUp tamb s8 |
        \stemUp sn4 s8 \stemUp tamb
      }
    }
  >>
}

drumsB = {
  \drummode {
    s4 bd8 s2*2 s4 bd8 s4 bd8 s8
  }
}

\layout {
  indent = #40
}

\score {
  \new StaffGroup <<
    \new DrumStaff {
      \set DrumStaff.instrumentName = \markup {
        \column {
          "Tambourine"
          "et"
          "caisse claire s. timbre"
        }
      }
      \set DrumStaff.drumStyleTable = #(alist->hash-table mydrums)
      \drumsA
    }

   \new DrumStaff {
     \set DrumStaff.instrumentName = #"Grosse Caisse"
     \set DrumStaff.drumStyleTable = #(alist->hash-table mydrums)
     \drumsB }
  >>
}

[image of music]

See also

Snippets: Percussion.

Internals Reference: DrumStaff, DrumVoice.


Ghost notes

Ghost notes for drums and percussion may be created using the \parenthesize command detailed in Parentheses. However, the default \drummode does not include the Parenthesis_engraver plugin which allows this.

\new DrumStaff \with {
  \consists "Parenthesis_engraver"
}
<<
  \context DrumVoice  = "1" { s1 }
  \context DrumVoice  = "2" { s1 }
  \drummode {
    <<
      {
        hh8[ hh] <hh sn> hh16
        < \parenthesize sn > hh
        < \parenthesize sn > hh8 <hh sn> hh
      } \\
      {
        bd4 r4 bd8 bd r8 bd
      }
    >>
  }
>>

[image of music]

Also note that you must add chords (< > brackets) around each \parenthesize statement.

See also

Snippets: Percussion.


2.6 Wind instruments

[image of music]

This section includes some elements of music notation that arise when writing for winds.


2.6.1 Common notation for wind instruments

This section discusses some issues common to most wind instruments.


References for wind instruments

Many notation issues for wind instruments pertain to breathing and tonguing:

There are also other aspects of musical notation that can apply to wind instruments:

Selected Snippets

Changing \flageolet mark size

To make the \flageolet circle smaller use the following Scheme function.

smallFlageolet =
#(let ((m (make-music 'ArticulationEvent
                      'articulation-type "flageolet")))
   (ly:music-set-property! m 'tweaks
     (acons 'font-size -3
       (ly:music-property m 'tweaks)))
  m)

\layout { ragged-right = ##f }

\relative c'' {
  d4^\flageolet_\markup { default size } d_\flageolet
  c4^\smallFlageolet_\markup { smaller } c_\smallFlageolet
}

[image of music]

See also

Notation Reference: Breath marks, Slurs, Articulations and ornamentations, List of articulations, Tremolo repeats, Instrument transpositions, Glissando, Grace notes, Falls and doits, Special note heads,

Snippets: Winds


Fingerings

All wind instruments other than the trombone require the use of several fingers to produce each pitch.

TBC


2.6.2 Bagpipes

This section includes extra information for writing for bagpipes.


Bagpipe definitions

LilyPond contains special definitions for music for the Scottish highland bagpipe; to use them, add

\include "bagpipe.ly"

at the top of your input file. This lets you add the special grace notes common to bagpipe music with short commands. For example, you could write \taor instead of

\grace { \small G32[ d G e] }

bagpipe.ly also contains pitch definitions for the bagpipe notes in the appropriate octaves, so you do not need to worry about \relative or \transpose.

\include "bagpipe.ly"
{ \grg G4 \grg a \grg b \grg c \grg d \grg e \grg f \grA g A }

[image of music]

Bagpipe music nominally uses the key of D Major (even though that isn’t really true). However, since that is the only key that can be used, the key signature is normally not written out. To set this up correctly, always start your music with \hideKeySignature. If you for some reason want to show the key signature, you can use \showKeySignature instead.

Some modern music use cross fingering on c and f to flatten those notes. This can be indicated by cflat or fflat. Similarly, the piobaireachd high g can be written gflat when it occurs in light music.

See also

Winds


Bagpipe example

This is what the well known tune Amazing Grace looks like in bagpipe notation.

\include "bagpipe.ly"
\layout {
  indent = 0.0\cm
  \context { \Score \remove "Bar_number_engraver" }
}

\header {
  title = "Amazing Grace"
  meter = "Hymn"
  arranger = "Trad. arr."
}

{
  \hideKeySignature
  \time 3/4
  \grg \partial 4 a8. d16
  \slurd d2 \grg f8[ e32 d16.]
  \grg f2 \grg f8 e
  \thrwd d2 \grg b4
  \grG a2 \grg a8. d16
  \slurd d2 \grg f8[ e32 d16.]
  \grg f2 \grg e8. f16
  \dblA A2 \grg A4
  \grg A2 f8. A16
  \grg A2 \hdblf f8[ e32 d16.]
  \grg f2 \grg f8 e
  \thrwd d2 \grg b4
  \grG a2 \grg a8. d16
  \slurd d2 \grg f8[ e32 d16.]
  \grg f2 e4
  \thrwd d2.
  \slurd d2
  \bar "|."
}

[image of music]

See also

Winds


2.7 Chord notation

[image of music]

Chords can be entered either as normal notes or in chord mode and displayed using a variety of traditional European chord naming conventions. Chord names and figured bass notation can also be displayed.


2.7.1 Chord mode

Chord mode is used to enter chords using an indicator of the chord structure, rather than the chord pitches.


Chord mode overview

Chords can be entered as simultaneous music, as discussed in Chorded notes.

Chords can also be entered in “chord mode”, which is an input mode that focuses on the structures of chords in traditional European music, rather than on specific pitches. This is convenient for those who are familiar with using chord names to describe chords. More information on different input modes can be found at Input modes.

\chordmode { c1 g a g c }

[image of music]

Chords entered using chord mode are music elements, and can be transposed just like chords entered using simultaneous music.

Chord mode and note mode can be mixed in sequential music:

<c e g>2 <g b d>
\chordmode { c2 f }
<c e g>2 <g' b d>
\chordmode { f2 g }

[image of music]

See also

Music Glossary: chord.

Notation Reference: Chorded notes, Input modes.

Snippets: Chords

Known issues and warnings

When chord mode and note mode are mixed in sequential music, and chord mode comes first, the note mode will create a new Staff context.

\chordmode { c2 f }
<c e g>2 <g' b d>

[image of music]

To avoid this behavior, explicitly create the Staff context:

\new Staff {
  \chordmode { c2 f }
  <c e g>2  <g' b d>
}

[image of music]


Common chords

Major triads are entered by including the root and an optional duration:

\chordmode { c2 f4 g }

[image of music]

Minor, augmented, and diminished triads are entered by placing : and a quality modifier string after the duration:

\chordmode { c2:m f4:aug g:dim }

[image of music]

Seventh chords can be created:

\chordmode { c1:7 c:m7 c:maj7 c:dim7 c:aug7 }

[image of music]

The table belows shows the actions of the quality modifiers on triads and seventh chords. The default seventh step added to chords is a minor or flatted seventh, which makes the dominant seventh the basic seventh chord. All alterations are relative to the dominant seventh. A more complete table of modifier usage is found at Common chord modifiers.

Modifier

Action

Example

None

The default action; produces a major triad.

[image of music]

m, m7

The minor chord. This modifier lowers the 3rd.

[image of music]

dim, dim7

The diminished chord. This modifier lowers the 3rd, 5th and (if present) the 7th step.

[image of music]

aug

The augmented chord. This modifier raises the 5th step.

[image of music]

maj, maj7

The major 7th chord. This modifier adds a raised 7th step. The 7 following maj is optional. Do NOT use this modifier to create a major triad.

[image of music]

See also

Notation Reference: Common chord modifiers, Extended and altered chords.

Snippets: Chords.

Known issues and warnings

Only one quality modifier should be used per chord, typically on the highest step present in the chord. Chords with more than quality modifier will be parsed without an error or warning, but the results are unpredictable. Chords that cannot be achieved with a single quality modifier should be altered by individual pitches, as described in Extended and altered chords.


Extended and altered chords

Chord structures of arbitrary complexity can be created in chord mode. The modifier string can be used to extend a chord, add or remove chord steps, raise or lower chord steps, and add a bass note or create an inversion.

The first number following the : is taken to be the extent of the chord. The chord is constructed by sequentially adding thirds to the root until the specified number has been reached. Note that the seventh step added as part of an extended chord will be the minor or flatted seventh, not the major seventh. If the extent is not a third (e.g., 6), thirds are added up to the highest third below the extent, and then the step of the extent is added. The largest possible value for the extent is 13. Any larger value is interpreted as 13.

\chordmode {
  c1:2 c:3 c:4 c:5
  c1:6 c:7 c:8 c:9
  c1:10 c:11 c:12 c:13
  c1:14
}

[image of music]

Note that both c:5 and c produce a C major triad.

Since an unaltered 11 does not sound good when combined with an unaltered 13, the 11 is removed from a :13 chord (unless it is added explicitly).

\chordmode {
  c1:13 c:13.11 c:m13
}

[image of music]

Individual steps can be added to a chord. Additions follow the extent and are prefixed by a dot (.). The basic seventh step added to a chord is the minor or flatted seventh, rather than the major seventh.

\chordmode {
  c1:5.6 c:3.7.8 c:3.6.13
}

[image of music]

Added steps can be as high as desired.

\chordmode {
  c4:5.15 c:5.20 c:5.25 c:5.30
}

[image of music]

Added chord steps can be altered by suffixing a - or + sign to the number. To alter a step that is automatically included as part of the basic chord structure, add it as an altered step.

\chordmode {
  c1:7+ c:5+.3- c:3-.5-.7-
}

[image of music]

Following any steps to be added, a series of steps to be removed is introduced in a modifier string with a prefix of ^. If more than one step is to be removed, the steps to be removed are separated by . following the initial ^.

\chordmode {
  c1^3 c:7^5 c:9^3 c:9^3.5 c:13.11^3.7
}

[image of music]

The modifier sus can be added to the modifier string to create suspended chords. This removes the 3rd step from the chord. Append either 2 or 4 to add the 2nd or 4th step to the chord. sus is equivalent to ^3; sus4 is equivalent to .4^3.

\chordmode {
  c1:sus c:sus2 c:sus4 c:5.4^3
}

[image of music]

Inversions (putting a pitch other than the root on the bottom of the chord) and added bass notes can be specified by appending /pitch to the chord.

\chordmode {
  c1 c/g c/f
}

[image of music]

A bass note that is part of the chord can be added, instead of moved as part of an inversion, by using /+pitch.

\chordmode {
  c1 c/g c/+g
}

[image of music]

Chord modifiers that can be used to produce a variety of standard chords are shown in Common chord modifiers.

See also

Notation Reference: Common chord modifiers.

Snippets: Chords

Known issues and warnings

Each step can only be present in a chord once. The following simply produces the augmented chord, since 5+ is interpreted last.

\chordmode { c1:5.5-.5+ }

[image of music]

Only the second inversion can be created by adding a bass note. The first inversion requires changing the root of the chord.

\chordmode {
  c'1: c':/g e:6-3-^5 e:m6-^5
}

[image of music]


2.7.2 Displaying chords

Chords can be displayed by name, in addition to the standard display as notes on a staff.


Printing chord names

Chord names are printed in the ChordNames context:

\new ChordNames {
  \chordmode {
    c2 f4. g8
  }
}

[image of music]

Chords can be entered as simultaneous notes or through the use of chord mode. The displayed chord name will be the same, regardless of the mode of entry, unless there are inversions or added bass notes:

<<
  \new ChordNames {
    <c e g>2  <f bes c>
    <f c' e g>1
    \chordmode {
      c2 f:sus4 c1:/f
    }
  }
  {
    <c e g>2  <f bes c>
    <f, c' e g>1
    \chordmode {
      c2 f:sus4 c1:/f
    }
  }
>>

[image of music]

\chords { ... } is a shortcut notation for \new ChordNames { \chordmode { ... } }.

\chords {
  c2 f4.:m g8:maj7
}

[image of music]

\new ChordNames {
  \chordmode {
    c2 f4.:m g8:maj7
  }
}

[image of music]

Selected Snippets

Showing chords at changes

Chord names can be displayed only at the start of lines and when the chord changes.

harmonies = \chordmode {
  c1:m c:m \break c:m c:m d
}
<<
  \new ChordNames {
    \set chordChanges = ##t
    \harmonies
  }
  \new Staff {
    \relative c' { \harmonies }
  }
>>

[image of music]

Simple lead sheet

When put together, chord names, a melody, and lyrics form a lead sheet:

<<
  \chords { c2 g:sus4 f e }
  \relative c'' {
    a4 e c8 e r4
    b2 c4( d)
  }
  \addlyrics { One day this shall be free __ }
>>

[image of music]

See also

Music Glossary: chord.

Notation Reference: Writing music in parallel.

Snippets: Chords.

Internals Reference: ChordNames, ChordName, Chord_name_engraver, Volta_engraver, Bar_engraver.

Known issues and warnings

Chords containing inversions or altered bass notes are not named properly if entered using simultaneous music.


Customizing chord names

There is no unique system for naming chords. Different musical traditions use different names for the same set of chords. There are also different symbols displayed for a given chord name. The names and symbols displayed for chord names are customizable.

The basic chord name layout is a system for Jazz music, proposed by Klaus Ignatzek (see Literature list). The chord naming system can be modified as described below. An alternate jazz chord system has been developed using these modifications. The Ignatzek and alternate Jazz notation are shown on the chart in Chord name chart.

In addition to the different naming systems, different note names are used for the root in different languages. The predefined variables \germanChords, \semiGermanChords, \italianChords and \frenchChords set these variables. The effect is demonstrated here:

[image of music]

If none of the existing settings give the desired output, the chord name display can be tuned through the following properties.

chordRootNamer

The chord name is usually printed as a letter for the root with an optional alteration. The transformation from pitch to letter is done by this function. Special note names (for example, the German ‘H’ for a B-chord) can be produced by storing a new function in this property.

majorSevenSymbol

This property contains the markup object used to follow the output of chordRootNamer to identify a major 7 chord. Predefined options are whiteTriangleMarkup and blackTriangleMarkup.

chordNoteNamer

When the chord name contains additional pitches other than the root (e.g., an added bass note), this function is used to print the additional pitch. By default the pitch is printed using chordRootNamer. The chordNoteNamer property can be set to a specialized function to change this behavior. For example, the bass note can be printed in lower case.

chordNameSeparator

Different parts of a chord name are normally separated by a slash. By setting chordNameSeparator, you can use any desired markup for a separator.

chordNameExceptions

This property is a list of pairs. The first item in each pair is a set of pitches used to identify the steps present in the chord. The second item is a markup that will follow the chordRootNamer output to create the chord name.

chordPrefixSpacer

The ‘m’ for minor chords is usually printed immediately to the right of the root of the chord. A spacer can be placed between the root and ‘m’ by setting chordPrefixSpacer. The spacer is not used when the root is altered.

Predefined commands

\whiteTriangleMarkup, \blackTriangleMarkup, \germanChords, \semiGermanChords, \italianChords, \frenchChords.

Selected Snippets

Chord name exceptions

The property chordNameExceptions can be used to store a list of special notations for specific chords.

% modify maj9 and 6(add9)
% Exception music is chords with markups
chExceptionMusic = {
  <c e g b d'>1-\markup { \super "maj9" }
  <c e g a d'>1-\markup { \super "6(add9)" }
}

% Convert music to list and prepend to existing exceptions.
chExceptions = #( append
  ( sequential-music-to-chord-exceptions chExceptionMusic #t)
  ignatzekExceptions)

theMusic = \chordmode {
  g1:maj9 g1:6.9
  \set chordNameExceptions = #chExceptions
  g1:maj9 g1:6.9
}

\layout {
  ragged-right = ##t 
}

<< \context ChordNames \theMusic
   \context Voice \theMusic
>>  

[image of music]

chord name major7

The layout of the major 7 can be tuned with majorSevenSymbol.

\chords {
  c:7+
  \set majorSevenSymbol = \markup { j7 }
  c:7+
}

[image of music]

Adding bar lines to ChordNames context

To add bar line indications in the ChordNames context, add the Bar_engraver.

\new ChordNames \with {
  \override BarLine #'bar-size = #4
  \consists "Bar_engraver"
}
\chordmode {
  f1:maj7 f:7 bes:7 
}

[image of music]

Volta under chords By adding the Volta_engraver to the relevant staff, volte can be put under chords.

\score {
  <<
    \chords {
      c1
      c1
    }
    \new Staff \with {
      \consists "Volta_engraver"
    }
    {
      \repeat volta 2 { c'1 }
      \alternative { c' }
    }
  >>
  \layout {
    \context {
      \Score
      \remove "Volta_engraver"
    }
  }
}

[image of music]

Changing chord separator

The separator between different parts of a chord name can be set to any markup.

\chords {
  c:7sus4
  \set chordNameSeparator
    = \markup { \typewriter | }
  c:7sus4
}

[image of music]

See also

Notation Reference: Chord name chart, Common chord modifiers.

Installed Files: ‘scm/chords-ignatzek.scm’, ‘scm/chord-entry.scm’, ‘ly/chord-modifier-init.ly’.

Snippets: Chords.

Known issues and warnings

Chord names are determined from both the pitches that are present in the chord and the information on the chord structure that may have been entered in \chordmode. If the simultaneous pitches method of entering chords is used, undesired names result from inversions or bass notes.

myChords = \relative c' {
  \chordmode { c1 c/g c/f }
  <c e g>1 <g c e> <f c' e g>
}
<<
  \new ChordNames { \myChords }
  \new Staff { \myChords }
>>

[image of music]


2.7.3 Figured bass

[image of music]

Figured bass notation can be displayed.


Introduction to figured bass

LilyPond has support for figured bass, also called thorough bass or basso continuo:

<<
  \new Voice { \clef bass dis4 c d ais g fis}
  \new FiguredBass {
    \figuremode {
      < 6 >4 < 7\+ >8 < 6+ [_!] >
      < 6 >4 <6 5 [3+] >
      < _ >4 < 6 5/>4
    }
  }
>>

[image of music]

The support for figured bass consists of two parts: there is an input mode, introduced by \figuremode, that accepts entry of bass figures, and there is a context named FiguredBass that takes care of displaying BassFigure objects. Figured bass can also be displayed in Staff contexts.

\figures{ ... } is a shortcut notation for \new FiguredBass { \figuremode { ... } }.

Although the support for figured bass may superficially resemble chord support, it is much simpler. \figuremode mode simply stores the figures and the FiguredBass context prints them as entered. There is no conversion to pitches.

See also

Music Glossary: figured bass.

Snippets: Chords


Entering figured bass

\figuremode is used to switch the input mode to figure mode. More information on different input modes can be found at Input modes.

In figure mode, a group of bass figures is delimited by < and >. The duration is entered after the >.

\new FiguredBass {
  \figuremode {
    <6 4>2
  }
}

[image of music]

Accidentals (including naturals) can be added to figures:

\figures {
  <7! 6+ 4-> <5++> <3-->
}

[image of music]

Augmented and diminished steps can be indicated:

\figures {
  <6\+ 5/> <7/>
}

[image of music]

A backward slash through a figure (typically used for raised sixth steps) can be created:

\figures {
  <6> <6\\>
}

[image of music]

Vertical spaces and brackets can be be included in figures:

\figures {
  <[12 _!] 8 [6  4]>
}

[image of music]

Any text markup can be inserted as a figure:

\figures {
  <\markup { \tiny \number 6 \super (1) } 5>
}

[image of music]

Continuation lines can be used to indicate repeated figures:

<<
  {
    \clef bass
    e4 d c b,
    e4 d c b,
  }
  \figures {
    \bassFigureExtendersOn
    <6 4>4 <6 3> <7 3> <7 3>
    \bassFigureExtendersOff
    <6 4>4 <6 3> <7 3> <7 3>
  }
>>

[image of music]

In this case, the extender lines replace existing figures, unless the continuation lines have been explicitly terminated.

<<
  \figures {
    \bassFigureExtendersOn
    <6 4>4 <6 4> <6\! 4\!> <6 4>
  }
  {
    \clef bass
    d4 d c c
  }
>>

[image of music]

The table below summarizes the figure modifiers available.

Modifier

Purpose

Example

+, -, !

Accidentals

[image of music]

\+, /

Augmented and diminished steps

[image of music]

\\

Raised sixth step

[image of music]

\!

End of continuation line

[image of music]

Predefined commands

\bassFigureExtendersOn, \bassFigureExtendersOff.

Selected Snippets

Changing the positions of figured bass alterations

Accidentals and plus signs can appear before or after the numbers, depending on the figuredBassAlterationDirection and figuredBassPlusDirection properties.

\figures {
  <6\+> <5+> <6 4-> r
  \set figuredBassAlterationDirection = #RIGHT
  <6\+> <5+> <6 4-> r
  \set figuredBassPlusDirection = #RIGHT
  <6\+> <5+> <6 4-> r
  \set figuredBassAlterationDirection = #LEFT
  <6\+> <5+> <6 4-> r
}

[image of music]

See also

Snippets: Chords.

Internals Reference: BassFigure, BassFigureAlignment, BassFigureLine, BassFigureBracket, BassFigureContinuation, FiguredBass.


Displaying figured bass

Figured bass can be displayed using the FiguredBass context, or in most staff contexts.

When displayed in a FiguredBass context, the vertical location of the figures is independent of the notes on the staff.

<<
  \relative c'' {
    c4 c'8 r8 c,4 c'
  }
  \new FiguredBass {
    \figuremode {
      <4>4 <10 6>8 s8
      <6 4>4 <6 4>
    }
  }
>>

[image of music]

In the example above, the FiguredBass context must be explicitly instantiated to avoid creating a second (empty) staff.

Figured bass can also be added to Staff contexts directly. In this case, the vertical position of the figures is adjusted automatically.

<<
  \new Staff = myStaff
  \figuremode {
    <4>4 <10 6>8 s8
    <6 4>4 <6 4>
  }
  %% Put notes on same Staff as figures
  \context Staff = myStaff
  {
    \clef bass
    c4 c'8 r8 c4 c'
  }
>>

[image of music]

When added in a Staff context, figured bass can be displayed above or below the staff.

<<
  \new Staff = myStaff
  \figuremode {
    <4>4 <10 6>8 s8
    \bassFigureStaffAlignmentDown
    <6 4>4 <6 4>
  }
  %% Put notes on same Staff as figures
  \context Staff = myStaff
  {
    \clef bass
    c4 c'8 r8 c4 c'
  }
>>

[image of music]

Predefined commands

\bassFigureStaffAlignmentDown, \bassFigureStaffAlignmentUp, \bassFigureStaffAlignmentNeutral.

See also

Snippets: Chords.

Internals Reference: BassFigure, BassFigureAlignment, BassFigureLine, BassFigureBracket, BassFigureContinuation, FiguredBass.

Known issues and warnings

To ensure that continuation lines work properly, it is safest to use the same rhythm in the figure line as in the bass line.

<<
  {
    \clef bass
    \repeat unfold 4 { f16. g32 } f8. es16 d8 es
  }
  \figures {
    \bassFigureExtendersOn
    % The extenders are correct here, with the same rhythm as the bass
    \repeat unfold 4 { <6 4->16. <6 4->32 }
    <5>8. r16 <6>8 <6\! 5->
  }
>>
<<
  {
    \clef bass
    \repeat unfold 4 { f16. g32 } f8. es16 d8 es
  }
  \figures {
    \bassFigureExtendersOn
    % The extenders are incorrect here, even though the timing is the same
    <6 4->4 <6 4->4
    <5>8. r16 <6>8 <6\! 5->
  }
>>

[image of music]

When using extender lines, adjacent figures with the same number in a different figure location can cause the figure positions to invert.

<<
 { fis4 g g, e' }
  \figures {
    \bassFigureExtendersOn
    <6 5>4 <5\! 4> < 5 _!> <6>
  }
>>

[image of music]

To avoid this problem, simply turn on extenders after the figure that begins the extender line and turn them off at the end of the extender line.

<<
 { fis4 g g, e' }
  \figures {
    <6 5>4 <5 4>
    \bassFigureExtendersOn
    < 5 _!>4 <6>
    \bassFigureExtendersOff
  }
>>

[image of music]


2.8 Ancient notation

[image of music]

Support for ancient notation includes features for mensural notation and Gregorian chant notation. These features can be accessed either by modifying style properties of graphical objects such as note heads and rests, or by using one of the pre-defined contexts for mensural or Gregorian notation.

Many graphical objects, such as note heads and flags, accidentals, time signatures, and rests, provide a style property, which can be changed to emulate several different styles of ancient notation. See

Some notational concepts are introduced specifically for ancient notation,


2.8.1 Overview of the supported styles

Three styles are available for typesetting Gregorian chant:

Three styles emulate the appearance of late-medieval and renaissance manuscripts and prints of mensural music:

Baroque and Classical are not complete styles but differ from the default style only in some details: certain noteheads (Baroque) and the quarter rest (Classical).

Only the mensural style has alternatives for all aspects of the notation. Thus, there are no rests or flags in the Gregorian styles, since these signs are not used in plainchant notation, and the Petrucci style has no flags or accidentals of its own.

Each element of the notation can be changed independently of the others, so that one can use mensural flags, petrucci noteheads, classical rests and vaticana clefs in the same piece, if one wishes.


2.8.2 Ancient notation—common features


Pre-defined contexts

For Gregorian chant and mensural notation, there are pre-defined voice and staff contexts available, which set all the various notation signs to values suitable for these styles. If one is satisfied with these defaults, one can proceed directly with note entry without worrying about the details on how to customize a context. See one of the pre-defined contexts VaticanaVoice, VaticanaStaff, MensuralVoice, and MensuralStaff. See further


Ligatures

A ligature is a graphical symbol that represents at least two distinct notes. Ligatures originally appeared in the manuscripts of Gregorian chant notation to denote ascending or descending sequences of notes on the same syllable. They are also used in mensural notation.

Ligatures are entered by enclosing them in \[ and \]. Some ligature styles may need additional input syntax specific for this particular type of ligature. By default, the LigatureBracket engraver just puts a square bracket above the ligature.

\transpose c c' {
  \[ g c a f d' \]
  a g f
  \[ e f a g \]
}

[image of music]

Two other ligature styles are available: the Vaticana for Gregorian chant, and the Mensural for mensural music (only white mensural ligatures are supported for mensural music, and with certain limitations). To use any of these styles, the default Ligature_bracket_engraver has to be replaced with one of the specialized ligature engravers in the Voice context, as explained in White mensural ligatures and Gregorian square neume ligatures.

See also

Known issues and warnings

Ligatures need special spacing that has not yet been implemented. As a result, there is too much space between ligatures most of the time, and line breaking often is unsatisfactory. Also, lyrics do not correctly align with ligatures.

Accidentals must not be printed within a ligature, but instead need to be collected and printed in front of it.

The syntax still uses the deprecated infix style \[ music expr \]. For consistency reasons, it will eventually be changed to postfix style note\[ ... note\].


Custodes

A custos (plural: custodes; Latin word for “guard”) is a symbol that appears at the end of a staff. It anticipates the pitch of the first note of the following line, thus helping the performer to manage line breaks during performance.

Custodes were frequently used in music notation until the seventeenth century. Nowadays, they have survived only in a few particular forms of musical notation such as contemporary editions of Gregorian chant like the Editio Vaticana. There are different custos glyphs used in different flavors of notational style.

For typesetting custodes, just put a Custos_engraver into the Staff context when declaring the \layout block, and change the style of the custos with an \override if desired, as shown in the following example:

[image of music]

The custos glyph is selected by the style property. The styles supported are vaticana, medicaea, hufnagel, and mensural. They are demonstrated in the following fragment

[image of music]

See also

Internals Reference: Custos.

Examples: Ancient notation.


Figured bass support

There is limited support for figured bass notation from the Baroque period; see Figured bass.


2.8.3 Typesetting mensural music