[Top][All Lists]

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

Re: Tenuto marking too close to note

From: Jean Abou Samra
Subject: Re: Tenuto marking too close to note
Date: Wed, 29 Dec 2021 15:56:16 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.3.1

Le 29/12/2021 à 09:45, Lukas-Fabian Moser a écrit :

A cleaner and more surgical solution would be:

\version "2.18"

#(assoc-set! (assoc-ref default-script-alist "tenuto") 'padding 0.5)

\new Staff {
  \relative c'' {\time 3/4 a g e--}

Although this approach manipulates internal data structures of LilyPond, it has the advantage of dealing with your issue at the root and not causing side effects for other scripts. Unfortunately, this approach does not work directly for the (still experimental) LilyPond builds using Guile2.

Be mindful that assoc-set! is not guaranteed to
mutate its input. You're not the first one tripped
up by this API quirk :-)  See
I'm occasionally using helpers like the following
to set values in nested alists:

\version "2.22.1" % also works in 2.18 and with Guile 2

#(use-modules (ice-9 match))
#(define (set-path path value alist)
   (let loop ((path path)
              (copy (copy-tree alist)))
       (match path
         (() value)
         ((p . rest)
          (assoc-set! copy p (loop rest (assoc-get p copy '())))))))

\layout {
  \context {
    scriptDefinitions = #(set-path '("tenuto" padding) 0.5 default-script-alist)

  \relative c'' {\time 3/4 a g e--}


reply via email to

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