lilypond-user
[Top][All Lists]
Advanced

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

ending a staff with "split arrows"


From: Kieren MacMillan
Subject: ending a staff with "split arrows"
Date: Sat, 14 Sep 2019 11:18:59 -0400

Hi all,

In the following snippet, I’ve built my preferred markup to indicate that a 
shared choral staff (e.g., sopranos & altos) splits across the system break 
into two independent staves (e.g., a soprano staff and an alto staff). As you 
can see, it fails when there are extra prefatory items.

What I believe I want to do is attach the markup to the end of the StaffSymbol 
instead of BarLine… but I can’t seem to find the proper incantation.

Any assistance or hints would be appreciated.

Thanks!
Kieren.

%%%  SNIPPET BEGINS
\version "2.19.83"

#(define-markup-command (arrow-at-angle layout props angle-deg length fill)
   (number? number? boolean?)
   (let* (
           (PI-OVER-180 (/ (atan 1 1) 34))
           (degrees->radians (lambda (degrees) (* degrees PI-OVER-180)))
           (angle-rad (degrees->radians angle-deg))
           (target-x (* length (cos angle-rad)))
           (target-y (* length (sin angle-rad))))
     (interpret-markup layout props
       (markup
        #:translate (cons (/ target-x 2) (/ target-y 2))
        #:rotate angle-deg
        #:translate (cons (/ length -2) 0)
        #:concat (#:draw-line (cons length 0)
                   #:hspace -0.125
                   #:arrow-head X RIGHT fill)))))

arrowDownForBarline = \markup \arrow-at-angle #-30 #(sqrt 4) ##t
arrowUpForBarline = \markup \arrow-at-angle #30 #(sqrt 4) ##t

arrowUpBarlineMarkup =
\markup
  \with-dimensions #'(0 . 0) #'(0 . 0)
  \override #'(thickness . 1.5)
  \concat { \hspace #0.375 \arrowUpForBarline }
arrowDownBarlineMarkup =
\markup
  \with-dimensions #'(0 . 0) #'(0 . 0)
  \override #'(thickness . 1.5)
  \concat { \hspace #0.375 \arrowDownForBarline }
arrowsSplitBarlineMarkup =
\markup
  \with-dimensions #'(0 . 0) #'(0 . 0)
  \override #'(thickness . 1.5) {
    \concat
    {
      \hspace #0.375
      \combine
        \raise #0.4 \arrowUpForBarline
        \lower #0.4 \arrowDownForBarline
    }
  }

staffBarLineArrowsSplit = {
  \once \override Staff.BarLine.stencil =
  #(lambda (grob)
     (ly:stencil-combine-at-edge
      (ly:bar-line::print grob)
      X RIGHT
      (grob-interpret-markup grob arrowsSplitBarlineMarkup)
      0))
  \break
}

testingMusic = {
  c'1 \staffBarLineArrowsSplit
  \time 3/4 c'2. \staffBarLineArrowsSplit
  \key bes \major \time 4/4 c'1 \staffBarLineArrowsSplit
  \key a \major c'1
}

\score {
  \new Staff \testingMusic
}
%%%  SNIPPET ENDS
________________________________

Kieren MacMillan, composer (he/him/his)
‣ website: www.kierenmacmillan.info
‣ email: address@hidden




reply via email to

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