Rhythms
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < Rhythms ] | [ Up : Rhythms ] | [ Rhythms: Adding drum parts > ] |
Adding beams slurs ties etc. when using tuplet and non-tuplet rhythms
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 \tuplet 3/2 { r16 e'8] } g16( a \tuplet 3/2 { b d e') } g8[( a \tuplet 3/2 { b d') e'] ~ } \time 2/4 \tuplet 5/4 { e'32\( a b d' e' } a'4.\) }
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.
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 { instrumentName = #"timbales" drumStyleTable = #timbales-style \override StaffSymbol.line-count = #2 \override BarLine.bar-extent = #'(-1 . 1) } << \timb >> \new DrumStaff \with { instrumentName = #"drums" } << \new DrumVoice { \stemUp \drh } \new DrumVoice { \stemDown \drl } >> >> \layout { } \midi { \tempo 4 = 120 } }
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < Rhythms: Adding drum parts ] | [ Up : Rhythms ] | [ Rhythms: Aligning bar numbers > ] |
Adjusting grace note spacing
The space given to grace notes can be adjusted using the
spacing-increment
property of Score.GraceSpacing
.
graceNotes = { \grace { c4 c8 c16 c32 } c8 } \relative c'' { c8 \graceNotes \override Score.GraceSpacing.spacing-increment = #2.0 \graceNotes \revert Score.GraceSpacing.spacing-increment \graceNotes }
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < Rhythms: Adjusting grace note spacing ] | [ Up : Rhythms ] | [ Rhythms: Alternative breve notes > ] |
Aligning bar numbers
Bar numbers by default are right-aligned to their parent object. This is usually the left edge of a line or, if numbers are printed within a line, the left hand side of a bar line. The numbers may also be positioned directly over the bar line or left-aligned to the bar line.
\relative c' { \set Score.currentBarNumber = #111 \override Score.BarNumber.break-visibility = #all-visible % 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 = #CENTER c1 | c1 % Left-align bar numbers \override Score.BarNumber.self-alignment-X = #LEFT c1 | c1 }
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < Rhythms: Aligning bar numbers ] | [ Up : Rhythms ] | [ Rhythms: Automatic beam subdivisions > ] |
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 | \override Staff.NoteHead.style = #'altdefault b\breve \override Staff.NoteHead.style = #'baroque b\breve \revert Staff.NoteHead.style a\breve }
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < Rhythms: Alternative breve notes ] | [ Up : Rhythms ] | [ Rhythms: Automatically change durations > ] |
Automatic beam subdivisions
Beams can be subdivided automatically. By setting the property
subdivideBeams
, beams are subdivided at beat positions (as
specified in baseMoment
).
\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 baseMoment = #(ly:make-moment 1/8) \set beatStructure = 2,2,2,2 b32^"baseMoment 1 8"[ a g f c' b a g] \set baseMoment = #(ly:make-moment 1/16) \set beatStructure = 4,4,4,4 b32^"baseMoment 1 16"[ a g f c' b a g] } }
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < Rhythms: Automatic beam subdivisions ] | [ Up : Rhythms ] | [ Rhythms: Avoiding collisions with chord fingerings > ] |
Automatically change durations
shiftDurations
can be used to change the note lengths of a piece
of music. It takes two arguments - the scaling factor as a power of
two, and the number of dots to be added as a positive integer.
\paper { indent = 0 } music = \relative c'' { a1 b2 c4 d8 r } \score { \new Voice { \time 4/2 \music \time 4/4 \shiftDurations #1 #0 { \music } \time 2/4 \shiftDurations #2 #0 { \music } \time 4/1 \shiftDurations #-1 #0 { \music } \time 8/1 \shiftDurations #-2 #0 { \music } \time 6/2 \shiftDurations #0 #1 { \music } \time 7/2 \shiftDurations #0 #2 { \music } } }
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < Rhythms: Automatically change durations ] | [ Up : Rhythms ] | [ Rhythms: Beam endings in Score context > ] |
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 % No tweak needed r8 <f c'-5>8 <f c'\5>8 % Corrected to avoid collisions \override StrokeFinger.add-stem-support = ##t <f c'-\rightHandFinger #2 >8 }
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < Rhythms: Avoiding collisions with chord fingerings ] | [ Up : Rhythms ] | [ Rhythms: Beams across line breaks > ] |
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 \set Score.baseMoment = #(ly:make-moment 1/8) \set Score.beatStructure = 3,4,3 << \new Staff { c8 c c c c c c c c c } \new Staff { % Modify beaming for just this staff \set Staff.beatStructure = 6,4 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 \set Voice.beatStructure = 6,4 a8 a a a a a a a a a } >> } >> }
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < Rhythms: Beam endings in Score context ] | [ Up : Rhythms ] | [ Rhythms: Changing beam knee gap > ] |
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 >> ] | ||
[ < Rhythms: Beams across line breaks ] | [ Up : Rhythms ] | [ Rhythms: Changing form of multi-measure rests > ] |
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 >> ] | ||
[ < Rhythms: Changing beam knee gap ] | [ Up : Rhythms ] | [ Rhythms: Changing the number of augmentation dots per note > ] |
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'' { \compressMMRests { R1*2 | R1*5 | R1*9 \override MultiMeasureRest.expand-limit = #3 R1*2 | R1*5 | R1*9 } }
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < Rhythms: Changing form of multi-measure rests ] | [ Up : Rhythms ] | [ Rhythms: Changing the tempo without a metronome mark > ] |
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 | }
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < Rhythms: Changing the number of augmentation dots per note ] | [ Up : Rhythms ] | [ Rhythms: Changing the tuplet number > ] |
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 { } }
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 } }
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < Rhythms: Changing the tuplet number ] | [ Up : Rhythms ] | [ Rhythms: Chant or psalms notation > ] |
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 } >>
Chant or psalms notation
This form of notation is used for Psalm chant, where verses aren’t always the same length.
stemOff = \hide Staff.Stem stemOn = \undo \stemOff \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 >> ] | ||
[ < Rhythms: Chant or psalms notation ] | [ Up : Rhythms ] | [ Rhythms: Conducting signs measure grouping signs > ] |
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.
\relative c' { \compoundMeter #'((2 8) (3 8)) c8 d e fis gis c8 fis, gis e d c8 d e4 gis8 }
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < Rhythms: Compound time signatures ] | [ Up : Rhythms ] | [ Rhythms: Consistently left aligned bar numbers > ] |
Conducting signs measure grouping signs
Beat grouping within a measure is controlled by the context property
beatStructure
. Values of beatStructure
are established
for many time signatures in scm/time-signature-settings.scm
.
Values of beatStructure
can be changed or set with \set
.
Alternatively, \time
can be used to both set the time signature
and establish the beat structure. For this, you specify the internal
grouping of beats in a measure as a list of numbers (in Scheme syntax)
before the time signature.
\time
applies to the Timing
context, so it will not
reset values of beatStructure
or baseMoment
that are set
in other lower-level contexts, such as Voice
.
If the Measure_grouping_engraver
is included in one of the
display contexts, measure grouping signs will be created. Such signs
ease reading rhythmically complex modern music. In the example, the 9/8
measure is grouped in two different patterns using the two different
methods, while the 5/8 measure is grouped according to the default
setting in scm/time-signature-settings.scm
:
\score { \new Voice \relative c'' { \time 9/8 g8 g d d g g a( bes g) | \set Timing.beatStructure = 2,2,2,3 g8 g d d g g a( bes g) | \time 4,5 9/8 g8 g d d g g a( bes g) | \time 5/8 a4. g4 | } \layout { \context { \Staff \consists "Measure_grouping_engraver" } } }
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < Rhythms: Conducting signs measure grouping signs ] | [ Up : Rhythms ] | [ Rhythms: Controlling tuplet bracket visibility > ] |
Consistently left aligned bar numbers
When left aligning bar numbers, overlapping problems may occur with Staves brackets. The snippet solves this by keeping right aligned the first bar number following line breaks.
consistentlyLeftAlignedBarNumbers = { \override Score.BarNumber.break-visibility = #end-of-line-invisible \override Score.BarNumber.self-alignment-X = #(lambda (grob) (let ((break-dir (ly:item-break-dir grob))) (if (= break-dir RIGHT) RIGHT LEFT))) } \new ChoirStaff << \new Staff { \relative c' { \set Score.barNumberVisibility = #(every-nth-bar-number-visible 3) \bar "" \consistentlyLeftAlignedBarNumbers \set Score.currentBarNumber = #112 \repeat unfold 8 { R1 } \break \repeat unfold 9 { R1 } \break \repeat unfold 7 { R1 } } } \new Staff { \relative c' { \repeat unfold 24 { R1 } } } >> \layout { indent = #0 ragged-right = ##t ragged-last = ##t }
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < Rhythms: Consistently left aligned bar numbers ] | [ Up : Rhythms ] | [ Rhythms: Creating metronome marks in markup mode > ] |
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" >> } }
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < Rhythms: Controlling tuplet bracket visibility ] | [ Up : Rhythms ] | [ Rhythms: Engraving ties manually > ] |
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 }
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < Rhythms: Creating metronome marks in markup mode ] | [ Up : Rhythms ] | [ Rhythms: Engraving tremolos with floating beams > ] |
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> }
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < Rhythms: Engraving ties manually ] | [ Up : Rhythms ] | [ Rhythms: Entering several tuplets using only one \tuplet command > ] |
Engraving tremolos with floating beams
If a tremolo’s total duration is less than a quarter-note, or exactly a
half-note, or between a half-note and a whole-note, it is normally
typeset with all beams touching the stems. Certain engraving styles
typeset some of these beams as centered floating beams that do not
touch the stems. The number of floating beams in this type of tremolo
is controlled with the 'gap-count
property of the Beam
object, and the size of the gaps between beams and stems is set with
the 'gap
property.
\relative c'' { \repeat tremolo 8 { a32 f } \override Beam.gap-count = #1 \repeat tremolo 8 { a32 f } \override Beam.gap-count = #2 \repeat tremolo 8 { a32 f } \override Beam.gap-count = #3 \repeat tremolo 8 { a32 f } \override Beam.gap-count = #3 \override Beam.gap = #1.33 \repeat tremolo 8 { a32 f } \override Beam.gap = #1 \repeat tremolo 8 { a32 f } \override Beam.gap = #0.67 \repeat tremolo 8 { a32 f } \override Beam.gap = #0.33 \repeat tremolo 8 { a32 f } }
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < Rhythms: Engraving tremolos with floating beams ] | [ Up : Rhythms ] | [ Rhythms: Flat flags and beam nibs > ] |
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 } }
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
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 16[] } % Example 3 \new RhythmicStaff { 16 16 \set stemRightBeamCount = #2 16 r r \set stemLeftBeamCount = #2 16 16 16 } % Example 4 \new RhythmicStaff { 16 16 \set stemRightBeamCount = #2 16 r16 16[] r16 \set stemLeftBeamCount = #2 16 16 } >> }
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < Rhythms: Flat flags and beam nibs ] | [ Up : Rhythms ] | [ Rhythms: Generating custom flags > ] |
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 \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 }
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < Rhythms: Forcing rehearsal marks to start from a given letter or number ] | [ Up : Rhythms ] | [ Rhythms: Guitar strum rhythms > ] |
Generating custom flags
The stencil
property of the Flag
grob can be set to a
custom scheme function to generate the glyph for the flag.
#(define-public (weight-flag grob) (let* ((stem-grob (ly:grob-parent grob X)) (log (- (ly:grob-property stem-grob 'duration-log) 2)) (is-up? (eqv? (ly:grob-property stem-grob 'direction) UP)) (yext (if is-up? (cons (* log -0.8) 0) (cons 0 (* log 0.8)))) (flag-stencil (make-filled-box-stencil '(-0.4 . 0.4) yext)) (stroke-style (ly:grob-property grob 'stroke-style)) (stroke-stencil (if (equal? stroke-style "grace") (make-line-stencil 0.2 -0.9 -0.4 0.9 -0.4) empty-stencil))) (ly:stencil-add flag-stencil stroke-stencil))) % Create a flag stencil by looking up the glyph from the font #(define (inverted-flag grob) (let* ((stem-grob (ly:grob-parent grob X)) (dir (if (eqv? (ly:grob-property stem-grob 'direction) UP) "d" "u")) (flag (retrieve-glyph-flag "" dir "" grob)) (line-thickness (ly:staff-symbol-line-thickness grob)) (stem-thickness (ly:grob-property stem-grob 'thickness)) (stem-width (* line-thickness stem-thickness)) (stroke-style (ly:grob-property grob 'stroke-style)) (stencil (if (null? stroke-style) flag (add-stroke-glyph flag stem-grob dir stroke-style ""))) (rotated-flag (ly:stencil-rotate-absolute stencil 180 0 0))) (ly:stencil-translate rotated-flag (cons (- (/ stem-width 2)) 0)))) snippetexamplenotes = { \autoBeamOff c'8 d'16 c'32 d'64 \acciaccatura {c'8} d'64 } { \override Score.RehearsalMark.self-alignment-X = #LEFT \time 1/4 \mark "Normal flags" \snippetexamplenotes \mark "Custom flag: inverted" \override Flag.stencil = #inverted-flag \snippetexamplenotes \mark "Custom flag: weight" \override Flag.stencil = #weight-flag \snippetexamplenotes \mark "Revert to normal" \revert Flag.stencil \snippetexamplenotes }
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < Rhythms: Generating custom flags ] | [ Up : Rhythms ] | [ Rhythms: Heavily customized polymetric time signatures > ] |
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 >> ] | ||
[ < Rhythms: Guitar strum rhythms ] | [ Up : Rhythms ] | [ Rhythms: Making an object invisible with the 'transparent property > ] |
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!).
drum = \new DrumStaff \drummode { \bar ".|:" bd4.^\markup { Drums } sn4 bd \bar ";" sn4. bd4 sn \bar ";" bd sn bd4. sn4 bd \bar ":|." } \new Staff \with { instrumentName = \markup { \concat { "B" \flat " Sop." } } } { \melody \drum }
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < Rhythms: Heavily customized polymetric time signatures ] | [ Up : Rhythms ] | [ Rhythms: Making slurs with complex dash structure > ] |
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.
\relative { \time 2/4 << { \once \hide Stem \once \override Stem.length = #8 b'8 ~ 8\noBeam \once \hide Stem \once \override Stem.length = #8 g8 ~ 8\noBeam } \\ { b8 g g e } >> }
Making slurs with complex dash structure
Slurs can be made with complex dash patterns by defining the
dash-definition
property. dash-definition
is a list of
dash-elements
. A dash-element
is a list of parameters
defining the dash behavior for a segment of the slur.
The slur is defined in terms of the bezier parameter t which ranges
from 0 at the left end of the slur to 1 at the right end of the slur.
dash-element
is a list (start-t stop-t dash-fraction
dash-period)
. The region of the slur from start-t
to
stop-t
will have a fraction dash-fraction
of each
dash-period
black. dash-period
is defined in terms of
staff spaces. dash-fraction
is set to 1 for a solid slur.
\relative c' { \once \override Slur.dash-definition = #'((0 0.3 0.1 0.75) (0.3 0.6 1 1) (0.65 1.0 0.4 0.75)) c4( d e f) \once \override Slur.dash-definition = #'((0 0.25 1 1) (0.3 0.7 0.4 0.75) (0.75 1.0 1 1)) c4( d e f) }
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < Rhythms: Making slurs with complex dash structure ] | [ Up : Rhythms ] | [ Rhythms: Merging multi-measure rests in a polyphonic part > ] |
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 >> ] | ||
[ < Rhythms: Manually controlling beam positions ] | [ Up : Rhythms ] | [ Rhythms: Modifying tuplet bracket length > ] |
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.direction { << { c''1 R1 c''1 \normalPos R1 } \\ { c'1 R1 c'1 \normalPos R1 } >> }
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < Rhythms: Merging multi-measure rests in a polyphonic part ] | [ Up : Rhythms ] | [ Rhythms: Moving dotted notes in polyphony > ] |
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 \tuplet 3/2 { c4 4 4 } % ...or to cover just whitespace \set tupletFullLengthNote = ##f \time 4/4 \tuplet 5/4 { 4 1 } \time 3/4 2. }
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < Rhythms: Modifying tuplet bracket length ] | [ Up : Rhythms ] | [ Rhythms: Multi-measure rest markup > ] |
Moving dotted notes in polyphony
When a dotted note in the upper voice is moved to avoid a collision
with a note in another voice, the default is to move the upper note to
the right. This behaviour can be over-ridden by using the
prefer-dotted-right
property of NoteCollision
.
\new Staff \relative c' << { f2. f4 \override Staff.NoteCollision.prefer-dotted-right = ##f f2. f4 \override Staff.NoteCollision.prefer-dotted-right = ##t f2. f4 } \\ { e4 e e e e e e e e e e e } >>
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < Rhythms: Moving dotted notes in polyphony ] | [ Up : Rhythms ] | [ Rhythms: Non-default tuplet numbers > ] |
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 an empty chord with an attached markup before the multi-measure rest.
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' { \compressMMRests { \textLengthOn <>^\markup { [MAJOR GENERAL] } R1*19 <>_\markup { \italic { Cue: ... it is yours } } <>^\markup { A } R1*30^\markup { [MABEL] } \textLengthOff c4^\markup { CHORUS } d f c } }
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < Rhythms: Multi-measure rest markup ] | [ Up : Rhythms ] | [ Rhythms: Partcombine and autoBeamOff > ] |
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) (ly:make-duration 3 0)) \tuplet 3/2 { c4. c4. c4. c4. } \once \override TupletNumber.text = #(tuplet-number::append-note-wrapper tuplet-number::calc-denominator-text (ly:make-duration 2 0)) \tuplet 3/2 { c8 c8 c8 c8 c8 c8 } \once \override TupletNumber.text = #(tuplet-number::append-note-wrapper tuplet-number::calc-fraction-text (ly:make-duration 2 0)) \tuplet 3/2 { c8 c8 c8 c8 c8 c8 } \once \override TupletNumber.text = #(tuplet-number::fraction-with-notes (ly:make-duration 2 1) (ly:make-duration 3 0)) \tuplet 3/2 { c4. c4. c4. c4. } \once \override TupletNumber.text = #(tuplet-number::non-default-fraction-with-notes 12 (ly:make-duration 3 0) 4 (ly:make-duration 2 0)) \tuplet 3/2 { c4. c4. c4. c4. } }
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < Rhythms: Non-default tuplet numbers ] | [ Up : Rhythms ] | [ Rhythms: Permitting line breaks within beamed tuplets > ] |
Partcombine and autoBeamOff
The function of \autoBeamOff
when used with
\partcombine
can be difficult to understand.
It may be preferable to use
\set Staff.autoBeaming = ##f
instead, to ensure that autobeaming will be turned off for the entire staff.
\partcombine
apparently works with 3 voices – stem up single,
stem down single, stem up combined.
An \autoBeamOff
call in the first argument to partcombine will
apply to the voice that is active at the time the call is processed,
either stem up single or stem up combined. An \autoBeamOff
call
in the second argument will apply to the voice that is stem down single.
In order to use \autoBeamOff
to stop all autobeaming when used
with \partcombine
, it will be necessary to use three calls to
\autoBeamOff
.
{ %\set Staff.autoBeaming = ##f % turns off all autobeaming \partcombine { \autoBeamOff % applies to split up stems \repeat unfold 4 a'16 %\autoBeamOff % applies to combined up stems \repeat unfold 4 a'8 \repeat unfold 4 a'16 } { \autoBeamOff % applies to down stems \repeat unfold 4 f'8 \repeat unfold 8 f'16 | } }
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 }
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < Rhythms: Permitting line breaks within beamed tuplets ] | [ Up : Rhythms ] | [ Rhythms: Positioning grace notes with floating space > ] |
Positioning grace note beams at the height of normal note beams
When notes are placed on ledger lines, their beams are usually centred on the stave. Grace notes beams are shorter and grace notes on ledger lines may well have beams outside the stave. You can override this beaming for grace notes.
\relative c { f8[ e] \grace { f8[ e] \override Stem.no-stem-extend = ##f f8[ e] \revert Stem.no-stem-extend } f8[ e] }
Positioning grace notes with floating space
Setting the property 'strict-grace-spacing
makes the musical
columns for grace notes ’floating’, i.e., decoupled from the non-grace
notes: first the normal notes are spaced, then the (musical columns of
the) graces are put left of the musical columns for the main notes.
\relative c'' { << \override Score.SpacingSpanner.strict-grace-spacing = ##t \new Staff \new Voice { \afterGrace c4 { c16[ c8 c16] } c8[ \grace { b16 d } c8] c4 r } \new Staff { c16 c c c c c c c c4 r } >> }
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 fourth line R1 % They can be moved using an override \override MultiMeasureRest.staff-position = #-2 R1 \override MultiMeasureRest.staff-position = #0 R1 \override MultiMeasureRest.staff-position = #2 R1 \override MultiMeasureRest.staff-position = #3 R1 \override MultiMeasureRest.staff-position = #6 R1 \revert MultiMeasureRest.staff-position \break % In two Voices, odd-numbered voices are under the top line << { R1 } \\ { a1 } >> % Even-numbered voices are under the bottom line << { a1 } \\ { R1 } >> % Multi-measure rests in both voices remain separate << { R1 } \\ { R1 } >> % Separating multi-measure rests in more than two voices % requires an override << { R1 } \\ { R1 } \\ \once \override MultiMeasureRest.staff-position = #0 { R1 } >> % Using compressed bars in multiple voices requires another override % in all voices to avoid multiple instances being printed \compressMMRests << \revert MultiMeasureRest.direction { R1*3 } \\ \revert MultiMeasureRest.direction { R1*3 } >> }
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < Rhythms: Positioning multi-measure rests ] | [ Up : Rhythms ] | [ Rhythms: Printing bar numbers at regular intervals > ] |
Preventing final mark from removing final tuplet
The addition of a final mark
can result in the loss of a final
tuplet marking. This can be overcome by setting TupletBracket
#'full-length-to-extent
to false
.
\new Staff { \set tupletFullLength = ##t \time 1/8 \tuplet 3/2 { c'16 c'16 c'16 } \tuplet 3/2 { c'16 c'16 c'16 } \tuplet 3/2 { c'16 c'16 c'16 } \override Score.RehearsalMark.break-visibility = ##(#t #t #t) \override Score.RehearsalMark.direction = #DOWN \override Score.RehearsalMark.self-alignment-X = #RIGHT % due to issue 2362 the following line is commented % \mark "Composed Feb 2007 - Feb 2008" % and a shorter mark is used. \mark "1234" } \new Staff { \set tupletFullLength = ##t \override TupletBracket.full-length-to-extent = ##f \time 1/8 \tuplet 3/2 { c'16 c'16 c'16 } \tuplet 3/2 { c'16 c'16 c'16 } \tuplet 3/2 { c'16 c'16 c'16 } \override Score.RehearsalMark.break-visibility = ##(#t #t #t) \override Score.RehearsalMark.direction = #DOWN \override Score.RehearsalMark.self-alignment-X = #RIGHT % due to issue 2362 the following line is commented % \mark "Composed Feb 2007 - Feb 2008" % and a shorter mark is used. \mark "1234" }
Printing bar numbers at regular intervals
Bar numbers can be printed at regular intervals by setting the property
barNumberVisibility
. Here the bar numbers are printed every two
measures except at the end of the line.
\relative c' { \override Score.BarNumber.break-visibility = #end-of-line-invisible \set Score.currentBarNumber = #11 % Permit first bar number to be printed \bar "" % Print a bar number every second measure \set Score.barNumberVisibility = #(every-nth-bar-number-visible 2) c1 | c | c | c | c \break c1 | c | c | c | c }
Printing bar numbers inside boxes or circles
Bar numbers can also be printed inside boxes or circles.
\relative c' { % Prevent bar numbers at the end of a line and permit them elsewhere \override Score.BarNumber.break-visibility = #end-of-line-invisible \set Score.barNumberVisibility = #(every-nth-bar-number-visible 4) % Increase the size of the bar number by 2 \override Score.BarNumber.font-size = #2 % 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 5 { c1 } % 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 "|." }
Printing bar numbers with changing regular intervals
The bar number interval can be changed by changing the context function
{set-bar-number-visibility}
.
\relative c' { \override Score.BarNumber.break-visibility = #end-of-line-invisible \context Score \applyContext #(set-bar-number-visibility 4) \repeat unfold 10 c'1 \context Score \applyContext #(set-bar-number-visibility 2) \repeat unfold 10 c }
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 { indent = 0 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 }
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.
If bar numbers are required, the Bar_number_engraver
should also
be moved, since it relies on properties set by the
Timing_translator
; a \with
block can be used to add bar
numbers to the relevant staff.
\paper { indent = #0 ragged-right = ##t } global = { \time 3/4 { s2.*3 } \bar "" \break { s2.*3 } } \layout { \context { \Score \remove "Timing_translator" \remove "Default_bar_line_engraver" \remove "Bar_number_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" } \context { \Voice \remove "Forbid_line_break_engraver" tupletFullLength = ##t } } Bassklarinette = \new Staff \with { \consists "Bar_number_engraver" barNumberVisibility = #(every-nth-bar-number-visible 2) \override BarNumber.break-visibility = #end-of-line-invisible } << \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 \tuplet 3/2 { ees''4 r4 d''4 ~ } \bar "|" \time 3/8 \tupletUp \tuplet 4/3 { 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 >> ] | ||
[ < Rhythms: Printing music with different time signatures ] | [ Up : Rhythms ] | [ Rhythms: Redefining grace note global defaults > ] |
Printing the bar number for the first measure
By default, the first bar number in a score is suppressed if it is less
than or equal to ‘1’. By setting barNumberVisibility
to
all-bar-numbers-visible
, any bar number can be printed for the
first measure and all subsequent measures. Note that an empty bar line
must be inserted before the first note for this to work.
\layout { indent = 0 ragged-right = ##t } \relative c' { \set Score.barNumberVisibility = #all-bar-numbers-visible \bar "" c1 | d | e | f \break g1 | e | d | c }
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < Rhythms: Printing the bar number for the first measure ] | [ Up : Rhythms ] | [ Rhythms: Removing bar numbers from a score > ] |
Redefining grace note global defaults
The global defaults for grace notes are stored in the identifiers
startGraceMusic
, stopGraceMusic
,
startAcciaccaturaMusic
, stopAcciaccaturaMusic
,
startAppoggiaturaMusic
and stopAppoggiaturaMusic
, which
are defined in the file ly/grace-init.ly
. By redefining them
other effects may be obtained.
startAcciaccaturaMusic = { <>( \override Flag.stroke-style = #"grace" \slurDashed } stopAcciaccaturaMusic = { \revert Flag.stroke-style \slurSolid <>) } \relative c'' { \acciaccatura d8 c1 }
Removing bar numbers from a score
Bar numbers can be removed entirely by removing the
Bar_number_engraver
from the Score
context.
\layout { \context { \Score \omit BarNumber % or: %\remove "Bar_number_engraver" } } \relative c'' { c4 c c c \break c4 c c c }
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < Rhythms: Removing bar numbers from a score ] | [ Up : Rhythms ] | [ Rhythms: Rest styles > ] |
Removing connecting bar lines on StaffGroup PianoStaff or GrandStaff
By default, bar lines in StaffGroup, PianoStaff, or GrandStaff groups are connected between the staves. This behaviour can be overridden on a staff-by-staff basis.
\relative c' { \new StaffGroup << \new Staff { e1 | e \once \override Staff.BarLine.allow-span-bar = ##f e1 | e | e } \new Staff { c1 | c | c \once \override Staff.BarLine.allow-span-bar = ##f c1 | c } \new Staff { a1 | a | a | a | a } >> }
Rest styles
Rests may be used in various styles.
\new Staff \relative c { \omit Score.TimeSignature \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 "" \break \override Staff.Rest.style = #'neomensural r\maxima^\markup \typewriter { neomensural } r\longa r\breve r1 r2 r4 r8 r16 s32 s64 s128 s128 \bar "" \break \override Staff.Rest.style = #'classical r\maxima^\markup \typewriter { classical } r\longa r\breve r1 r2 r4 r8 r16 r32 r64 r128 s128 \bar "" \break \override Staff.Rest.style = #'z r\maxima^\markup \typewriter { z-style } r\longa r\breve r1 r2 r4 r8 r16 r32 r64 r128 s128 \bar "" \break \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 >> ] | ||
[ < Rhythms: Rest styles ] | [ Up : Rhythms ] | [ Rhythms: Rhythmic slashes > ] |
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 % Set new values for beam endings \set Score.beatStructure = 3,4,3,2 a8 a a a a a a a a a a a }
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < Rhythms: Reverting default beam endings ] | [ Up : Rhythms ] | [ Rhythms: Skips in lyric mode (2) > ] |
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 (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 >> ] | ||
[ < Rhythms: Rhythmic slashes ] | [ Up : Rhythms ] | [ Rhythms: Skips in lyric mode > ] |
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 >> ] | ||
[ < Rhythms: Skips in lyric mode (2) ] | [ Up : Rhythms ] | [ Rhythms: Stemlets > ] |
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 c'' { a1 | a } \new Lyrics \lyricmode { \skip 1 bla1 } >>
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < Rhythms: Skips in lyric mode ] | [ Up : Rhythms ] | [ Rhythms: Strict beat beaming > ] |
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 \hide Rest r16 d'] }
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < Rhythms: Stemlets ] | [ Up : Rhythms ] | [ Rhythms: Subdividing beams > ] |
Strict beat beaming
Beamlets can be set to point in the direction of the beat to which they belong. The first beam avoids sticking out flags (the default); the second beam strictly follows the beat.
\relative c'' { \time 6/8 a8. a16 a a \set strictBeatBeaming = ##t a8. a16 a a }
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < Rhythms: Strict beat beaming ] | [ Up : Rhythms ] | [ Rhythms: Three-sided box > ] |
Subdividing beams
The beams of consecutive 16th (or shorter) notes are, by default, not
subdivided. That is, the three (or more) beams stretch unbroken over
entire groups of notes. This behavior can be modified to subdivide the
beams into sub-groups by setting the property subdivideBeams
.
When set, multiple beams will be subdivided at intervals defined by the
current value of baseMoment
by reducing the multiple beams to
the number of beams that indicates the metric value of the subdivision.
If the group following the division is shorter than the current metric
value (usually because the beam is incomplete) the number of beams
reflects the longest possible subdivision group. However, if there is
only one note left after the division this restriction isn’t applied.
Note that baseMoment
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
ly:make-moment
function, as shown in this snippet. Also, when
baseMoment
is changed, beatStructure
should also be
changed to match the new baseMoment
:
\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 baseMoment = #(ly:make-moment 1/8) \set beatStructure = 2,2,2,2 c32[ c c c c c c c] % Set beam sub-group length to a sixteenth note \set baseMoment = #(ly:make-moment 1/16) \set beatStructure = 4,4,4,4 c32[ c c c c c c c] % Shorten beam by 1/32 \set baseMoment = #(ly:make-moment 1/8) \set beatStructure = 2,2,2,2 c32[ c c c c c c] r32 % Shorten beam by 3/32 \set baseMoment = #(ly:make-moment 1/8) \set beatStructure = 2,2,2,2 c32[ c c c c] r16. r2 }
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < Rhythms: Subdividing beams ] | [ Up : Rhythms ] | [ Rhythms: Time signature in parentheses - method 3 > ] |
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 X) padding)) (y-ext (interval-widen (ly:stencil-extent stencil Y) 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 LEFT y-rule padding)) (set! stencil (ly:stencil-combine-at-edge stencil Y UP x-rule 0.0)) (set! stencil (ly:stencil-combine-at-edge stencil Y DOWN 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?) #:properties ((thickness 0.1) (font-size 0) (box-padding 0.2)) "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 ((pad (* (magstep font-size) box-padding)) (m (interpret-markup layout props arg))) (NWS-box-stencil m thickness pad))) % Test it: \relative c' { c1^\markup { \NWS-box ABCD } c1^\markup { \NWS-box \note {4} #1.0 } }
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < Rhythms: Three-sided box ] | [ Up : Rhythms ] | [ Rhythms: Time signature in parentheses > ] |
Time signature in parentheses - method 3
Another way to put the time signature in parenthesis
\relative c'' { \override Staff.TimeSignature.stencil = #(lambda (grob) (parenthesize-stencil (ly:time-signature::print grob) 0.1 0.4 0.4 0.1 )) \time 2/4 a4 b8 c }
Time signature in parentheses
The time signature can be enclosed within parentheses.
\relative c'' { \override Staff.TimeSignature.stencil = #(lambda (grob) (bracketify-stencil (ly:time-signature::print grob) Y 0.1 0.2 0.1)) \time 2/4 a4 b8 c }
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < Rhythms: Time signature in parentheses ] | [ Up : Rhythms ] | [ Rhythms: Tweaking grace layout within music > ] |
Time signature printing only the numerator as a number (instead of the fraction)
Sometimes, a time signature should not print the whole fraction (e.g.
7/4), but only the numerator (7 in this case). This can be easily done
by using \override Staff.TimeSignature.style = #'single-digit
to change the style permanently. By using \revert
Staff.TimeSignature.style
, this setting can be reversed. To apply the
single-digit style to only one time signature, use the
\override
command and prefix it with a \once
.
\relative c'' { \time 3/4 c4 c c % Change the style permanently \override Staff.TimeSignature.style = #'single-digit \time 2/4 c4 c \time 3/4 c4 c c % Revert to default style: \revert Staff.TimeSignature.style \time 2/4 c4 c % single-digit style only for the next time signature \once \override Staff.TimeSignature.style = #'single-digit \time 5/4 c4 c c c c \time 2/4 c4 c }
Tweaking grace layout within music
The layout of grace expressions can be changed throughout the music
using the functions add-grace-property
and
remove-grace-property
. The following example undefines the
Stem
direction for this grace, so that stems do not always point
up, and changes the default note heads to crosses.
\relative c'' { \new Staff { $(remove-grace-property 'Voice 'Stem 'direction) $(add-grace-property 'Voice 'NoteHead 'style 'cross) \new Voice { \acciaccatura { f16 } g4 \grace { d16 e } f4 \appoggiatura { f,32 g a } e2 } } }
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < Rhythms: Tweaking grace layout within music ] | [ Up : Rhythms ] | [ Rhythms: Using alternative flag styles > ] |
User defined time signatures
New time signature styles can be defined. The time signature in the second measure should be upside down in both staves.
#(add-simple-time-signature-style 'topsy-turvy (lambda (fraction) (make-rotate-markup 180 (make-compound-meter-markup fraction)))) << \new Staff { \time 3/4 f'2. \override Score.TimeSignature.style = #'topsy-turvy \time 3/4 R2. \bar "|." } \new Staff { R2. e'' } >>
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < Rhythms: User defined time signatures ] | [ Up : Rhythms ] | [ Rhythms: Using grace note slashes with normal heads > ] |
Using alternative flag styles
Alternative styles of flag on eighth and shorter notes can be displayed
by overriding the stencil
property of Flag
. Valid values
are modern-straight-flag
, old-straight-flag
and
flat-flag
.
testnotes = { \autoBeamOff c8 d16 c32 d64 \acciaccatura { c8 } d64 r4 } \score { \relative c' { \time 2/4 \testnotes \override Flag.stencil = #modern-straight-flag \testnotes \override Flag.stencil = #old-straight-flag \testnotes \override Flag.stencil = #flat-flag \testnotes \revert Flag.stencil \testnotes } \layout { indent = 0 \context { \Score \override NonMusicalPaperColumn.line-break-permission = ##f } } }
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < Rhythms: Using alternative flag styles ] | [ Up : Rhythms ] | [ Rhythms: Using ties with arpeggios > ] |
Using grace note slashes with normal heads
The slash through the stem found in acciaccaturas can be applied in other situations.
\relative c'' { \override Flag.stroke-style = #"grace" c8( d2) e8( f4) }
[ << Rhythms ] | [Top][Contents][Index][ ? ] | [ Expressive marks >> ] | ||
[ < Rhythms: Using grace note slashes with normal heads ] | [ 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 >> ] | ||
[ < Rhythms: Using grace note slashes with normal heads ] | [ Up : Rhythms ] | [ Expressive marks > ] |