At 13:17 on 03 Mar 2019, David Kastrup wrote:
> Mark Knoop <[email protected]> writes:
>> Often in the music I'm engraving a single variable might be used and
>> transformed in multiple contexts and repetitions throughout the
>> piece. This can become difficult to keep track of, particularly if
>> subsequent changes are made which might want to affect only one or
>> some of the instances.
>>
>> It would be great to be able to display the use of variables
>> throughout a score, I imagine by writing a custom engraver for this.
>
> Variable use does not sound like a use case for engravers since
> engravers work at a different stage than variable use.

Yes, I thought this might be the case.

> How about something like
>
> motif = { c'4 e' g' c'' }
>
> make-obvious =
> #(define-void-function (x) (symbol?)
>    (let ((old (ly:music-deep-copy (ly:parser-lookup x))))
>      (ly:parser-define! x
>        (define-music-function () ()
>          #{ \context Bottom << <>-#(format "Variable: ~s" x) $old >> #}))))
>
> \make-obvious motif
>
> I apologize for vandalizing your code and throwing out the bulk of
> functionality and markup you put in but that was just a quick and easy
> job.

That's brilliant, thanks. I'll work more with that and see where it takes me.

--
Mark Knoop

_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to