Simon Albrecht <address@hidden> writes:
Hello everybody,
I’ve built some music functions to handle a large, multi-section
piece, and ran into a strange problem, which I could boil down to the
attached example.
If the concat-part function is called on the \key expression multiple
times in parallel, the \key expressions are accumulated in a way I’ve
never seen before. Why would that be?
Because you are not copying the expression and still using it multiple
times. A big no-no. Consequently, \transpose works multiple times on
the identical expression.
If you use stuff multiple times, _copy_ it. Because LilyPond will
generally _change_ expressions it is working on.
Multiple \transpose, multiple \relative, multiple other stuff: all that
you want to avoid occuring on the identical expression several times.
\version "2.19.39"
global.1 = { \key c \major }
concat-part =
#(define-music-function (al) (list?)
(make-sequential-music (map cdr al)))
buildPart =
#(define-music-function () ()
#{
\new Voice <<
\concat-part \global
{ c'1 }
>>
#})
\transpose c d <<
\buildPart
\buildPart
--
David Kastrup