lilypond-user
[Top][All Lists]
Advanced

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

Re: Beam slashed on the right


From: Thomas Morley
Subject: Re: Beam slashed on the right
Date: Tue, 5 Jul 2016 00:10:17 +0200

2016-07-03 14:56 GMT+02:00 Andrew Bernard <address@hidden>:
> Recently I posted a query about putting a slash (as per grace notes) on the
> right hand side of a beamed group, posting the code I have which does a very
> fine job of this for the left hand side.
>
> Having received no response, does no-one have any thoughts on the matter?
>
> The attached image shows the sort of thing I need to do.
>
> Andrew


Hi Andrew,

the code below has to be adjusted manually and it is not that robust
against layout-changes. Maybe a starting-point, though.

\version "2.19.44"

#(ly:set-option 'debug-skylines #t)

rightSlashBeam =
#(define-music-function (from to y-off)(pair? pair? number?)
#{
  \once \override Beam.stencil =
    #(lambda (grob)
      (let* ((stil (ly:beam::print grob))
             (beam-dir (ly:grob-property grob 'direction))
             (thick 0.1)
             (slash
               (make-line-stencil
                 thick
                 (car from)
                 (cdr from)
                 (car to)
                 (cdr to))))
        (ly:stencil-combine-at-edge
          stil
          Y
          beam-dir
          (ly:stencil-translate-axis
            slash
            (interval-length (ly:stencil-extent stil X))
            X)
          y-off)))
#})


\new PianoStaff <<
  \new Staff = "1"
  \with {
    \override VerticalAxisGroup.staff-staff-spacing.minimum-distance = 15
  }
  {
      s4
      \grace {
      \stemDown
      \rightSlashBeam #'(-3 . 0.5) #'(1.5 . 5) #-8
      g'32[
      s
      e8
      \change Staff = "2"
      \stemUp
      cis32 dis8
    \change Staff = "1"
    \stemDown
    c'! e' aes' g'! bes' f'']
    }

      \stemUp
      \rightSlashBeam #'(-3 . 0.5) #'(1.5 . -5) #-4
    bes'32[ aes''' d'! aes'''! fis'' c'' fis''!]

  }
  \new Staff = "2" {
    \clef bass
    s4 s32*7
  }
>>

Cheers,
  Harm



reply via email to

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