Search code examples
lilypond

Make lilypond use constant spacing and no bars


I want to disable the bars and make all notes equally spaced (regardless of their duration).

I have tried:

\layout {
  \override Stem.transparent = ##t
  \context {
    \Score
    \override SpacingSpanner.spacing-increment = 1
    \override SpacingSpanner.uniform-stretching = ##t
    \override SpacingSpanner.strict-note-spacing = ##t
  }
}

But still the spacing between notes depends on their duration.


Solution

  • This code below is really clumsy but should produce something similar to what you want:

    \version "2.19.82"
    
    \layout {
      \omit Score.Stem
      \omit Score.Beam
      \omit Score.TimeSignature
      \omit Score.BarLine
      \context {
        \Score
        \override SpacingSpanner.spacing-increment = 0.2
        \override SpacingSpanner.uniform-stretching = ##t
        \override SpacingSpanner.strict-note-spacing = ##t
        \override SpacingSpanner.base-shortest-duration = #(ly:make-moment 1/100000000)
      }
    }
    
    {
      c'4 d'4 e'2 
      c'8 cis'8 d'4 e'2
      c'4 d'4 ees'2 
      c'8 g'8 a'4 e'2
    }
    

    Outputting:

    enter image description here

    The trick is to make the base-shortest-duration really small and then adjust the spacing-increment accordingly. The smaller the base-shortest-duration, the less noticeable the difference between different durations become. So all you need to do is to use some value of spacing-increment that outputs the note head distance that you want.