lilypond-user
[Top][All Lists]
Advanced

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

Minor variations on a re-used section


From: Evan Driscoll
Subject: Minor variations on a re-used section
Date: Sat, 22 Jun 2019 02:01:03 -0500

I've got a couple variants of the same question.

Suppose I have a few measures that are reused exactly multiple times. If they are adjacent, I can use '\repeat unfold' and only write it once. If they're not, I can put them into a music variable and use that.

But what can I do if they are... *almost* the same? For example, there are expressive marks I want to appear in only one of the occurrences, or a page break I only want one of. Or maybe there are "minor" modifications musically. I'll give a couple examples below of the kinds of things I'm thinking of from a piece I'm typesetting now (the piano+cello arrangement by Saint-Saens of his Danse Macabre), but ask my questions first.

1. Is there some abstraction that's worth doing that will simplify or shorten my code? (I seem to remember seeing some suggestion for example to put dynamics and other expressive marks separate from the actual music, but I can't find where I saw that, don't know if it's appropriate in my situation, and don't really know how to do it.)

2. How much effort is worthwhile to put in to avoid duplication like this? (There are some drawbacks to using music variables as well, such as the point-and-click output feature points you at the variable instead of the variable's invocation. Which is of course perfectly reasonable, but the fact that there *are* two locations of potential interest is itself a drawback.)

3. Am I just worrying about this too much? I come from a coding background where "don't repeat yourself" is a pretty strong mantra, and maybe it just doesn't work as well in this circumstance. 

For what it's worth, 90% of the time when I'm writing something with Lilypond, it's a single instrument, and I can't envision doing anything as remotely complex as a big orchestral score or whatever. There's a small-ish chance I'll do the piano part for this, and that would be the first time I've done a piano part, and that'll be a huge step up in complexity.

Thanks,
Evan

Examples:

Here's something I have in the current draft until I stop being lazy and duplicate the measures and edit the second copy:
      \repeat unfold 2 {
        fs,, a d fs a d |
        bf^\markup{\italic "stringendo"} g d bf g d |
      }
I want the stringendo to appear just the first occurrence.

Earlier in the piece, I have
      r4 <af, ef' c' af'>4 <c' af'> |
 
      % PAGE 1 LINE 10
      \break
      \repeat unfold 3 { r4 <af, ef' c' af'>4 <c' af'> | }
where I could have done '\repeat unfold 4'  and save a copy/paste, except I needed the \break in there.


As a different kind of thing, there's this theme:
      d4 | g2 g4 |  f2 f4 |  e2 e4 |  ef2 ef4 |  d g bf |  a fs d |  fs2 e4 |  d
and it appears three times. First time (actually pair of times, but I'm not counting immediate repeats) it shows up exactly as above. Second time, it's played in a different key (easy enough) with double stops where you keep going with the initial G (g4 | <g g'>2 q4 | <g f'>2 q4 | <g e'>2 q4 | ...). Third time, it's played in yet another key in octaves (a'4 |
  <d, d'>2-> q4 | <c c'>2-> q4 |  <b b'>2-> q4 | ...)



reply via email to

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