Printing bar numbers using modulo-bar-number-visible: Difference between revisions
Appearance
No edit summary |
mNo edit summary |
||
| (2 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
If the remainder of the division of the current | If the remainder of the division of the current bar number by the first argument of <code>modulo-bar-number-visible</code> equals its second argument, print a bar number. | ||
This is useful to print the bar number at certain distances. Some examples: | |||
* <code>(modulo-bar-number-visible 3 2)</code> | * <code>(modulo-bar-number-visible 3 2)</code> → prints 2, 5, 8, ... | ||
* <code>(modulo-bar-number-visible 4 2)</code> | * <code>(modulo-bar-number-visible 4 2)</code> → prints 2, 6, 10, ... | ||
* <code>(modulo-bar-number-visible | * <code>(modulo-bar-number-visible 2 1)</code> → prints 3, 5, 7, ... | ||
* <code>(modulo-bar-number-visible 5 | * <code>(modulo-bar-number-visible 5 0)</code> → prints 5, 10, 15, ... | ||
<lilypond version="2.24" | <lilypond version="2.24"> | ||
\layout { | \layout { | ||
\context { | \context { | ||
\Score | \Score | ||
\override BarNumber.break-visibility = ##(#f #t #t) | \override BarNumber.break-visibility = ##(#f #t #t) | ||
barNumberVisibility = #(modulo-bar-number-visible | barNumberVisibility = #(modulo-bar-number-visible 5 0) | ||
} | } | ||
} | } | ||
| Line 21: | Line 21: | ||
g1 | e | d | c | g1 | e | d | c | ||
} | } | ||
</lilypond> | </lilypond> | ||
[[Category:Rhythms]] | [[Category:Rhythms]] | ||
[[Category:Included in the official documentation]][[Category:Snippet]] | [[Category:Included in the official documentation]] | ||
[[Category:Snippet]] | |||
Latest revision as of 15:46, 30 November 2025
If the remainder of the division of the current bar number by the first argument of modulo-bar-number-visible equals its second argument, print a bar number.
This is useful to print the bar number at certain distances. Some examples:
(modulo-bar-number-visible 3 2)→ prints 2, 5, 8, ...(modulo-bar-number-visible 4 2)→ prints 2, 6, 10, ...(modulo-bar-number-visible 2 1)→ prints 3, 5, 7, ...(modulo-bar-number-visible 5 0)→ prints 5, 10, 15, ...
\version "2.24"
\layout {
\context {
\Score
\override BarNumber.break-visibility = ##(#f #t #t)
barNumberVisibility = #(modulo-bar-number-visible 5 0)
}
}
\relative c' {
c1 | d | e | f \break
g1 | e | d | c
}