[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Starting PercentRepeatCounter on first measure
From: |
Jean Abou Samra |
Subject: |
Re: Starting PercentRepeatCounter on first measure |
Date: |
Fri, 22 Apr 2022 12:54:55 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 |
Le 21/04/2022 à 05:59, Evan Driscoll a écrit :
http://lilybin.com/w08zwj/6 for example. In short, I want the effect
of the second system without the extra syntax every single group.
The docs give examples of using countPercentRepeats to get a measure
counter on measures generated by '\repeat percent', but those omit the
"1" over the original, written-out measure. The docs also have
examples of using the Measure_counter_engraver and \startMeasureCount
(and \stopMeasureCount) to get measure counts of arbitrary segments.
If I would like a "1" over the first, written-out measure of all of my
'\repeat percent's I could go through and add a \startMeasureCount and
\stopMeasureCount around all of them, as in the second system in my
example link, but that's obnoxious and risks missing some.
Is there a better way? Something I'm missing on the
RepeatPercentCounter object? Maybe a music function I could define and
use instead of '\repeat percent` as a backup?
The most straightforward way is probably with a substitution function.
\version "2.22.2"
\layout {
\context {
\Staff
\consists #Measure_counter_engraver
}
}
repeatPercentWithCount =
#(define-music-function (count music) (index? ly:music?)
#{ \startMeasureCount \repeat percent #count { #music }
\stopMeasureCount #})
{
\repeatPercentWithCount 5 {
c4 c c c
}
}
See
https://lilypond.org/doc/v2.22/Documentation/notation/substitution-function-examples
Best,
Jean