Next: , Previous: Durations, Up: Writing rhythms


1.2.1.2 Tuplets

Tuplets are made out of a music expression by multiplying all durations with a fraction:

\times fraction musicexpr

The duration of musicexpr 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 length 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]

Tuplets may be nested:

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

[image of music]

Predefined commands

\tupletUp, \tupletDown, \tupletNeutral.

Selected Snippets

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

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.

     
     \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 #'transparent = ##t
     \times 2/3 { c8 c c }

[image of music]

Tuplets may extend over bar lines, but they will inhibit a line break unless the Forbid_line_break_engraver is removed from the Voice context.

Modifying nested tuplets

If nested tuplets do not begin at the same moment their appearance may be modified in the usual way with \override commands:

     
     \times 2/3 { c8[ c c]}
     \once \override TupletNumber #'text = #tuplet-number::calc-fraction-text
     \times 2/3 {
       c[ c]
       c[ c]
       \once \override TupletNumber #'transparent = ##t
       \times 2/3 { c8[ c c] }
     \times 2/3 { c8[ c c]}
     }

[image of music]

However, if the nested tuplets begin at the same musical moment, \override commands cannot be applied to just one of them – they apply to both. So to change the appearance of nested tuplets beginning at the same musical moment individually, the \tweak function must be used (see Objects connected to the input). The \tweak function is applied to the following \times command as it appears in the input stream, and so can distinguish between separate \times commands even if their tuplets begin at the same musical moment.

In this example, the \tweak command is used to specify fraction text for the outer TupletNumber and denominator text for the TupletNumber of the first of the three inner tuplets.

     
     \tweak #'text #tuplet-number::calc-fraction-text
     \times 4/3 {
        \tweak #'text #tuplet-number::calc-denominator-text
        \times 2/3 { c8[ c8 c8] }
        \times 2/3 { c8[ c8 c8] }
        \times 2/3 { c8[ c8 c8] }
     }

[image of music]

In the next example, \tweak and \override work together to specify TupletBracket direction. The first \tweak positions the TupletBracket of the outer tuplet above the staff. The second \tweak positions the TupletBracket of the first of the three inner tuplets below the staff. Note that the \tweak command needs to be used only for events that begin at the same music moment: the outer tuplet and the first of the three inner tuplets. To position the TupletBrackets of the second and third of the inner tuplets below the staff, we can use \override in the usual way.

     
     \tweak #'text #tuplet-number::calc-fraction-text
     \tweak #'direction #up
     \times 4/3 {
        \tweak #'direction #down
        \times 2/3 { c8[ c8 c8] }
        \override TupletBracket #'direction = #down
        \times 2/3 { c8[ c8 c8] }
        \times 2/3 { c8[ c8 c8] }
     }

[image of music]

Modifying tuplet bracket length

Tuplet brackets can be made to run to prefatory matter or the next note. Default tuplet brackets end at the right edge of the final note of the tuplet; full-length tuplet brackets extend farther to the right, either to cover all the non-rhythmic notation up to the following note, or to cover only the whitespace before the next item of notation, be that a clef, time signature, key signature, or another note. The example shows how to switch tuplets to full length mode and how to modify what material they cover.

     
     \new RhythmicStaff {
       % Set tuplets to be extendable ..
       \set tupletFullLength = ##t
       % .. to cover all items up to the next note
       \set tupletFullLengthNote = ##t
       \time 2/4
       \times 2/3 { c4 c c }
       % .. or to cover just whitespace
       \set tupletFullLengthNote = ##f
       \time 4/4
       \times 4/5 { c4 c1 }
       \time 3/4
       c4
     }

[image of music]

Compressing music

\compressMusic works similarly to \times, but does not create a tuplet bracket. One application is in polymetric notation, as shown in the following example. See Polymetric notation.

See also

Music Glossary: triplet, tuplet, polymetric.

Notation Reference: Time administration, Objects connected to the input, Polymetric notation.

Snippets: Rhythms .

Internals Reference: TupletBracket, TupletNumber, TimeScaledMusic.

Known issues and warnings

Lines may be broken within a tuplet with \bar "" \break, but the tuplet bracket does not correctly carry over.


Next: , Previous: Durations, Up: Writing rhythms

This page is for LilyPond-2.11.40 (development-branch).

Report errors to http://post.gmane.org/post.php?group=gmane.comp.gnu.lilypond.bugs.

Your suggestions for the documentation are welcome.

Other languages: français, español, deutsch.