[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
arbitrary repeat counter
From: |
Simon Bailey |
Subject: |
arbitrary repeat counter |
Date: |
Wed, 1 Jun 2022 09:53:39 +0100 |
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; 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.
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 ;)
Thanks, kind regards,
sb
--
Do not meddle in the affairs of trombonists, for they are subtle and
quick to anger.
- arbitrary repeat counter,
Simon Bailey <=
- Re: arbitrary repeat counter, Jean Abou Samra, 2022/06/01
- Re: arbitrary repeat counter, Simon Bailey, 2022/06/01
- Re: arbitrary repeat counter, Simon Bailey, 2022/06/01
- Re: arbitrary repeat counter, Jean Abou Samra, 2022/06/01
- Re: arbitrary repeat counter, Simon Bailey, 2022/06/01
- Re: arbitrary repeat counter, Jean Abou Samra, 2022/06/01
- Re: arbitrary repeat counter, Simon Bailey, 2022/06/01
- Re: arbitrary repeat counter, Jean Abou Samra, 2022/06/01
- Re: arbitrary repeat counter, Simon Bailey, 2022/06/01
- Re: arbitrary repeat counter, Jean Abou Samra, 2022/06/01