lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: arbitrary repeat counter


From: Jean Abou Samra
Subject: Re: arbitrary repeat counter
Date: Wed, 1 Jun 2022 11:04:12 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1

Le 01/06/2022 à 10:53, Simon Bailey a écrit :
Hi,

There's a handy snippet for counting repeated bars in the manual. But
I'm running into limitations when for instance I'd like to have 2- or
4-bar sections that I'd like to count. Usage example: a bass guitar
has a 4-bar riff that's repeated 8 times, but I can't use a volta
repeat in the part because the rest of the ensemble doesn't have
repeatable music;



How about doing it like this?

\version "2.22.2"

part = {
  \repeat volta 8 { c'1 1 1 1 }
}

{ \part }

otherPart = {
  c'1 1 1 1
  d'1 1 1 1
  e'1 1 1 1
  f'1 1 1 1
  g'1 1 1 1
  a'1 1 1 1
  b'1 1 1 1
  c'1 1 1 1
}

<<
  \new Staff \unfoldRepeats \part
  \new Staff \otherPart




I'd like to print a counting number over the centre
of the first bar of each phrase.

For 2-bar phrases, using the example from the manual, I get the
following, but the Counter is centred over the middle bar-line. Does
anyone have a suggestion for some scheme magic I can investigate to
calculate the X-offset to the centre of the first bar?

\new Staff \relative c' {
   <<
     {
       \set countPercentRepeats = ##t
       \hide DoublePercentRepeat
       \repeat percent 4 { s1*2}
     }
     \repeat unfold 4 { c4. 8 r4 8 r | d4. 4. 4 }
   >>
}

For 4-bar phrases, the best thing I've managed to come up with is this:

\new Staff \relative c {
   \clef bass
   <<
     \context Voice = "foo" {
       \repeat unfold 4 { r4 d8 r r f r4 | a8 r r g r a f r8 | r4 d'8 r
r f, r4 | a8 r r g8 ~ g4 r | }
     }
     \context Voice = "foo" {
       \hide MultiMeasureRest
       \override Voice.MultiMeasureRestText.font-encoding = #'fetaText
       \override Voice.MultiMeasureRestText.font-size = #-2
       s1*4 | R1^"(2)" s1*3  | R1^"(3)" s1*3  | R1-"(4)" s1*3  |
     }
   >>
}

but that's all a bit "manual" ;)

I was thinking it may be possible to override the stencil for the
PercentRepeatCounter and do some math on the current percent repeat
count, but I have no idea how to:

a) get the current repeat number
b) replace a text-interface::print stencil

I've just spent 2 hours digging through LSR and the exending lilypond
manual, but that was a bit fruitless.


Sadly, the extending manual isn't overly helpful. That's
the reason why I wrote

https://extending-lilypond.readthedocs.io

You may find it more useful. At any rate, it is definitely
more thorough.

That said, if you use the suggestion above, the problem
is solved without needing it at all ;-)



I'm also wondering if there's any form of convention to show these
repeated phrases – as a player, if I was given a part with these
repeated phrases and no counting, I'd add the numbers in pencil and
probably a flare to the final barline of each phrase. I'm open to
suggestions ;)


I don't know whether there is an established convention, but
I would say it is definitely easier to follow the score if
the repeat is condensed, especially for something repeated 8
times. On the other hand, it might be trickier to make it
easy to jump to a specific bar number.


Regards,
Jean




reply via email to

[Prev in Thread] Current Thread [Next in Thread]