lilypond-user
[Top][All Lists]
Advanced

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

Re: can bendAfter be made to skip over notes?


From: Aaron Hill
Subject: Re: can bendAfter be made to skip over notes?
Date: Mon, 26 Oct 2020 22:56:41 -0700
User-agent: Roundcube Webmail/1.4.9

On 2020-10-26 10:54 pm, Aaron Hill wrote:
On 2020-10-26 7:37 pm, 98123981293 1293812397123 wrote:
Hi list,

I usually use the following snippet to handle glissandi across hidden
noteheads:

glissandoSkipOn = {
  \override NoteColumn.glissando-skip = ##t
  \hide NoteHead
  \override Accidental.transparent = ##t
  \override NoteHead.no-ledgers = ##t
}

is it possible to implement something similar for bendAfter? A quick check of the archives did not reveal anything relevant but please link me if this has already been covered. Pic attached with the line as I want it to look
in green.

Thank you,
Kyle

The Glissando_engraver knows to look for glissando-skip, however no
such logic exists for Bend_engraver.  It would be possible to re-write
the engraver and introduce a new bend-skip context property, however a
perhaps simpler option is to change the stencil for a glissando to
look like a bend:

[...]

Sorry, I pasted an old version of the code that did not handle the vertical alignment properly:

%%%%
\version "2.20.0"

bend-glissando-print =
#(lambda (grob)
  (let* ((lnh (ly:spanner-bound grob LEFT))
         (rnh (ly:spanner-bound grob RIGHT))
         (lsp (ly:grob-staff-position lnh))
         (rsp (ly:grob-staff-position rnh))
         (dy (/ (- rsp lsp) 2))
         (dot (ly:grob-object lnh 'dot))
         (acc (ly:grob-object rnh 'accidental-grob))
         (th (* (ly:grob-property grob 'thickness 1)
                (ly:output-def-lookup (ly:grob-layout grob)
                                      'line-thickness)))
         (pad (ly:grob-property grob 'padding 0.5))
         (cmx (ly:grob-common-refpoint
                (ly:grob-common-refpoint grob lnh X) rnh X))
         (cmy (ly:grob-common-refpoint grob lnh Y))
(lx (+ pad (max (interval-end (ly:generic-bound-extent lnh cmx))
                         (if dot
                             (interval-end
(ly:grob-robust-relative-extent dot cmx X))
                             (- INFINITY-INT)))))
         (rx (- (min (interval-start (ly:generic-bound-extent rnh cmx))
                     (if acc
                         (interval-start
                          (ly:grob-robust-relative-extent acc cmx X))
                         INFINITY-INT))
                pad))
         (dx (- rx lx))
         (sx (ly:grob-relative-coordinate grob cmx X)))
    (ly:make-stencil
      (list 'path th
        `(quote
          (rmoveto ,(- lx sx) ,(/ lsp 2)
           rcurveto ,(/ dx 3) 0 ,dx ,(* dy 2/3) ,dx ,dy)))
      (cons (- lx sx) (- rx sx))
      (cons (+ (/ lsp 2) (min 0 dy)) (+ 0.5 (max 0 dy))))))

bendGlissando =
  \tweak thickness #2
  \tweak stencil #bend-glissando-print
  \glissando

{ c''2. \bendGlissando
  \once \override NoteColumn.glissando-skip = ##t
  e'4 gis'1 }
%%%%

-- Aaron Hill



reply via email to

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