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


Durations occuring on their own within a music sequence will take their pitches from the preceding note or chord.

\time 8/1
c \longa \breve 1 2
4 8 16 32 64 128 128


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 notes

Breve notes are also available with two vertical lines on each side of the notehead instead of one line and in baroque style.

\relative c'' {
\time 4/2
c\breve |
b\breve
b\breve
a\breve
}


Changing the number of augmentation dots per note

The number of augmentation dots on a single note can be changed indepently of the dots placed after the note.

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


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 with the \tuplet command, multiplying the speed of the music expression by a fraction:

\tuplet fraction { music }


The fraction’s numerator will be printed over or under the notes, optionally with a bracket. The most common tuplets are triplets (3 notes sound within the duration normally allowed for 2).

a2 \tuplet 3/2 { b4 4 4 }
c4 c \tuplet 3/2 { b4 a g }


When entering long passages of tuplets, having to write a separate \tuplet command for each group is inconvenient. It is possible to specify the duration of one tuplet group directly before the music in order to have the tuplets grouped automatically:

g2 r8 \tuplet 3/2 8 { cis16 d e e f g g f e }


Tuplet brackets may be manually placed above or below the staff:

\tupletUp \tuplet 3/2 { c8 d e }
\tupletNeutral \tuplet 3/2 { c8 d e }
\tupletDown \tuplet 3/2 { f,8 g a }
\tupletNeutral \tuplet 3/2 { f8 g a }


Tuplets may be nested:

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


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

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 \tuplet command

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

There are several ways to set tupletSpannerDuration. The command \tupletSpan sets it to a given duration, and clears it when instead of a duration \default is specified. Another way is to use an optional argument with \tuplet.

\relative c' {
\time 2/4
\tupletSpan 4
\tuplet 3/2 { c8^"\\tupletSpan 4" c c c c c }
\tupletSpan \default
\tuplet 3/2 { c8^"\\tupletSpan \\default" c c c c c }
\tuplet 3/2 4 { c8^"\\tuplet 3/2 4 {...}" c c c c c }
}


Changing the tuplet number

By default, only the numerator of the tuplet number is printed over the tuplet bracket, i.e., the numerator of the argument to the \tuplet command.

Alternatively, num:den of the tuplet number may be printed, or the tuplet number may be suppressed altogether.

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


Non-default tuplet numbers

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

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


Controlling tuplet bracket visibility

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

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

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


Permitting line breaks within beamed tuplets

This artificial example shows how both manual and automatic line breaks may be permitted to within a beamed tuplet. Note that such off-beat tuplets have to be beamed manually.

\layout {
\context {
\Voice
% Permit line breaks within tuplets
\remove "Forbid_line_break_engraver"
% Allow beams to be broken at line breaks
\override Beam.breakable = ##t
}
}
\relative c'' {
a8
\repeat unfold 5 { \tuplet 3/2 { c[ b a] } }
% Insert a manual line break within a tuplet
\tuplet 3/2 { c[ b \bar "" \break a] }
\repeat unfold 5 { \tuplet 3/2 { c[ b a] } }
c8
}


Music Glossary: triplet, tuplet, polymetric.

Learning Manual: Tweaking methods.

Snippets: Rhythms.

Internals Reference: TupletBracket, TupletNumber, TimeScaledMusic.

#### Scaling durations

The duration of single notes, rests or chords may be multiplied by a fraction N/M by appending *N/M (or *N if M is 1) to the duration. 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 like *L*M/N. Factors are part of the duration: if a duration is not specified for subsequent notes, the default duration taken from the preceding note will include any scaling factor.

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

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


The duration of spacer rests may also be modified by a multiplier. This is useful for skipping many measures, e.g., s1*23.

Longer stretches of music may be compressed by a fraction in the same way, as if every note, chord or rest had the fraction as a multiplier. This leaves the appearance of the music unchanged but the internal duration of the notes will be multiplied by the fraction num/den. 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.

Notation Reference: Tuplets, Invisible rests, Polymetric notation.

Snippets: Rhythms.

#### Known issues and warnings

The calculation of the position within a measure must take into account all the scaling factors applied to the notes within that measure and any fractional carry-out from earlier measures. This calculation is carried out using rational numbers. If an intermediate numerator or denominator in that calculation exceeds 2^30 the execution and typesetting will stop at that point without indicating an error.

#### Ties

A tie connects two adjacent note heads of the same pitch. The tie in effect extends the duration of a note.

Note: Ties should not be confused with slurs, which indicate articulation, or phrasing slurs, which indicate musical phrasing. A tie is just a way of extending a note duration, similar to the augmentation dot.

A tie is entered by appending a tilde symbol (~) to the first of each pair of notes being tied. This indicates that the note should be tied to the following note, which must be at the same pitch.

a2~ 4~ 16 r r8


Ties can make use of the ‘last explicit pitch’ interpretation of isolated durations:

a2~ 4~ 16 r r8


Ties are used either when the note crosses a bar line, or when dots cannot be used to denote the rhythm. Ties should also be used when note values cross larger subdivisions of the measure:

\relative {
r8 c'~ 2 r4 |
r8^"not" c2~ 8 r4
}


If you need to tie many notes across bar lines, it may be easier to use automatic note splitting, see Automatic note splitting. This mechanism automatically splits long notes, and ties them across bar lines.

When a tie is applied to a chord, all note heads whose pitches match are connected. When no note heads match, no ties will be created. Chords may be partially tied by placing the ties inside the chord.

<c e g>2 ~ 2
<c e g>4~ <c e g c>
<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 made to curve up or down manually; see Direction and placement.

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

\tieDotted
c2~ 2
\tieDashed
c2~ 2
\tieHalfDashed
c2~ 2
\tieHalfSolid
c2~ 2
\tieSolid
c2~ 2


Custom dash patterns can be specified:

\tieDashPattern #0.3 #0.75
c2~ 2
\tieDashPattern #0.7 #1.5
c2~ 2
\tieSolid
c2~ 2


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

Override whiteout and layer layout properties for ties that collide with other objects in a staff.

\override Tie.layer = #-2
\override Staff.TimeSignature.layer = #-1
\override Staff.KeySignature.layer = #-1
\override Staff.TimeSignature.whiteout = ##t
\override Staff.KeySignature.whiteout = ##t
b2 b~
\time 3/4
\key a \major
b r4


#### Predefined commands

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

#### Selected Snippets

Using ties with arpeggios

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

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


Engraving ties manually

Ties may be engraved manually by changing the tie-configuration property of the TieColumn object. The first number indicates the distance from the center of the staff in half staff-spaces, and the second number indicates the direction (1 = up, -1 = down).

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


Music Glossary: tie, laissez vibrer.

Notation Reference: Slurs, Automatic note splitting.

Snippets: Expressive marks, Rhythms.

Internals Reference: LaissezVibrerTie, LaissezVibrerTieColumn, TieColumn, Tie.

#### Known issues and warnings

Switching staves when a tie is active will not produce a slanted tie.

Changing clefs or ottavations during a tie is not really well-defined. In these cases, a slur may be preferable.

Other languages: deutsch, español, français, italiano, 日本語.