Hi Mark,After I wrote most of what I wrote below I discovered your comment about your thread on the developers list. I haven't read that thread yet but it seems to show that unfoldRepeats is not a very useful command.
Thanks, Mark, for all the work you have done on this. Unfortunately you have gone in a direction that is not useful to me and have left me without a useful answer.
The most important thing is that I want the timing structure in my \global as I originally had it so that I don't have to duplicate it for everything part or voice. I have tried to make a few simple changes to your code to get back to my structure and no longer have working code. I have attached that code.
unfold-repeatspaul.ly
Description: Binary data
I will also make some comments on your thoughts below. On Jun 6, 2009, at 1:19 PM, Mark Polesky wrote:
Paul Scott wrote:It doesn't work. At first I didn't use \unfoldRepeats for the graphical output as you show above. But adding the \unfoldRepeats to the first (graphical) part the graphical music is unfolded in a strange way. The graphical music is generated with the repeat signs omitted but nothing unfolded. The music would be 16 bars long and it is but the last 6 bars are blank.Okay, I looked into this, and here's what I've learned.global = { \repeat volta 2 s1*6 \alternative { { s1*2 } { s1*2 } } }Change s1*6 to { s1*6 }. The \repeat syntax is \repeat volta repeatcount musicexpr and all music expressions require curly braces.
This is simply not true. I have done this and similar things many times. In most or all of the programming languages I have written code in and in Lilypond curly braces are only needed to combine more than one simple piece of code into a single entity. For example
repeat unfold 25 d16 works just fine.
\score { << \new Staff = soprano <<\context Voice = soprano { << { \unfoldRepeats \global } \melody >> }\layout{ } }If you're going to use \unfoldRepeats in a \score with \layout, it doesn't make sense to apply it to only one music expression if there are other simultaneous expressions. Since \global and \melody are simultaneous expressions, move \unfoldRepeats outside:
I think it does make sense to keep the timing structure separate from the pitch structure. I know there are other Lily users who do the same thing.
\score { << \new Staff = soprano << \context Voice = soprano \unfoldRepeats { << \global \melody >> }\layout{ } } However, it may make even more sense to apply \unfoldRepeats to the whole score, so you don't have to keep applying it to other voices (should there be any)...
I didn't want the written music to be unfolded.
Also consider Staff and Voice naming. Are you going to have non-soprano Voices in the soprano Staff? If not, you probably don't need the \context Voice = soprano since a Voice context is implicitly created with any music expression (though there are reasons for explicitly instantiating the Voice context). Either way (and honestly I don't know if this makes a difference), I wouldn't want two different contexts with the same name, even if they are nested within each other. You might consider sopranoStaff and sopranoVoice, for instance.
This was a quick attempt based on old code of mine and was not totally cleaned up.
Also, << and >> are only needed when there's more than one simultaneous expression. So if sopranoStaff will only contain sopranoVoice, you could do this: \score { \unfoldRepeats << \new Staff = sopranoStaff \context Voice = sopranoVoice { << \global \melody >> }\layout { } } And if << and >> enclose simultaneous expressions which already have curly braces built into their definition -- like \global and \melody do, you don't need an extra pair of curly braces around the << >>.
I do know that.
\score { \unfoldRepeats << \new Staff = sopranoStaff \context Voice = sopranoVoice << \global \melody >>\layout { } } I've left the outer << >> with the assumption that other voices will eventually be added, but if not, you could remove those too. Unfortunately, after all this, I've learned that \unfoldRepeats doesn't natively work when the repeats are in an expression separate from the notes, even if they're funneled together before calling \unfoldRepeats. See http://lists.gnu.org/archive/html/lilypond-devel/2009-06/msg00161.html for a response to my post on the developers mailing-list regarding this question.
I hadn't read this part when I did my testing and wrote what I wrote above. I will check out that thread. If that is true than unfoldRepeats seems pointless to me.
Your code misses any usefulness of unfoldRepeats which you must have have discovered in your other thread.
One last note: it may save space to put a lot of notes on one line in your ly file, but it's easier for others to read your code if it's nicely indented.
Emacs indents my code just fine but sticking to one bar per line would take far too much scrolling in much of the music I work on. My compromise is to never break a line in the middle of a bar.
Thanks again, Paul
_______________________________________________ lilypond-user mailing list [email protected] http://lists.gnu.org/mailman/listinfo/lilypond-user
