lilypond-user
[Top][All Lists]
Advanced

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

Re: How split SA staff into two staff - each now has two voices?


From: Janek Warchoł
Subject: Re: How split SA staff into two staff - each now has two voices?
Date: Fri, 1 Aug 2014 11:58:00 +0200

Hi,

2014-08-01 8:06 GMT+02:00 Abraham Lee <address@hidden>:
> I believe this is what you're looking for:
>
> http://www.lilypond.org/doc/v2.18/Documentation/snippets/staff-notation#staff-notation-adding-indicators-to-staves-which-get-split-after-a-break

I believe this snippet is structurally wrong: performers' parts are
artificially split into pieces (even the men's parts, which don't have
to move around staves at all!).  I think that this should be done
differently - see below:

#(define-markup-command (arrow-at-angle layout props angle-deg length fill)
   (number? number? boolean?)
   (let* (
           ;; PI-OVER-180 and degrees->radians are taken from flag-styles.scm
           (PI-OVER-180 (/ (atan 1 1) 45))
           (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)
                   #:arrow-head X RIGHT fill)))))

splitStaffBarLineMarkup = \markup \with-dimensions #'(0 . 0) #'(0 . 0) {
  \combine
  \arrow-at-angle #45 #(sqrt 8) ##f
  \arrow-at-angle #-45 #(sqrt 8) ##f
}

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

\paper {
  ragged-right = ##t
  short-indent = 10\mm
}


splitWomenStaff = {
  \set Staff.instrumentName = "AI AII"
  \set Staff.shortInstrumentName = "AI AII"
  \splitStaffBarLine
}

sI = {
  \voiceOne
  \repeat unfold 4 f''2
  \splitWomenStaff
  \change Staff = "up"
  \repeat unfold 4 g''2
}
sII = {
  s1*2
  \voiceTwo
  \change Staff = "up"
  \repeat unfold 4 d''2
}
aI = {
  \voiceTwo
  \repeat unfold 4 a'2
  \splitWomenStaff
  \voiceOne
  \repeat unfold 4 b'2
}
aII = {
  s1*2
  \voiceTwo
  \repeat unfold 4 g'2
}
ten = {
  \voiceOne
  \repeat unfold 4 c'2
  \repeat unfold 4 d'2
}
bas = {
  \voiceTwo
  \repeat unfold 4 f2
  \repeat unfold 4 g2
}

\score {
  <<
    \new ChoirStaff <<
      %% define a staff that will be later used by some voices
      \new Staff = up \with {
        instrumentName = "SI SII"
        shortInstrumentName = "SI SII"
      } {
        %% keep the staff "alive"
        s1*4
      }

      \new Staff = shared \with {
        instrumentName = "S A"
        shortInstrumentName = "S A"
      } <<
        \new Voice = sopI \sI
        \new Voice = sopII \sII
        \new Voice = altI \aI
        \new Voice = altII \aII
      >>
      \new Lyrics \with {
        alignBelowContext = up
      }
      \lyricsto sopII { e f g h }
      \new Lyrics \lyricsto altI { a b c d e f g h }

      \new Staff = men \with {
        instrumentName = "T B"
        shortInstrumentName = "T B"
      } <<
        \clef F
        \new Voice = ten \ten
        \new Voice = bas \bas
      >>
      \new Lyrics \lyricsto bas { a b c d e f g h }
    >>
  >>
  \layout {
    \context {
      \Staff \RemoveEmptyStaves
      \override VerticalAxisGroup.remove-first = ##t
    }
  }
}

% I'm not 100% satisfied with this code, but i think it's better
% than the snippet in the docs.  Maybe someone would like
% to submit an update?  I don't really have enough time now.

% best,
% Janek



reply via email to

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