[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Weird key sig accumulation
From: |
Thomas Morley |
Subject: |
Re: Weird key sig accumulation |
Date: |
Mon, 25 Apr 2016 01:05:42 +0200 |
2016-04-25 0:48 GMT+02:00 David Kastrup <address@hidden>:
> 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
David was faster...
Same problem as sometimes with #/$-signs.
Cheers,
Harm
P.S.
David did not provide an improved code. Maybe because searching it,
may teach more.
Though, we're on the user list, so I attach it for follow readers.
atest-34.ly
Description: Text Data