[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Minor variations on a re-used section
From: |
Simon Albrecht |
Subject: |
Re: Minor variations on a re-used section |
Date: |
Sat, 22 Jun 2019 12:01:52 +0200 |
On 22.06.19 09:01, Evan Driscoll wrote:
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.)
Tags have been mentioned; what you are alluding to is using parallel
music expressions within a voice, i.e.
\context Voice {
<< \theme { s1 s\f } >>
R1
<< \theme { s2 s\p s1\ff } >>
}
(\context should be used to reference an existing context only, if there
is no Voice yet, use \new)
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.
It depends entirely of the kind of music and your preferences. The more
repetitive, the more sense it makes to condense those repetitions, but
if there are more than a few irregularities, the time consumed by
setting up the framework can quickly exceed the time used for typing it
out or copy&pasting. Apart from your personal preference and coding
style it may depend on what you need the code for: will you collaborate
with someone? is it likely that you’ll reuse the code or work with it in
the future? If you revisit the piece in two years and it takes you ages
to understand how the heck all those tags and music functions and
repeats are pieced together, that’s a major drawback… been there ;-)
Doing more sophisticated work and more stupid work both have their
advantages and drawbacks. If for example you need to adjust many slurs
in the repeated passage, you’ll be glad to only do it in one place
instead of having to paste that into the other instances. On the other
hand, if you need to adjust to line breaks or make small layout changes
in only one instance, it will save you headaches to have just duplicated
the code…
There’s no easy answer.
HTH, Simon