lilypond-user
[Top][All Lists]
Advanced

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

Re: ending a staff with "split arrows"


From: Pierre Perol-Schneider
Subject: Re: ending a staff with "split arrows"
Date: Sat, 14 Sep 2019 18:28:31 +0200

Not nice but works:

%%%  SNIPPET BEGINS
\version "2.19.83"
\include "arrows.ily"

#(define-markup-command (arrow-at-angle layout props angle-deg) (number?)
   (let* ((PI-OVER-180 (/ (atan 1 1) 34))
          (degrees->radians (lambda (degrees) (* degrees PI-OVER-180)))
          (angle-rad (degrees->radians angle-deg))
          (target-x (* 3 (cos angle-rad)))
          (target-y (* 3 (sin angle-rad))))
     (interpret-markup layout props
       (markup
        #:translate (cons (/ target-x 2.1) (/ target-y 2.1))
        #:rotate angle-deg
        #:arrow "closed" #f 0 1 3.5 .1))))


testingMusic = {
  c'1
  \once \override Staff.BarLine.stencil =
  #(lambda (grob)
     (ly:stencil-combine-at-edge
      (ly:bar-line::print grob)
      X RIGHT
      (grob-interpret-markup grob
        #{
          \markup\with-dimensions-from\null {
            \translate #'(5 . 0)
            \combine
            \arrow-at-angle #-30
            \arrow-at-angle #30
          }
        #})
      0))
  \break
  \time 3/4 c'2.
  \once \override Staff.BarLine.stencil =
  #(lambda (grob)
     (ly:stencil-combine-at-edge
      (ly:bar-line::print grob)
      X RIGHT
      (grob-interpret-markup grob
        #{
          \markup\with-dimensions-from\null {
            \translate #'(8.2 . 0)
            \combine
            \arrow-at-angle #-30
            \arrow-at-angle #30
          }
        #})
      0))
  \break
  \key bes \major \time 4/4 c'1
  \once \override Staff.BarLine.stencil =
  #(lambda (grob)
     (ly:stencil-combine-at-edge
      (ly:bar-line::print grob)
      X RIGHT
      (grob-interpret-markup grob
        #{
          \markup\with-dimensions-from\null {
            \translate #'(8.8 . 0)
            \combine
            \arrow-at-angle #-30
            \arrow-at-angle #30
          }
        #})
      0))
  \break
  \key a \major c'1
}

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

See: http://lsr.di.unimi.it/LSR/Item?id=1026 for "arrows.ily"
HTH, Cheers,
Pierre

Le sam. 14 sept. 2019 à 17:19, Kieren MacMillan <address@hidden> a écrit :
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


_______________________________________________
lilypond-user mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/lilypond-user

reply via email to

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