Is there a way in LilyPond to space the score notes evenly?

sample of unevenly spaced notes

In the sample image made with LilyPond 2.22.01 the notes are not equally spaced.


The idea is to get all the notes to be spaced equally regardless of their note value.

  • 10
    The notes are not supposed to be evenly spaced because they represent different durations. Spacing them evenly would be confusing and would make the music harder to read.
    – phoog
    Oct 4, 2021 at 10:44
  • 3
    Yeah unless you’re trying to teach something about engraving and note spacing or otherwise doing something unusual, do not space notes evenly. If you want someone to actually perform what you’re engraving, even note spacing will make it much harder for them. Elaine Gould codified a lot of note spacing best practices in her book Behind Bars. Well worth a read for anyone writing any kind of score for performance or recording. Oct 4, 2021 at 13:00
  • 2
    @ToddWilcox good point. You do want the notes to be evenly spaced if you want to make an "avoid this practice" example.
    – phoog
    Oct 4, 2021 at 13:02
  • 2
    I'm really curious about the use case: why would you ever want to do this?
    – Creynders
    Oct 5, 2021 at 12:47
  • @Creynders look here: music.stackexchange.com/q/117971/81941
    – Kjara
    Oct 17, 2021 at 20:25

1 Answer 1

You can tell LilyPond to space the notes strictly based on their note values, with the command below (I think this is what you are looking for):

\override Score.SpacingSpanner.strict-note-spacing = ##t

(see changing-horizontal-spacing)

You might think that this will make the music easier to read, as the notes will be on some evenly spaced (invisible) time grid. And that might be true is some cases, but it usually is a waste of horizontal space. Besides, the time information is already represented by the note symbols (beams, dots, etc.).

Updated Answer

After reading your comments, what you want is the notes to be be evenly spaced regardless of their note values.

In this case what you want to set, is the shortest duration to get a unit space:

\override Score.SpacingSpanner.shortest-duration-space = #16

(see spacing-spanner-interface)

Score excerpt with shortest-duration-space

This also provides a score that is harder to read than the default spacing provided by LilyPond's typesetting algorithm. This complicated algorithm is one of the reasons that makes it such a good engraving program.

  • it partially works in the sense that little changes. From the guide I did not understand if it is possible to give a value to spacing.
    – Mahanidhi
    Oct 4, 2021 at 10:52
  • @Mahanidhi Try setting the shortest duration value as well (as per the example at the top of the page linked), e.g. : \override Score.SpacingSpanner.base-shortest-duration = #(ly:make-moment 1/16). Or are you wanting to get all the notes to be spaced equally regardless of their note value? Oct 4, 2021 at 11:00
  • Yes the idea is to get all the notes to be spaced equally regardless of their note value
    – Mahanidhi
    Oct 4, 2021 at 11:04
  • 6
    @Mahanidhi And, just to reiterate what's in the comments above... performers rely on the "default" spacing, in which longer notes get more space, as a visual cue to the rhythm. Equal spacing would be harder to read. Oct 4, 2021 at 13:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.