Hello!

Sometimes Lilypond can run a bit wider than engraved scores would do. The 
official way to mitigate this (as given by the Documentation) is setting 
Score.SpacingSpanner.base-shortest-duration. Sometimes this does not give the 
result we want, so we need to use different spacing parameters like 
Score.SpacingSpanner.spacing-increment and —.—.shortest-duration-space 
(especially since this also gives us some control over proportions).

I think this should be part of the documentation, as I can be a vital thing 
for making Lilypond behave.

I’ve included an example of different spacings achieved using these 
parameters, and an example of Mozart’s KV 545, where the default settings fail 
to achieve the thightness of the 16th notes that in seen in engraved scores, 
while using custom spacing yields a nice result without any further tweaks.

Cheers,
Valentin
\version "2.22"

\paper {
  ragged-right = ##t
  indent = 0
}


music = { c'4 d'8 e' f' g'16 a' g' f' e' d' | c'8 d'16 e' f' g' a' g' f' e' d' c' b4 c' d'2 c'4 d'1 }


{
  \override Score.TimeSignature.stencil = ##f
  <>^"default (spacing-increment = 1.2, shortest-duration-space = 2)" \music \break
  
  \newSpacingSection
  \temporary\override Score.SpacingSpanner.spacing-increment = #1
  <>^"spacing-increment = 1" \music \break
  
  \newSpacingSection
  \revert Score.SpacingSpanner.spacing-increment
  \temporary\override Score.SpacingSpanner.shortest-duration-space = #1.5
  <>^"shortest-duration-space = 1.5" \music \break
  
  \newSpacingSection
  \revert Score.SpacingSpanner.spacing-increment
  \temporary\override Score.SpacingSpanner.spacing-increment = #1
  \temporary\override Score.SpacingSpanner.shortest-duration-space = #1.7
  <>^"spacing-increment = 1, shortest-duration-space = 1.7" \music \break
  
  \newSpacingSection
  \revert Score.SpacingSpanner.spacing-increment
  \revert Score.SpacingSpanner.shortest-duration-space
  \temporary\override Score.SpacingSpanner.spacing-increment = #0.8
  \temporary\override Score.SpacingSpanner.shortest-duration-space = #1.9
  <>^"spacing-increment = 0.8, shortest-duration-space = 1.9" \music \break
  
  \newSpacingSection
  \revert Score.SpacingSpanner.spacing-increment
  \revert Score.SpacingSpanner.shortest-duration-space
  \temporary\override Score.SpacingSpanner.spacing-increment = #1.41
  \temporary\override Score.SpacingSpanner.shortest-duration-space = #1.2
  <>^"spacing-increment = 1.41, shortest-duration-space = 1.2" \music \break
  
  \newSpacingSection
  \revert Score.SpacingSpanner.spacing-increment
  \temporary\override Score.SpacingSpanner.spacing-increment = #1.1
  \temporary\override Score.SpacingSpanner.shortest-duration-space = #1.45
  <>^"spacing-increment = 1.1, shortest-duration-space = 1.45" \music \break
  
  \newSpacingSection
  \revert Score.SpacingSpanner.spacing-increment
  \revert Score.SpacingSpanner.shortest-duration-space
  \temporary\override Score.SpacingSpanner.common-shortest-duration = #(ly:make-moment 1/8)
  <>^"common-shortest-duration = 1/8" \music \break
  
  \newSpacingSection
  \revert Score.SpacingSpanner.common-shortest-duration
  \temporary\override Score.SpacingSpanner.base-shortest-duration = #(ly:make-moment 1/8)
  <>^"base-shortest-duration = 1/8" \music \break
  
  \newSpacingSection
  \revert Score.SpacingSpanner.base-shortest-duration
  \temporary\override Score.SpacingSpanner.packed-spacing = ##t
  \once\override TextScript.X-extent = #'(0 . 0)
  <>^"packed-spacing" \music 
}
\language "deutsch"

ru = #(define-music-function (n m) (number? ly:music?)
   #{ \repeat unfold $n $m #})

\header {
  title = "Sonate in C"
  subtitle = "KV 545"
  composer = "Wolfgang Amadeus Mozart"
  date = "Wien, 26. Juni 1788"
  copyright = "© 1986 by Bärenreiter-Verlag, Kassel"
}

#(set-global-staff-size 17)

\paper {
  ragged-last = ##t
  left-margin = 2\cm
  right-margin = 2\cm
  paper-height = 370\mm
}


right = \relative c'' {
  c2 e4 g | h,4.( c16 d) c4 r | a'2 g4 c 
  \noBreak % only nescessary for default score
  | g f8(\trill e16 f) e4 r |
  a,8 h16 c d e f g a g f e d c h a |
  g8 a16 h c d e f g f e d c h a g |
  f8 g16 a h c d e f e d c h a g f |
  e8 f16 g a h c d e d c h a g f e |
  d8 e16 f g a h cis d a h cis d e f g |
  a h c h a g f e f g a g f e d c |
  h8[ g'] e[ c] d[ g] e[ c] | d4 <h d g> g r |
  
  R1 |
  
  \ru2{d''8( h) g4.( a16 h a8) g-! |
  g8.\trill( fis16) fis4 r2 |}
}

left = \relative c' {
  \tempo "Allegro"
  \clef bass
  \once\hideNotes\grace c64
  \once\override Staff.Clef.X-extent = #'(1.5 . 2)
  \clef treble
  \repeat unfold 2 { c8 g' e g }
  d g f g c, g' e g |
  c, a' f a c, g' e g |
  h, g' d g c, g' e g |
  f4 r r \clef bass <c f,> |
  <c e,> r r <c e,> | <h d,> r r <h d,> |
  <c c,> r r <e, c> | <f a>1 |
  f4. g8 a4. fis8 |
  g,16 h d g g, c e g g, h d g g, c e g |
  g,4 g' g, r |
  
  \ru 4 { cis'16 d } \ru4 {c d} |
  \ru2{\ru8 {h d} | c d h d a d h d c d h d c d a d |}
  
  
}


\score {
  \header {
    piece = "Custom"
  }
  <<
    \new PianoStaff \with {
      
    } <<
      \new Staff="right" {
        \right
      }
      \new Staff="left" {
        \left
      }
    >>
  >>
  \layout {
  \context {
    \Score
    \override SpacingSpanner.spacing-increment = #0.9
    \override SpacingSpanner.shortest-duration-space = #1.9
  }
  \override Staff.Beam.beam-thickness = #0.52
  }
}

\score {
  \header {
    piece = "Default"
  }
  <<
    \new PianoStaff \with {
      
    } <<
      \new Staff="right" {
        \right
      }
      \new Staff="left" {
        \left
      }
    >>
  >>
  \layout {
    \override Score.SpacingSpanner.base-shortest-duration = #(ly:make-moment 1/8)
    \override Staff.Beam.beam-thickness = #0.52
  }
}

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to