lilypond-user
[Top][All Lists]
Advanced

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

Re: Defining variables mid-stream in a music expression using tags.


From: dfro
Subject: Re: Defining variables mid-stream in a music expression using tags.
Date: Thu, 18 May 2023 11:46:18 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0

Valentin,

Thank you, for the  explanation! I see what you mean about controlling when evaluation happens by avoiding global variables that change during the flow of a music expression. I will avoid doing that.

I see now that it is better to create two or more static global variables and switch music/markup function behavior by calling different global variables as the input variable to a music or markup function in the music expression. I have been doing it that way.

 Could you please show me what you mean by the quote below from your response? That sounds interesting, but I am not getting it.


On 5/18/23 06:31, Valentin Petzel wrote:
More generally if you want have parts of your score behave in a conditionally
different manner it may also be an option to wrap your whole music expression
into a markup function which behaves differently based on some parameter.

The \keepWithTag #'... command outside the music expression when the staves are created, is the only way I know of switching behavior of markup functions between staves, while using the same music expression.

I would like to be able to declare a variable that has a scope at the staff level, and effects the markup/music functions within that staff and not other staves.

I hope that I am not belaboring the point. The method with the static global variables, tags, music function, and markup function works. I am just wondering if there is a simpler way.


Peace,

David





reply via email to

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