lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bar numbers every nth bar *and* at beginning of line


From: Simon Bailey
Subject: Re: Bar numbers every nth bar *and* at beginning of line
Date: Wed, 25 May 2022 19:04:11 +0100

Hi Jean,

I'm not sure if that's genius or a completely warped way of thinking, but it does *exactly* what I need. I've been using Lilypond for about 20 years and would have never thought of "stacking" Bar_number_engravers. :D

Thanks, kind regards,
sb

On Wed, 25 May 2022 at 18:48, Jean Abou Samra <jean@abou-samra.fr> wrote:
Le 25/05/2022 à 19:21, Simon Bailey a écrit :
> Hi everyone,
>
> I can print bar numbers every n (let's say 5) bars using:
>
> \set Score.barNumberVisibility = #(every-nth-bar-number-visible 5)
>
> However, I'd like to have my cake and eat it and *also* have bar
> numbers printed at the beginning of every line, regardless of whether
> it's a multiple of 5. So in the attached screenshot, the first line
> should have 28 at the beginning, and the second line should have 36.
> the bar numbers at 30, 35, 40 should also be printed.
>
> Does anyone know any magic words to make that happen?



As practically everything, you could program it in Scheme.
There's a cheaper solution though:

\version "2.22.2"

regularBarNumbers = \with {
   \consists Bar_number_engraver
   barNumberVisibility = #(every-nth-bar-number-visible 5)
   \override BarNumber.break-visibility = #center-visible
}

<<
   \new Staff \with \regularBarNumbers \repeat unfold 50 { c'1 }
   \repeat unfold 50 { c'1 }
 >>


The idea is that the Bar_number_engraver gets duplicated,
in Score and and in the top Staff. The Score prints a
bar number at the beginning of every line, as usual.
The Staff prints a bar number every 5th measure, but
only in the middle of a line, so that it won't duplicate
the number typeset by the Score if it happens to be at
the beginning of the line.


Best,
Jean




--
Do not meddle in the affairs of trombonists, for they are subtle and quick to anger.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]