On Wed, 1 Jun 2022 at 15:50, Jean Abou Samra <j...@abou-samra.fr> wrote: > I tested it with 2.22. There were some changes (by me) in > the internals of MeasureCounter in 2.23, so it needs to > be adapted a little: > <SNIP SNIP SNIP>
I'll test that in a moment. > > I intend to wrap that in a music function that does all the override > > magic and will take the music as a parameter (maybe work out the > > phrase length from that, or pass it manually) and number of repeats. > > > > Yes, that works too. Good job :-) A bit more work and I now have the following: \version "2.23.9" #(set-object-property! 'phrase-length 'backend-type? integer?) #(define (counter-stencil grob) (let* ((counter (string->number (ly:grob-property grob 'text))) (phrase-length (ly:grob-property grob 'phrase-length))) (if (and (eq? (modulo counter phrase-length) 1) (>= counter phrase-length)) (ly:stencil-aligned-to (grob-interpret-markup grob (markup (number->string (ceiling (/ counter phrase-length))))) Y CENTER)))) \defineBarLine "!|" #'("!|" "" "!|") repeatCounting = #(define-music-function (n bar-length phrase-length music) (index? ly:music? integer? ly:music?) #{ << \repeat unfold #n { #music \bar "!|" } { \set countPercentRepeats = ##t \hide PercentRepeat \override PercentRepeatCounter.phrase-length = #phrase-length \override PercentRepeatCounter.stencil = #counter-stencil \repeat percent #(* phrase-length n) { #bar-length } } >> #}) \new Staff \relative c' { \repeatCounting 4 s1 2 {c4 d e f | g f e d } \break c1 \time 7/4 \repeatCounting 4 s4*7 3 {c4 d e f r r r | g f e d r r r| c1 r2 r4 } } How can I find out the following two bits of information? 1. What is the duration of a measure dependent on the current time signature? 2. How long is a given musical expression (in measures or beats)? If I can work out those two problems, then I could get rid of the two extra parameters bar-length and phrase-length… Thanks, kind regards, sb -- Do not meddle in the affairs of trombonists, for they are subtle and quick to anger.