lilypond-user
[Top][All Lists]
Advanced

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

Re: \unset with modified default properties


From: David Kastrup
Subject: Re: \unset with modified default properties
Date: Sun, 01 Jul 2018 10:00:25 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Saul Tobin <address@hidden> writes:

> In both 2.18 and 2.19, \unset appears to set a context property to the
> built-in default, rather than the default set in the \with {} block:
>
> music = \relative c' {
>   \tuplet 3/2 {
>     c8 c c d d d e e e f f f |
>   }
>   \set Staff.tupletSpannerDuration = #(ly:make-moment 1/2)
>   \tuplet 3/2 {
>     c8 c c d d d e e e f f f |
>   }
>   \unset Staff.tupletSpannerDuration
>   \tuplet 3/2 {
>     c8 c c d d d e e e f f f |
>   }
> }
>
> \new Staff \with {
>   tupletSpannerDuration = #(ly:make-moment 1/4)
> } \music
>
> In cases like this, I would find it useful to reset the property to the
> custom default value without having to explicitly \set it every time. Is
> there a way to do this? Also, is this the most useful behavior of \unset?

There are several approaches.  The tupletSpannerDuration is actually
interpreted at Voice level, so if you set/unset the Voice level value,
it remains dominant while set and can be unset nicely:

music = \relative c' {
  \tuplet 3/2 {
    c8 c c d d d e e e f f f |
  }
  \set tupletSpannerDuration = #(ly:make-moment 1/2)
  \tuplet 3/2 {
    c8 c c d d d e e e f f f |
  }
  \unset tupletSpannerDuration
  \tuplet 3/2 {
    c8 c c d d d e e e f f f |
  }
}

\new Staff \with {
  tupletSpannerDuration = #(ly:make-moment 1/4)
} \music

But of course for this functionality in particular, use the optional
tuplet spanner duration argument to the \tuplet music function:

music = \relative c' {
  \tuplet 3/2 {
    c8 c c d d d e e e f f f |
  }
  \tuplet 3/2 2 {
    c8 c c d d d e e e f f f |
  }
  \tuplet 3/2 {
    c8 c c d d d e e e f f f |
  }
}

\new Staff \with {
  tupletSpannerDuration = #(ly:make-moment 1/4)
} \music

In fact, I'd lean towards using it always and not even bother setting
tupletSpannerDuration at all.  So basically:

music = \relative c' {
  \tuplet 3/2 4 {
    c8 c c d d d e e e f f f |
  }
  \tuplet 3/2 2 {
    c8 c c d d d e e e f f f |
  }
  \tuplet 3/2 4 {
    c8 c c d d d e e e f f f |
  }
}

\music

It's minimal writing effort and keeps the information where it belongs.

-- 
David Kastrup



reply via email to

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