lilypond-user
[Top][All Lists]
Advanced

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

Re: Two arpeggio lines (up and down) next to each other


From: Lukas-Fabian Moser
Subject: Re: Two arpeggio lines (up and down) next to each other
Date: Mon, 11 Oct 2021 22:51:30 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0


The problem is that this arpeggio is not taken into account for spacing: The 
next note will be too close. I'm not yet sure what would be The Right Way to 
change this, as neither X-extent nor extra-spacing-width of the arpeggio seem 
to have an effect for spacing to the right. You can tweak (for instance) 
NoteHead's extra-spacing-width, but that is far from elegant.
Hmmm… That seems like a bug, or at least a good candidate for a feature 
request. There are a whole bunch of other ways to clothe that particular cat, 
but tweaking the width/spacing sure seems like The Right Way™.

Jean Abou Samra knew how to fix that behaviour of arpeggios, so here's a (I hope) working solution:

\version "2.22"

Arpeggio_axis_group_engraver =
% Due to Jean Abou Samra
% cf. https://gitlab.com/lilypond/lilypond/-/issues/6193#note_700760004
#(lambda (context)
   (let ((arpeggio #f)
         (note-column #f))
     (make-engraver
      (acknowledgers
       ((arpeggio-interface engraver grob source-engraver)
        (set! arpeggio grob))
       ((note-column-interface engraver grob source-engraver)
        (set! note-column grob)))
      ((process-acknowledged engraver)
       (if (and arpeggio note-column)
           (begin
            (ly:axis-group-interface::add-element note-column arpeggio)
            (set! arpeggio #f)
            (set! note-column #f))))
      ((stop-translation-timestep engraver)
       (set! arpeggio #f)
       (set! note-column #f)))))

\layout {
  \context {
    \Voice
    \consists #Arpeggio_axis_group_engraver
  }
}

arpeggioUpDown = {
  \override Arpeggio.stencil =
  #(lambda (grob)
     (let ((one #f) (two #f) (combined-stencil #f))
       (ly:grob-set-property! grob 'arpeggio-direction UP)
       (set! one (ly:arpeggio::print grob))
       (ly:grob-set-property! grob 'arpeggio-direction DOWN)
       (set! two (ly:arpeggio::print grob))
       (set! combined-stencil
             (ly:stencil-add
              one
              (ly:stencil-translate-axis two 1.25 X)))
       (ly:grob-set-property!
        grob 'X-extent
        (ly:stencil-extent combined-stencil X))
       combined-stencil))
  \override Arpeggio.direction = #RIGHT
}

{
  \once \arpeggioUpDown
  <c' e' g' c''>\arpeggio
  c'
}

Lukas




reply via email to

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