LilyPond Notation Reference: 1.2.1 Writing rhythms

### 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 c128 c128

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

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

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.

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. Dots may be manually placed above or below the staff; see Direction and placement.

#### Predefined commands

`\autoBeamOn`, `\autoBeamOff`, `\dotsUp`, `\dotsDown`, `\dotsNeutral`.

#### Selected Snippets

Alternative breve notehead with double vertical lines

This code demonstrates how to use the alternative breve note with two vertical lines on each side of the notehead instead of one line.

>     \relative c'' {
>       \time 4/2
>       \override Staff.NoteHead #'style = #'altdefault
>       c\breve | b\breve
>     }

Changing the number of augmentation dots per note

This code demonstrates how to change the number of augmentation dots on a single note.

>     \relative c' {
>       c4.. a16 r2 |
>       \override Dots #'dot-count = #4
>       c4.. a16 r2 |
>       \override Dots #'dot-count = #0
>       c4.. a16 r2 |
>       \revert Dots #'dot-count
>       c4.. a16 r2 |
>     }

#### See also

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

Notation Reference: Automatic beams, Ties, Stems, 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 }

Tuplet brackets may be manually placed above or below the staff; see Direction and placement.

Tuplets may be nested:

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

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.

Read the relevant sections of the Notation Reference for more information about `ly:make-moment`.

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

Changing the tuplet number

By default, only the numerator of the tuplet number is printed over the tuplet bracket, i.e., the 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 }
>     }

Non-default tuplet numbers

LilyPond also provides formatting functions to print tuplet numbers different than the actual fraction, as well as to append a note value to the tuplet number or tuplet fraction.

>     \relative c'' {
>       \once \override TupletNumber #'text =
>         #(tuplet-number::non-default-tuplet-denominator-text 7)
>       \times 2/3  { c4. c4. c4. c4. }
>       \once \override TupletNumber #'text =
>         #(tuplet-number::non-default-tuplet-fraction-text 12 7)
>       \times 2/3  { c4. c4. c4. c4. }
>       \once \override TupletNumber #'text =
>         #(tuplet-number::append-note-wrapper
>           (tuplet-number::non-default-tuplet-fraction-text 12 7) "8")
>       \times 2/3  { c4. c4. c4. c4. }

>       \once \override TupletNumber #'text =
>         #(tuplet-number::append-note-wrapper
>           tuplet-number::calc-denominator-text "4")
>       \times 2/3  { c8 c8 c8 c8 c8 c8 }
>       \once \override TupletNumber #'text =
>         #(tuplet-number::append-note-wrapper
>           tuplet-number::calc-fraction-text "4")
>       \times 2/3  { c8 c8 c8 c8 c8 c8 }

>       \once \override TupletNumber #'text =
>         #(tuplet-number::fraction-with-notes "4." "8")
>       \times 2/3  { c4. c4. c4. c4. }
>       \once \override TupletNumber #'text =
>         #(tuplet-number::non-default-fraction-with-notes 12 "8" 4 "4")
>       \times 2/3  { c4. c4. c4. c4. }
>     }

Controlling tuplet bracket visibility

The default behavior of tuplet-bracket visibility is to print a bracket unless there is a beam of the same length as the tuplet. To control the visibility of tuplet brackets, set the property `'bracket-visibility` to either `#t` (always print a bracket), `#f` (never print a bracket) or `#'if-no-beam` (only print a bracket if there is no beam).

>     music = \relative c'' {
>       \times 2/3 { c16[ d e } f8]
>       \times 2/3 { c8 d e }
>       \times 2/3 { c4 d e }
>     }

>     \new Voice {
>       \relative c' {
>         << \music s4^"default" >>
>         \override TupletBracket #'bracket-visibility = #'if-no-beam
>         << \music s4^"'if-no-beam" >>
>         \override TupletBracket #'bracket-visibility = ##t
>         << \music s4^"#t" >>
>         \override TupletBracket #'bracket-visibility = ##f
>         << \music s4^"#f" >>
>       }
>     }

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

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

Grace notes may be placed within tuplet brackets, except when a staff begins with a grace note followed by a tuplet. In this particular case, the grace note must be placed before the `\times` command to avoid errors.

When using a tuplet at the beginning of a piece with a `\tempo` mark, the music must be explicitly entered in a `\new Voice` block, as discussed in Voices contain music.

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

The duration of 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
>     }

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

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

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>

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

L.v. ties (laissez vibrer) indicate that notes must not be damped at the end. It is used in notation for piano, harp and other string and percussion instruments. They can be entered as follows:

>     <c f g>1\laissezVibrer

Ties may be manually placed above or below the staff; see Direction and placement.

Ties may be made dashed, dotted, or a combination of solid and dashed.

>     \tieDotted
>     c2 ~ c
>     \tieDashed
>     c2 ~ c
>     \tieHalfDashed
>     c2 ~ c
>     \tieHalfSolid
>     c2 ~ c
>     \tieSolid
>     c2 ~ c

Custom dash patterns can be specified:

>     \tieDashPattern #0.3 #0.75
>     c2 ~ c
>     \tieDashPattern #0.7 #1.5
>     c2 ~ c
>     \tieSolid
>     c2 ~ c

Dash pattern definitions for ties have the same structure as dash pattern definitions for slurs. For more information about complex dash patterns, see the snippets under Slurs.

#### Predefined commands

`\tieUp`, `\tieDown`, `\tieNeutral`, `\tieDotted`, `\tieDashed`, `\tieDashPattern`, `\tieHalfDashed`, `\tieHalfSolid`, `\tieSolid`.

#### Selected Snippets

Using ties with arpeggios

Ties are sometimes used to write out arpeggios. In this case, two tied notes need not be consecutive. This can be achieved by setting the `tieWaitForNote` property to `#t`. The same feature is also useful, for example, to tie a tremolo to a chord, but in principle, it can also be used for ordinary consecutive notes.

>     \relative c' {
>       \set tieWaitForNote = ##t
>       \grace { c16[ ~ e ~ g] ~ } <c, e g>2
>       \repeat tremolo 8 { c32 ~ c' ~ } <c c,>1
>       e8 ~ c ~ a ~ f ~ <e' c a f>2
>       \tieUp
>       c8 ~ a
>       \tieDown
>       \tieDotted
>       g8 ~ c g2
>     }

Engraving ties manually

Ties may be engraved manually by changing the `tie-configuration` property of the `TieColumn` object. The first number indicates the distance from the center of the staff in 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>2 ~ <c e g>
>     }

#### See also

Music Glossary: tie, laissez vibrer.

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

Andere talen: deutsch, español, français, 日本語.

#### LilyPond — Notation Reference