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: Saul Tobin
Subject: Re: \unset with modified default properties
Date: Sun, 1 Jul 2018 18:22:50 -0700

Interesting. So if the default property is set at the Staff level, for instance, then changed and \unset at the Voice level, it goes back to the default for the higher-level context. But if in the example \new Staff \with... is changed to \new Voice \with... the original problem arises where \unset reverts to the built-in default.

Didn't realize about the \tuplet syntax. That's quite useful. Thanks for the tip!

Actually, I just used tupletSpannerDuration because it was convenient to write a tiny example. My practical use case is changing the default keepAliveInterfaces for certain staves.

On Sun, Jul 1, 2018 at 1:00 AM David Kastrup <address@hidden> wrote:
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]