Hello Paul,

while I’m not entirely sure what is going on there it seems like the iterator 
for quoted music is messing with the logic of the iterator for percent 
repeated music. This is done not by the engraver, but by the iterator. 
Basically the iterator decides on whether to create PercentReapeat, 
DoublePercentRepeat or RepeatSlash by determining whether the repeated music 
as well as the first repeat starts on the start of a measure (that is, main 
part of measure position > 0) and if the current measure is by 1 (Percent) or 
by 2 (Double Percent) higher than the starting measure.

Essentially it checks: Do we start at the begin of a measure, and if so, does 
or repeated music take exactly one or two measures?

Here this check seems to fail, so Lilypond defaults to Repeat slashes.

I’ve added some debug output to the code in question, which returned that in 
fact the measure position is always 0 and the internal bar number unset for 
the quoted music. This seems to imply that in the quoted case the music stream 
is iterated all at the beginning.

#######
Upon further investigation (sorry, I’m not motivated enough to reword the 
above): It seems like the quoted music is in fact iterated during addQuote.

So this means we have two conflicting assumptions there: The percent repeat 
iterator assumes that it may depend on the current timing position, while the 
quoting system assumes that this is not done.

This particular problem should be solvable by shifting the decision of what 
type of repeat to create into the engraver rather than the iterator. But on 
more general terms I think this is a problem of the quoting system, as we do 
have more than just this one iterator that depend on timing information, such 
as grace notes, which cause similar problems:

anotes = \fixed c' {
   \time 2/4 \grace { a'8 b' } a'2
}
\addQuote qa \anotes

bnotes = \absolute{ \time 2/4 \quoteDuring qa s2 }
\score{ << \anotes \bnotes >> }

So the proper solution would be to actually change the mechanism of how 
quoting works, so that the quoted music is only iterated at the correct time. 
Maybe we could for example have quoted musics be iterated, but broadcasted to 
a special "sink", and the quoted music iterator would then simply take the 
events thus produced and broadcast them to the relevant contexts. This could 
even keep track of spanner events to keep track of currently active spanners, 
and handle situations like this:

anotes = \fixed c' {
   a2( a a a)
}
\addQuote qa \anotes

bnotes = \absolute{ a'1 \quoteDuring qa s1 }
\score{ << \anotes \bnotes >> }

I’ll CC this to devel for discussion.

Cheers,
 Valentin

Am Dienstag, 16. Mai 2023, 07:54:42 CEST schrieb Paul Scott:
> I asked about this 3 years and I don't remember getting a workable answer:
> 
> I would expect the two voices in the following MWE to have the same
> simple percent signs.  Is there a way get the expected result?
> 
> \version "2.25.4"
> 
> anotes = \fixed c' {
>    \time 2/4 \repeat percent 2 { a2 } \repeat percent 2 { a16( g f g a8) b }
> }
> \addQuote qa \anotes
> 
> bnotes = \absolute{ \time 2/4 \quoteDuring qa s2*4 }
> 
> \score{ << \anotes \bnotes >> }
> 
> TIA,
> 
> Paul

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to