ssb22 / jianpu-ly

Jianpu in Lilypond
http://ssb22.user.srcf.net/mwrhome/jianpu-ly.html
Apache License 2.0
77 stars 19 forks source link

Issue: More alternatives than repeats #49

Closed suntong closed 1 year ago

suntong commented 1 year ago

Thanks for fixing #45 first of all @ssb22.

Now, I want to provide "Auld Lang Syne" an alternative ending, i.e., the first alternative will be repeated for 1,2,3,4 times and the second alternative will be marked as repeat 5. Based on the syntax of:

R{ x y } A{ 1 | 2 | 3 }

I just repeat the first alternative four times, while putting the second alternative last, but I'm getting the error of:

warning: More alternatives than repeats. Junking excess alternatives

Changing the first four repeated alternatives to different notes will not make any difference:

4/4,4

KeepLength

R{
1' 5. q3 c3 1   2. q1 c2 3

} A{
1. q1 c6, 5, 5, - - | 1. q2 c6, 5, 5, - - | 1. q3 c6, 5, 5, - - |
1. q1 c6, 5, 5, - -
}

Please help.

PS. I think the syntax of R{ x y } A{ 1 | 2 | 3 } should be interpreted as repeat x y with alternative of 1, 2 and 3, three different alternatives.

ssb22 commented 1 year ago

Ah, we need to change it to generate different Lilypond code (unless doing it all in LP: blocks). When you have more than two alternate endings, the number 2 in the Lilypond \repeat volta 2 part needs to change and jianpu-ly doesn't do this. To do....

ssb22 commented 1 year ago

In version 1.732 you should be able to say R5{ 1' 5. q3 c3 1 2. q1 c2 3 } A{ 1. q1 c6, 5, 5, - - | 1. q1 c6, 5, 1 - - } to say there's 5 repeats, with 1st-4th time taking the first alternative and 5th time taking the second.

(Normally, R5{ starts a percent-repeat 5 times, but adding an A{ now turns it into a volta repeat. If you omit the number after the R, we check the number of alternatives. If you provide fewer alternatives than the number, it fills up from the end, so for example if you say R5{ but provide 3 alternatives, you get 1st-3rd time, 4th time, 5th time.)