Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to customize the bar numbers? #79

Open
hyucheng3721 opened this issue Feb 19, 2025 · 4 comments
Open

How to customize the bar numbers? #79

hyucheng3721 opened this issue Feb 19, 2025 · 4 comments

Comments

@hyucheng3721
Copy link
Contributor

How to display bar numbers at the beginning of each line instead of every 5 bars? Or do I decide how many bars to display the bar numbers?As shown below

Image

@ssb22
Copy link
Owner

ssb22 commented Feb 19, 2025

To display bar numbers every N bars where N is not 5, currently you can use an LP: block:

LP: \set Score.barNumberVisibility = #(every-nth-bar-number-visible 4)
:LP
1 2 3 4 5 4 3 2 1 2 3 4 5 4 3 2 1 2 3 4 5 4 3 2 1 2 3 4 5 4 3 2 1 - - -

There's a comment in jianpu-ly.py that's relevant to this:

bar_number_every = 5 # TODO customise?  (anyway don't leave it numbering at start of system, doesn't work well in jianpu+lyrics)

Unlike your example image, Lilypond's default bar numbers are not in boxes. Lilypond numbers bars at the start of the line by default, but I put in the command to change that because it didn't look very good when I tried it, especially when there were lyrics. It was too easy to confuse the bar numbers for something else. But we could ask Lilypond to put a box around each bar number (source) if you want to match that style:

LP: \override Score.BarNumber.stencil = #(make-stencil-boxer 0.1 0.25 ly:text-interface::print)
 :LP

@hyucheng3721
Copy link
Contributor Author

hyucheng3721 commented Feb 20, 2025

Appreciate the reply, and thanks for the details.
I noticed that the bar numbers is not displayed at the beginning of each line, so if I want to displayed the bar numbers at the beginning of each line and not elsewhere, how can I do it?

@ssb22
Copy link
Owner

ssb22 commented Feb 22, 2025

well this is how to do it but I didn't like how the result looks:

LP:
\override Score.BarNumber #'break-visibility = ##(#f #f #t)
\set Score.barNumberVisibility = #all-bar-numbers-visible
:LP
1 2 3 4 5 4 3 2 1 2 3 4 5 4 3 2 1 2 3 4 5 4 3 2 1 2 3 4 5 4 3 2
1 2 3 4 5 4 3 2 1 2 3 4 5 4 3 2 1 2 3 4 5 4 3 2 1 2 3 4 5 4 3 2 1 - - -

@hyucheng3721
Copy link
Contributor Author

hyucheng3721 commented Feb 23, 2025

It labels the bar numbers before the bar, not the upper-left corner of the bar, which doesn't look ideal.

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants