2

I am trying to make a book page for explaining different notes and their durations. What I currently get is this:

C scale in each note type plus concluding rest

How can I align the notes vertically? (i.e., spacing in each line should be as in the first.)

Hint: I need some space on the right side to add explanatory text/images. That's why I chose ragged-right to be #t, but there might be other options.


Here is my code:

\version "2.20.0"

\paper {
  indent = #0
}

\bookpart { 
  \score {
    \relative {
      c'1 d e f g a b c r \break
      c,2. d e f g a b c r \break
      c,2 d e f g a b c r \break
      c,4. d e f g a b c r \break
      c,4 d e f g a b c r \break
      c,8 d e[ f] g_[ a b] c r \break
      }
    \layout {
      ragged-right = ##t
      \context {
        \Staff
        \remove "Time_signature_engraver"
        \remove "Clef_engraver"
        \remove "Bar_engraver"
        %\remove "Staff_symbol_engraver"
      }
      \context {
        \Score
        \remove "Bar_number_engraver"
      }
    }
  }
}

One way I tried was this:

  1. add time signatures so that each note has its own measure.
  2. Utilizing this snippet to force the width of all measures to be equal.

But the notes were still not aligned: Notes of different duration have a different distance from the left end of their measure.


I also tried this, i.e. I added

\override Score.SpacingSpanner.strict-note-spacing = ##t
\override Score.SpacingSpanner.shortest-duration-space = #8
\override Score.SpacingSpanner.base-shortest-duration = #(ly:make-moment 1/8)

or any subset of these three lines into my Score context. But it did not change a thing.

10
  • Is this maybe what you're looking for? (You at least have a good reason for wanting it!) Oct 17, 2021 at 20:21
  • 2
    Does this answer your question? Space the score notes evenly
    – Aaron
    Oct 17, 2021 at 20:22
  • Unfortunately, no. It doesn't change a thing.
    – Kjara
    Oct 17, 2021 at 20:31
  • Admittedly a hack, but could you just insert invisible notes or rests to force the spacing of shorter note values? For example, could an invisible quarter rest be inserted after each dotted half note?
    – Aaron
    Oct 17, 2021 at 21:25
  • @Aaron Do you mean s4? I tried, but they result in far too much space between the notes.
    – Kjara
    Oct 20, 2021 at 19:03

3 Answers 3

3
  1. The first problem is the ragged-right = ##t, which tells LilyPond that each line can be a different length. Removing that line (or setting ragged-right = ##f) will force each line span the full width of the page.

  2. Since leftover space is needed for text, the lengths of the staves can be controlled by setting the line-width property in the \score's \layout section

  3. To get the proper spacing between notes, add

\newSpacingSection
\override Score.SpacingSpanner.spacing-increment = #X

I played around with values of X and at which points they were needed. The best results I got are reflected in the code below.

  1. To get the eighth notes to align, add \override SpacingSpanner.uniform-stretching = ##t to the score layout context.

Full code solution

\version "2.20.0"

\paper {
  indent = #0
}

\bookpart { 
  \score {
    \relative {

      \newSpacingSection
      \override Score.SpacingSpanner.spacing-increment = #2
      c'1 d e f g a b c r \break
      c,2. d e f g a b c r \break
      c,2 d e f g a b c r \break

      \newSpacingSection
      \override Score.SpacingSpanner.spacing-increment = #4
      c,4. d e f g a b c r \break
      c,4 d e f g a b c r \break
      c,8 d e[ f] g_[ a b] c r \break
      }

    \layout {
      ragged-right = ##f
      line-width = 125
      \context {
        \Staff
        \remove "Bar_engraver"
        \remove "Time_signature_engraver"
        \remove "Clef_engraver"
        %\remove "Staff_symbol_engraver"
      }
      \context {
        \Score
        \remove "Bar_number_engraver"
        \override SpacingSpanner.uniform-stretching = ##t
      }
    }
  }
}
5
  • I need ragged right since I want to write some explanatory text (and images) next to the staves. I can''t do that below: the page is small and I need all space I have.
    – Kjara
    Oct 20, 2021 at 18:51
  • @Kjara If the page could be divided into two columns — one for the notation and one for the text — would that serve your purposes?
    – Aaron
    Oct 20, 2021 at 18:56
  • @Kjara Also, you should add that part of leaving space for text to your original post, since it's an essential part of any solution.
    – Aaron
    Oct 20, 2021 at 18:57
  • Yes, if I am able to decide the width of both columns.
    – Kjara
    Oct 20, 2021 at 18:58
  • I didn't use the spacing-increment and I put a \newSpacingSection in front of every line. This way, only the line with 8th notes was not aligned well (because the beam-grouped notes were closer together). I resolved this by adding lyrics ("x" for each note), hiding them and defining a minimum distance (\hide LyricText and \override LyricSpace.minimum-distance = ... in Lyrics context). The notes are not exactly aligned vertically - there is a shift by some pixels to the right from a note to its neighbour below - but they are aligned well enough for the human eye. At least my eye. :)
    – Kjara
    Oct 22, 2021 at 21:42
0

This is just a partial answer. Maybe someone can complete it?

The idea is to always use whole notes (so the spacing algorithm will align them vertically), but to tweak them so that they look like half/quarter/etc notes.

Like this:

\relative {
  % line of whole notes
  c'1 d e f g a b c r \break

  % line of whole notes with duration of half notes
  \tweak duration-log #1 c,1
  \tweak duration-log #1 d
  \tweak duration-log #1 e
  \tweak duration-log #1 f
  \tweak duration-log #1 g
  \tweak duration-log #1 a
  \tweak duration-log #1 b
  \tweak duration-log #1 c
  \tweak duration-log #1 r \break
  
  % line of half notes
  c,2 d e f g a b c r \break
  
  % ...
  }

It produces this:

enter image description here

Spacing seems to work with this method.

But how can I add stems, flags (for 8th notes) and punctuation?

0

I think you want to create a multi-staff system. In the notation application I have used the spacing will be automatic and even within a measure between the staves.

If you really want to do it only in Lilypond, these two pages seem to be the references to work from:

http://lilypond.org/doc/v2.20/Documentation/learning/multiple-staves

...and then maybe adapt this template...

http://lilypond.org/doc/v2.20/Documentation/learning/string-quartet

I use Musescore. I took me only a few minutes to create this...

enter image description here

...which I think is what you want.

There are some tweaks to hide the time signature, add many extra beats to make it look unmeasured, and use one line percussion clefs/staves so that it's really just a bunch of note values lined up. But the main point is get all the parts in one system and the software should handle the lining up vertically by default.


Depending on the software there can be various controls to override default rhythmic spacing. In Musescore the "inspector" panel has an "offset" which can move elements horizontally...

enter image description here

...it very, very tedious to move things out of the default alignment. The software doesn't want to do it, because the result it contrary to good, readable rhythm alignment. Above I only re-aligned the first two notes to demonstrate it can be done.

You can say the lesson is not about rhythm, but the problem you've encountered in software is entirely about rhythm notation and spacing conventions. I don't really see the connection between your color coded xylophone description and the rhythm/spacing problem. But it seems clear you're working against the notation software.

I don't mean to be sarcastic, but drawing a picture, free hand, on paper might make clear what you want. I can't visualize the whole xylophone, color coded, rhythm notation re-aligned from your written description.

I have the sense that it might be easier to get what you want by doing a lot of the work outside of the notation software in an image editor. The screenshot below is not the best example, but if you drop the initial notation into an image editor you can cut/paste/stretch things in a purely visual way...

enter image description here

...you could assemble the notation elements like that then move it into some desktop publishing application to do the rest.

6
  • It appears to me that rather than having beats line up (as you have, eight quavers to each semibreve), OP wants eight notes plus a rest on each stave, with the notes themselves lined up, so that each of the eight quavers on the bottom stave lines up with its matching semibreve at the top. Oct 21, 2021 at 11:47
  • After reading the question a few times, I think you are right. But that is a terrible lesson to give anyone about rhythm notation. In modern notation the common idea is to space notes proportional to duration. There is a reason why most software does that by default. Oct 21, 2021 at 15:44
  • @MichaelCurtis The "lesson" I'm trying to give has noting to do with rhythms. Rhythms don't exist here. It has to do with the notes themselves. See my latest comment on my question.
    – Kjara
    Oct 22, 2021 at 6:14
  • "Rhythms don't exist here." But you're using rhythmic notes: whole, half, quarter, etc. That's really confusing. Why use different rhythm notes, if they don't apply to the lesson. If there really isn't a rhythmic aspect, why not just make all the notes quarter notes? It would be rhythmically "neutral" and shouldn't have the spacing trouble. Oct 22, 2021 at 14:26
  • The duration of each note type will be shown on the right side next to the line. There will be a circle which is filled by the amount corresponding to the note. I.e. next to the line with whole notes, there will be a fully filled circle. Next to the half notes a half filled circle, and so on. A number (1, 1/2, 1/4, ...) will also be shown there.
    – Kjara
    Oct 22, 2021 at 19:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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