[ << Pitches ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < ] | [ Up : Top ] | [ > ] |
Rhythms
These snippets illustrate the Notation Reference, section Rhythms.
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < Rhythms ] | [ Up : Rhythms ] | [ > ] |
Adding beams, slurs, ties etc. when using tuplet and non-tuplet rythms.
LilyPond syntax can involve many unusual placements for parentheses, brackets etc., which might sometimes have to be interleaved. For example, when entering a manual beam, the left square bracket has to be placed after the starting note and its duration, not before. Similarly, the right square bracket should directly follow the note which is to be at the end of the requested beaming, even if this note happens to be inside a tuplet section. This snippet demonstrates how to combine manual beaming, manual slurs, ties and phrasing slurs with tuplet sections (enclosed within curly braces).
{ r16[ g16 \times 2/3 { r16 e'8] } g16( a \times 2/3 { b d e') } g8[( a \times 2/3 { b d') e'] ~ } \time 2/4 \times 4/5 { e'32\( a b d' e' } a'4.\) }
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < ] | [ Up : Rhythms ] | [ > ] |
Adding drum parts
Using the powerful pre-configured tools such as the \drummode
function and the DrumStaff
context, inputting drum parts is
quite easy: drums are placed at their own staff positions (with a
special clef symbol) and have note heads according to the drum.
Attaching an extra symbol to the drum or restricting the number of
lines is possible.
drh = \drummode { cymc4.^"crash" hhc16^"h.h." hh hhc8 hho hhc8 hh16 hh hhc4 r4 r2 } drl = \drummode { bd4 sn8 bd bd4 << bd ss >> bd8 tommh tommh bd toml toml bd tomfh16 tomfh } timb = \drummode { timh4 ssh timl8 ssh r timh r4 ssh8 timl r4 cb8 cb } \score { << \new DrumStaff \with { drumStyleTable = #timbales-style \override StaffSymbol #'line-count = #2 \override BarLine #'bar-size = #2 } << \set Staff.instrumentName = #"timbales" \timb >> \new DrumStaff << \set Staff.instrumentName = #"drums" \new DrumVoice { \stemUp \drh } \new DrumVoice { \stemDown \drl } >> >> \layout { } \midi { \context { \Score tempoWholesPerMinute = #(ly:make-moment 120 4) } } }
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < ] | [ Up : Rhythms ] | [ > ] |
Automatic beam subdivisions
Beams can be subdivided automatically. By setting the property
subdivideBeams
, beams are subdivided at beat positions (as
specified in beatLength
).
\new Staff { \relative c'' { << { \voiceOne \set subdivideBeams = ##t b32[ a g f c' b a g b32^"subdivide beams" a g f c' b a g] } \new Voice { \voiceTwo b32_"default"[ a g f c' b a g b32 a g f c' b a g] } >> \oneVoice \set beatLength = #(ly:make-moment 1 8) b32^"beatLength 1 8"[ a g f c' b a g] \set beatLength = #(ly:make-moment 1 16) b32^"beatLength 1 16"[ a g f c' b a g] } }
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < ] | [ Up : Rhythms ] | [ > ] |
Automatic beams two per two in 4/4 or 2/2 time signature
In a simple time signature of 2/2 or 4/4, 8th notes are beamed by default as two sets of four.
Using a macro which overrides the autobeaming behavior, this snippet changes the beaming to quarter note beats.
% Automatic beams two per two in 4/4 or 2/2 time signature % _____ % Default | | | | % _ _ % Required | | | | % macro for beamed two per two in 2/2 and 4/4 time signature qBeam = { #(override-auto-beam-setting '(end 1 8 * *) 1 4 'Staff) #(override-auto-beam-setting '(end 1 8 * *) 2 4 'Staff) #(override-auto-beam-setting '(end 1 8 * *) 3 4 'Staff) } \score { << \new Staff { \relative c'' { \time 4/4 g8-"without the macro" g g g g g g g g8 g g g4 g8 g g } } %Use the macro \new Staff { \relative c'' { \time 4/4 \qBeam g8-"with the macro" g g g g g g g g8 g g g4 g8 g g } } >> \layout { \context { \Staff \override TimeSignature #'style = #'() } } }
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < ] | [ Up : Rhythms ] | [ > ] |
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 }
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < ] | [ Up : Rhythms ] | [ > ] |
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 } >> } >> }
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < ] | [ Up : Rhythms ] | [ > ] |
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 }
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < ] | [ Up : Rhythms ] | [ > ] |
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 }
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < ] | [ Up : Rhythms ] | [ > ] |
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 }
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < ] | [ Up : Rhythms ] | [ > ] |
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 }
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < ] | [ Up : Rhythms ] | [ > ] |
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 }
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < ] | [ Up : Rhythms ] | [ > ] |
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 }
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < ] | [ Up : Rhythms ] | [ > ] |
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 } }
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < ] | [ Up : Rhythms ] | [ > ] |
Changing time signatures inside a polymetric section using \scaleDurations
The measureLength
property, together with
measurePosition
, determines when a bar line is needed. However,
when using \scaleDurations
, the scaling of durations makes it
difficult to change time signatures. In this case, measureLength
should be set manually, using the ly:make-moment
callback. The
second argument must be the same as the second argument of
\scaleDurations
.
\layout { \context { \Score \remove "Timing_translator" \remove "Default_bar_line_engraver" } \context { \Staff \consists "Timing_translator" \consists "Default_bar_line_engraver" } } << \new Staff { \scaleDurations #'(8 . 5) { \time 6/8 \set Timing.measureLength = #(ly:make-moment 6 5) b8 b b b b b \time 2/4 \set Timing.measureLength = #(ly:make-moment 4 5) b4 b } } \new Staff { \clef bass \time 2/4 c2 d e f } >>
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < ] | [ Up : Rhythms ] | [ > ] |
Chant or psalms notation
This form of notation is used for the chant of the Psalms, where verses aren’t always the same length.
stemOn = { \revert Staff.Stem #'transparent } stemOff = { \override Staff.Stem #'transparent = ##t } \score { \new Staff \with { \remove "Time_signature_engraver" } { \key g \minor \cadenzaOn \stemOff a'\breve bes'4 g'4 \stemOn a'2 \bar "||" \stemOff a'\breve g'4 a'4 \stemOn f'2 \bar "||" \stemOff a'\breve^\markup { \italic flexe } \stemOn g'2 \bar "||" } }
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < ] | [ Up : Rhythms ] | [ > ] |
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 }
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < ] | [ Up : Rhythms ] | [ > ] |
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" } } }
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < ] | [ Up : Rhythms ] | [ > ] |
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" >> } }
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < ] | [ Up : Rhythms ] | [ > ] |
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> }
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < ] | [ Up : Rhythms ] | [ > ] |
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 } }
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < ] | [ Up : Rhythms ] | [ > ] |
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 } >> }
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < ] | [ Up : Rhythms ] | [ > ] |
Forcing rehearsal marks to start from a given letter or number
This snippet demonstrates how to obtain automatic ordered rehearsal marks, but from the letter or number desired.
\relative c''{ c1 \mark \default c1 \mark \default c1 \mark \default c1 \mark #14 c1 \mark \default c1 \mark \default c1 \mark \default c1 \mark \default \break \set Score.markFormatter = #format-mark-numbers c1 \mark #1 c1 \mark \default c1 \mark \default c1 \mark \default c1 \mark #14 c1 \mark \default c1 \mark \default c1 \mark \default c1 \mark \default }
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < ] | [ Up : Rhythms ] | [ > ] |
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 }
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < ] | [ Up : Rhythms ] | [ > ] |
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. } } >>
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < ] | [ Up : Rhythms ] | [ > ] |
Heavily customized polymetric time signatures
Though the polymetric time signature shown was not the most essential item here, it has been included to show the beat of this piece (which is the template of a real Balkan song!).
#(define plus (markup #:vcenter "+")) #(define ((custom-time-signature one two three four five six seven eight nine ten eleven num) grob) (grob-interpret-markup grob (markup #:override '(baseline-skip . 0) #:number (#:line ( (#:column (one num)) plus (#:column (two num)) plus (#:column (three num)) plus (#:column (four num)) plus (#:column (five num)) plus (#:column (six num)) plus (#:column (seven num)) plus (#:column (eight num)) plus (#:column (nine num)) plus (#:column (ten num)) plus (#:column (eleven num)))) ))) melody = \relative c'' { \set Staff.instrumentName = #"Bb Sop." \key g \major #(set-time-signature 25 8 '(3 2 2 3 2 2 2 2 3 2 2)) \override Staff.TimeSignature #'stencil = #(custom-time-signature "3" "2" "2" "3" "2" "2" "2" "2" "3" "2" "2" "8") c8 c c d4 c8 c b c b a4 g fis8 e d c b' c d e4-^ fis8 g \break c,4. d4 c4 d4. c4 d c2 d4. e4-^ d4 c4. d4 c4 d4. c4 d c2 d4. e4-^ d4 \break c4. d4 c4 d4. c4 d c2 d4. e4-^ d4 c4. d4 c4 d4. c4 d c2 d4. e4-^ d4 \break } drum = \new DrumStaff \drummode { \bar "|:" bd4.^\markup { "Drums" } sn4 bd \bar ":" sn4. bd4 sn \bar ":" bd sn bd4. sn4 bd \bar ":|" } { \melody \drum }
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < ] | [ Up : Rhythms ] | [ > ] |
Making an object invisible with the transparent property
Setting the 'transparent
property will cause an object to be
printed in "invisible ink": the object is not printed, but all its
other behavior is retained. The object still takes up space, it takes
part in collisions, and slurs, ties and beams can be attached to it.
This snippet demonstrates how to connect different voices using ties. Normally, ties only connect two notes in the same voice. By introducing a tie in a different voice, and blanking the first up-stem in that voice, the tie appears to cross voices. To prevent the blanked stem’s flag from interfering with tie positioning, the stem is extended.
\relative c'' { \time 2/4 << { \once \override Stem #'transparent = ##t \once \override Stem #'length = #8 b8 ~ b\noBeam \once \override Stem #'transparent = ##t \once \override Stem #'length = #8 g8 ~ g\noBeam } \\ { b8 g g e } >> }
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < ] | [ Up : Rhythms ] | [ > ] |
Manually controlling beam positions
Beam positions may be controlled manually, by overriding the
positions
setting of the Beam
grob.
\relative c' { \time 2/4 % from upper staff-line (position 2) to center (position 0) \override Beam #'positions = #'(2 . 0) c8 c % from center to one above center (position 1) \override Beam #'positions = #'(0 . 1) c8 c }
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < ] | [ Up : Rhythms ] | [ > ] |
Merging multi-measure rests in a polyphonic part
When using multi-measure rests in a polyphonic staff, the rests will be placed differently depending on the voice they belong to. However they can be printed on the same staff line, using the following setting.
normalPos = \revert MultiMeasureRest #'staff-position { << { c''1 R1 c''1 \normalPos R1 } \\ { c'1 R1 c'1 \normalPos R1 } >> }
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < ] | [ Up : Rhythms ] | [ > ] |
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 c2. }
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < ] | [ Up : Rhythms ] | [ > ] |
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 }
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < ] | [ Up : Rhythms ] | [ > ] |
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 }
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < ] | [ Up : Rhythms ] | [ > ] |
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 } >> }
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < ] | [ Up : Rhythms ] | [ > ] |
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 }
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < ] | [ Up : Rhythms ] | [ > ] |
Printing music with different time signatures
In the following snippet, two parts have a completely different time
signature, yet remain synchronized. The bar lines can no longer be
printed at the Score
level; to allow independent bar lines in
each part, the Default_barline_engraver
and
Timing_translator
are moved from the Score
context to the
Staff
context.
\paper { indent = #0 ragged-right = ##t } global = { \time 3/4 { s2.*3 } \bar "" \break { s2.*3 } } \layout { \context { \Score \remove "Timing_translator" \remove "Time_signature_engraver" \remove "Default_bar_line_engraver" \override SpacingSpanner #'uniform-stretching = ##t \override SpacingSpanner #'strict-note-spacing = ##t proportionalNotationDuration = #(ly:make-moment 1 64) } \context { \Staff \consists "Timing_translator" \consists "Default_bar_line_engraver" \consists "Time_signature_engraver" } \context { \Voice \remove "Forbid_line_break_engraver" tupletFullLength = ##t } } Bassklarinette = \new Staff << \global { \bar "|" \clef treble \time 3/8 d''4. \bar "|" \time 3/4 r8 des''2( c''8) \bar "|" \time 7/8 r4. ees''2 ~ \bar "|" \time 2/4 \tupletUp \times 2/3 { ees''4 r4 d''4 ~ } \bar "|" \time 3/8 \tupletUp \times 3/4 { d''4 r4 } \bar "|" \time 2/4 e''2 \bar "|" \time 3/8 es''4. \bar "|" \time 3/4 r8 d''2 r8 \bar "|" } >> Perkussion = \new StaffGroup << \new Staff << \global { \bar "|" \clef percussion \time 3/4 r4 c'2 ~ \bar "|" c'2. \bar "|" R2. \bar "|" r2 g'4 ~ \bar "|" g'2. ~ \bar "|" g'2. } >> \new Staff << \global { \bar "|" \clef percussion \time 3/4 R2. \bar "|" g'2. ~ \bar "|" g'2. \bar "|" r4 g'2 ~ \bar "|" g'2 r4 \bar "|" g'2. } >> >> \score { << \Bassklarinette \Perkussion >> }
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < ] | [ Up : Rhythms ] | [ > ] |
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 }
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < ] | [ Up : Rhythms ] | [ > ] |
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 }
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < ] | [ Up : Rhythms ] | [ > ] |
Rhythmic slashes
In "simple" lead-sheets, sometimes no actual notes are written,
instead only "rhythmic patterns" and chords above the measures are
notated giving the structure of a song. Such a feature is for example
useful while creating/transcribing the structure of a song and also
when sharing lead sheets with guitarists or jazz musicians. The
standard support for this using \repeat percent
is unsuitable
here since the first beat has to be an ordinary note or rest. This
example shows two solutions to this problem, by redefining ordinary
rests to be printed as slashes. (If the duration of each beat is not a
quarter note, replace the r4
in the definitions with a rest of
the appropriate duration).
% Macro to print single slash rs = { \once \override Rest #'stencil = #ly:percent-repeat-item-interface::beat-slash \once \override Rest #'thickness = #0.48 \once \override Rest #'slope = #1.7 r4 } % Function to print a specified number of slashes comp = #(define-music-function (parser location count) ( integer?) #{ \override Rest #'stencil = #ly:percent-repeat-item-interface::beat-slash \override Rest #'thickness = #0.48 \override Rest #'slope = #1.7 \repeat unfold $count { r4 } \revert Rest #'stencil #} ) \score { \relative c' { c4 d e f | \rs \rs \rs \rs | \comp #4 | } }
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < ] | [ Up : Rhythms ] | [ > ] |
Skips in lyric mode (2)
Although s
skips cannot be used in \lyricmode
(it is
taken to be a literal "s", not a space), double quotes (""
)
or underscores (_
) are available.So for example:
<< \relative c'' { a4 b c d } \new Lyrics \lyricmode { a4 "" _ gap } >>
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < ] | [ Up : Rhythms ] | [ > ] |
Skips in lyric mode
The s
syntax for skips is only available in note mode and chord
mode. In other situations, for example, when entering lyrics, using the
\skip
command is recommended.
<< \relative { a'1 a } \new Lyrics \lyricmode { \skip 1 bla1 } >>
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < ] | [ Up : Rhythms ] | [ > ] |
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 } } >> }
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < ] | [ Up : Rhythms ] | [ > ] |
Stemlets
In some notational conventions beams are allowed to extend over rests. Depending on preference, these beams may drop ’stemlets’ to help the eye appreciate the rhythm better, and in some modern music the rest itself is omitted and only the stemlet remains.
This snippet shows a progression from traditional notation, to beams
over the rest, to stemlets over the rest, to stemlets alone. Stemlets
are generated by overriding the 'stemlet-length
property of
Stem
, while rests are hidden by setting 'transparent =
##t
.
Some \markup
elements are included in the source to highlight
the different notations.
\paper { ragged-right = ##f } { c'16^\markup { traditional } d' r f' g'16[^\markup { beams over rests } f' r d'] % N.B. use Score.Stem to set for the whole score. \override Staff.Stem #'stemlet-length = #0.75 c'16[^\markup { stemlets over rests } d' r f'] g'16[^\markup { stemlets and no rests } f' \once \override Rest #'transparent = ##t r d'] }
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < ] | [ Up : Rhythms ] | [ > ] |
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] }
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < ] | [ Up : Rhythms ] | [ > ] |
Three-sided box
This example shows how to add a markup command to get a three sided box around some text (or other markup).
% New command to add a three sided box, with sides north, west and south % Based on the box-stencil command defined in scm/stencil.scm % Note that ";" is used to comment a line in Scheme #(define-public (NWS-box-stencil stencil thickness padding) "Add a box around STENCIL, producing a new stencil." (let* ((x-ext (interval-widen (ly:stencil-extent stencil 0) padding)) (y-ext (interval-widen (ly:stencil-extent stencil 1) padding)) (y-rule (make-filled-box-stencil (cons 0 thickness) y-ext)) (x-rule (make-filled-box-stencil (interval-widen x-ext thickness) (cons 0 thickness)))) ; (set! stencil (ly:stencil-combine-at-edge stencil X 1 y-rule padding)) (set! stencil (ly:stencil-combine-at-edge stencil X -1 y-rule padding)) (set! stencil (ly:stencil-combine-at-edge stencil Y 1 x-rule 0.0)) (set! stencil (ly:stencil-combine-at-edge stencil Y -1 x-rule 0.0)) stencil)) % The corresponding markup command, based on the \box command defined % in scm/define-markup-commands.scm #(define-markup-command (NWS-box layout props arg) (markup?) "Draw a box round @var{arg}. Looks at @code{thickness}, @code{box-padding} and @code{font-size} properties to determine line thickness and padding around the markup." (let* ((th (chain-assoc-get 'thickness props 0.1)) (size (chain-assoc-get 'font-size props 0)) (pad (* (magstep size) (chain-assoc-get 'box-padding props 0.2))) (m (interpret-markup layout props arg))) (NWS-box-stencil m th pad))) % Test it: \layout { ragged-right = ##f } \relative c' { c2^\markup { \NWS-box ABCD } c2^\markup { \NWS-box \note #"4" #1.0 } }
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < ] | [ Up : Rhythms ] | [ > ] |
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 }
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < ] | [ Up : Rhythms ] | [ Expressive marks > ] |
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 }
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < ] | [ Up : Rhythms ] | [ Expressive marks > ] |