4.5.3 Changing horizontal spacing

Horizontal spacing may be altered with the base-shortest-duration property. Here we compare the same music; once without altering the property, and then altered. Larger values of ly:make-moment will produce smaller music. Note that ly:make-moment constructs a duration, so 1 4 is a longer duration than 1 16.

\score {
  \relative {
    g'4 e e2 | f4 d d2 | c4 d e f | g4 g g2 |
    g4 e e2 | f4 d d2 | c4 e g g | c,1 |
    d4 d d d | d4 e f2 | e4 e e e | e4 f g2 |
    g4 e e2 | f4 d d2 | c4 e g g | c,1 |
  }
}

[image of music]

\score {
  \relative {
    g'4 e e2 | f4 d d2 | c4 d e f | g4 g g2 |
    g4 e e2 | f4 d d2 | c4 e g g | c,1 |
    d4 d d d | d4 e f2 | e4 e e e | e4 f g2 |
    g4 e e2 | f4 d d2 | c4 e g g | c,1 |
  }
  \layout {
    \context {
      \Score
      \override SpacingSpanner.base-shortest-duration = #(ly:make-moment 1/16)
    }
  }
}

[image of music]

Selected Snippets

By default, spacing in tuplets depends on various non-duration factors (such as accidentals, clef changes, etc). To disregard such symbols and force uniform equal-duration spacing, use Score.SpacingSpanner.uniform-stretching. This property can only be changed at the beginning of a score,

\score {
  <<
    \new Staff {
      \tuplet 5/4 { c8 c c c c } c8 c c c
    }
    \new Staff {
      c8 c c c \tuplet 5/4 { c8 c c c c }
    }
  >>
  \layout {
    \context {
      \Score
      \override SpacingSpanner.uniform-stretching = ##t
    }
  }
}

[image of music]

When strict-note-spacing is set, notes are spaced without regard for clefs, bar lines, and grace notes,

\override Score.SpacingSpanner.strict-note-spacing = ##t
\new Staff \relative {
  c''8[ c \clef alto c \grace { c16 c } c8 c c]  c32[ c] }

[image of music]

See also

Snippets: Spacing.


其他语言:català, deutsch, español, français, italiano, 日本語
About automatic language selection.

LilyPond — Notation Reference v2.21.0 (开发分支).