[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lilypond-user
Subject:    Re: Starting PercentRepeatCounter on first measure
From:       Jean Abou Samra <jean () abou-samra ! fr>
Date:       2022-04-22 10:54:55
Message-ID: 5194da41-5b89-7006-8739-03515c8ea554 () abou-samra ! fr
[Download RAW message or body]

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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic