10

I'm trying to create some very simple music note worksheets with LilyPond. I'm afraid I'm still not familiar with the language itself, but here is what I'm looking for:

\version "2.20.0"

\relative c' {
  c d e f g a b c
}

This generates:

C major scale with default Lilypond spacing

I'd like to double the horizontal spacing between each of the notes. Google tells me this has something to do with layout but I'm at a loss at how to actually do it.

9

This is accomplished with the SpacingSpanner spacing-increment property (Lilypond documentation)

For example, this code

% LilyBin
\score{
    \relative c' {
        c d e f g a b c
    }
}

produces

Notes with default spacing

but this code

% LilyBin
\score{
    \relative c' {
        c d e f g a b c
    }

    \layout{
        \context {
            \Score
            \override SpacingSpanner spacing-increment = 4
        }
    }
}

produces

Notes with spacing-increment = 4

3

In addition to Aaron's answer, another option is to use the base-shortest-duration property as discussed in the documentation here.

This property basically uses a note duration as its unit of measurement, so #(ly:make-moment 1/16) will use a sixteenth note, #(ly:make-moment 1/8) will use an eighth, etc. (Although you can use any fraction, not just fractions that suggest clear note values.) This means that the smaller the number (like 1/16 as opposed to 1/8), the more spaced out the score will be.

\version "2.20.0"

\score{
    \relative c' {
        c d e f g a b c
    }

    \layout{
        \context {
            \Score
            \override SpacingSpanner.base-shortest-duration = #(ly:make-moment 1/16)
        }
    }
}

enter image description here

And for anyone that doesn't know LilyPond but it interested in learning it, I highly recommend the YouTube tutorial series by soundsfromsound.

2

While the answers already provided do answer your question directly, I suspect that what you are trying to achieved can be accomplished with simpler commands.


The \break command can be used to begin a new line. This will consequently stretch out the preceding music to fill the line – justified according to the note values.

However, the break command doesn't work for the last line (because there is nothing to break to).
In this case ragged-last (which goes into to layout block) can be turned off. This has a similar effect – stretching out the last line to fill the page nicely.

\score {
    \relative c' {
        c d e f |
        \break  
        g a b c |
    }

    \layout {
        ragged-last = ##f
    }
}

score using break and ragged-last

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.