lilypond-user
[Top][All Lists]
Advanced

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

Re: \override multiple properties?


From: Aaron Hill
Subject: Re: \override multiple properties?
Date: Sat, 01 Feb 2020 19:35:16 -0800
User-agent: Roundcube Webmail/1.4.2

On 2020-02-01 6:46 pm, Bric wrote:
In my case i am needing to override a series of notes and then revert.
 (So, don't want to use "\once"). I have already used your construct,
coupling it with reverting directives grouped the same way (with a
named group):

emphasizeStem = {
   \override Stem.thickness = #3.0
   \override Stem.color = #'(0.5 0.3 0.2)
}

revertStem = {
  \revert Stem.thickness
  \revert Stem.color
}

The \undo command can be useful to avoid needing to individually \revert:

%%%%
{ d'8 \emphasizeStem d' e' f' \undo \emphasizeStem g'4 d' }
%%%%


What would be nice is be able to parametrize those blocks somehow

But, i guess, that can only be done with a Scheme function? I'm shaky on scheme.

Music functions certainly give you the most flexibility, although there are simple cases where you can use 2.19's \etc keyword as a shorthand to defining the function yourself:

%%%%
\version "2.19"

stemColor = \override Stem.color = \etc

{ d'8 \stemColor #red e' f' \undo \stemColor ##f g' }
%%%%

Note the \undo command above is less ideal as one needs to provide a dummy argument to the function.

Here would be one way to parameterize \emphasizeStem:

%%%%
\version "2.19"

emphasizeStem = #(define-music-function
  (thickness color)
  ((number? 3) color?)
  #{ \override Stem.thickness = #thickness
     \override Stem.color = #color #})

{ \emphasizeStem #red d'8 e'4
  \emphasizeStem 6 #blue f'2 }
%%%%

The above demonstrates how the first argument could be made optional.


-- Aaron Hill



reply via email to

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