4

I want my scores to have a bar line on the start of each new line. Currently, at the beginning it is just open (see yellow part in the image). Is it possible to achieve this bar line with lilypond?

\version "2.22.2"

\relative {
  \repeat unfold 100 {
    c'4
  } 
}

lilypond

1 Answer 1

4

This bar line can be seen when you have multiple staves on one system. These things are called system start delimiters and exist as line, as brace, as bracket and as square. If you look here

https://lilypond.org/doc/v2.23/Documentation/internals/system_002dstart_002ddelimiter_002dinterface

you’ll see that these have a property collapse-height. If you look here

https://lilypond.org/doc/v2.23/Documentation/internals/systemstartbar

you’ll see that for SystemStartBar this has a default of 5 staff space units. If the height is smaller then this the start delimiter will not be printed. To force a different behavior just change this value:

{ c d e }

\layout {
  \override Score.SystemStartBar.collapse-height = #-inf.0
}

Edit: To get the SystemStartBar without rounded corners you’ll need to change the way it is drawn (there is no parameter to specify roundedness). One quite simple way would be to take the original stencil and replace it with a box of the same dimensions (the original stencil itself is simply a rounded box).

\layout {
  \override Score.SystemStartBar.stencil =
  #(grob-transformer 'stencil                                           ; Change stencil depending on original stencil
                     (lambda (grob orig)                                ; grob is a reference to the SystemStartBar-object, orig is the original stencil
                       (if (ly:stencil? orig)                           ; collapse-height might lead to the grob suiciding during calculation of orig, in that case there is no original stencil
                           (let ((xext (ly:stencil-extent orig X))      ; X dimensions of original stencil
                                 (yext (ly:stencil-extent orig Y)))     ; Y dimensions of original stencil
                             (make-filled-box-stencil xext yext)))))    % Create a filled box of same dimensions
}
9
  • Thank you very much, works good after changing #-Inf.0 to #0. Otherwise I get a warning and no effect.
    – Guest
    Oct 31, 2022 at 15:43
  • 1
    @Guest Sorry, should of course have been #-inf.0. No idea how this got through ...
    – Lazy
    Oct 31, 2022 at 15:55
  • 1
    @Guest Hm, the regular BarLine is indeed not rounded, but usually it is shortened by half a line thickness to each side, so the end of the Staff line will produce such a rounded effect. For some reason I do not know coloring the BarLine makes it longer so that this does not apply anymore. If you want to have the look of a BarLine you should also consider increasing \override Score.SystemStartBar.thickness = #1.9.
    – Lazy
    Oct 31, 2022 at 16:16
  • 1
    @Guest The amazin Jean has shed light on this issue on the mailing list. Basically the slight shortening of the bar line if no color is specified is done as else rounding errors can lead to a slight protrusion of the bar line beyond the staff especially on display.
    – Lazy
    Nov 1, 2022 at 8:12
  • 1
    @Guest The reason for this is that while the grob property rounded exists by default the stencil for SystemStartBar does not make any use of this property. Instead you’ll need to change the stencil for the SystemStartBar althogether, as I’ll demonstrate in an edit.
    – Lazy
    Nov 1, 2022 at 9:16

Your Answer

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

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