lilypond-user
[Top][All Lists]
Advanced

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

Re: Conditional fermata padding


From: Martín Rincón Botero
Subject: Re: Conditional fermata padding
Date: Thu, 8 Sep 2022 14:34:40 +0200

Thank you very much, Lukas! Well, I didn't want to bother so much with more conditions. They are namely: only sharp accidentals and only notes starting from the fourth line and higher when the stem is down. For my use case I would just add those extra conditions in abjad. The reason why we have now a default fermata padding of 0.4 and not 0.5, for example, is that the padding should ideally be intelligent enough to cater for these special conditions. 0.4 is for now a universal compromise.

Am Do., 8. Sept. 2022 um 12:30 Uhr schrieb Lukas-Fabian Moser <lfm@gmx.de>:

Hi Martín,

Am 08.09.22 um 10:52 schrieb Martín Rincón Botero:
I would like to have less padding for a fermata when a note has an accidental. Say, if the fermata has a padding of x, I would like it be x-0.1 or so when the note in question has an accidental. I would be thankful for a snippet :-).

Scripts (like a fermata) can be added to a chord (instead of a single note head); which note's accidentals should then be considered?

Anyway, the following snippet changes the padding of a fermata if _any_ of the note heads in the fermata's note column has an accidental:

\version "2.23.10"

mus = \relative {
  f''4 fis fis <fis cis>
  <fis cis> <fis cis>
}

{
  \override Script.before-line-breaking =
  #(lambda (script-grob)
     (let*
      ((script-cause (ly:grob-property script-grob 'cause))
       (articulation-type (ly:event-property script-cause 'articulation-type))
       (default-padding (ly:grob-property script-grob 'padding))
       (note-column (ly:grob-parent script-grob X))
       (note-heads (ly:grob-array->list
                    (ly:grob-object note-column 'note-heads)))
       (accidentals
        (map
         (lambda (note-head) (ly:grob-object note-head 'accidental-grob))
         note-heads)))
      (if (and (eq? articulation-type 'fermata)
               (any ly:grob? accidentals))
          (ly:grob-set-property! script-grob 'padding
                                 (+ default-padding 2)))))

  \time 2/4
  << \mus \repeat unfold 6 s4\fermata >>
  % tenuto (and staccato, ...) should not be changed
  << \mus \repeat unfold 6 s4\tenuto >>
 
}

Note that this needs a fairly recent LilyPond version, since we changed the 'articulation-type from a string to a symbol at the end of 2021.

Lukas



--
www.martinrinconbotero.com

reply via email to

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