lilypond-user
[Top][All Lists]
Advanced

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

System delimiters for middle of stave


From: Alex Voice
Subject: System delimiters for middle of stave
Date: 23 Jul 2023 20:06:05 +0100

Dear Lilypond experts,

In a carol commission by a composer colleague involving several independent choirs and organ I need to be able to stop a choir system and then start it a few bars later in the middle of a stave (there are, I think, good practical reasons for wishing to try to achieve this). I found a method Jean had posted earlier this year on Music.StackExchange (https://music.stackexchange.com/questions/127631/how-can-i-insert-an-additional-systemstartbrace-into-a-pianostaff-in-lilypond) which achieves this, but not in the context of other systems continuing around it.

It requires a bit of Jean’s excellent Scheme-ing, but I have tried otherwise to minimise my example of how this nearly works, though it is not quite a MWE:

% --------------
\version "2.25.3"

#(define replicate-stil
   (grob-transformer
    'stencil
    (lambda (grob original)
      (let* ((replicate (ly:grob-array->list (ly:grob-object grob 'replicate-on-cols)))
             (left (ly:spanner-bound grob LEFT))
             (own (interval-start (ly:paper-column::break-align-width left 'clef)))
             (sts (map (lambda (col)
                         (let ((tr (interval-start (ly:paper-column::break-align-width col 'clef))))
                           (ly:stencil-outline
                            (ly:stencil-translate-axis original (- tr own) X)
                            empty-stencil)))
                       replicate)))
        (apply ly:stencil-add (cons original sts))))))

\layout {
  \context {
    \Score
    \consists
    #(lambda (context)
       (let ((delims '())
             (cols '()))
         (make-engraver
          (acknowledgers
           ((system-start-delimiter-interface engraver grob source-engraver)
            (set! delims (cons grob delims))))
          ((stop-translation-timestep engraver)
           (let ((col (ly:context-property context 'currentCommandColumn)))
             (when (assoc-get 'replicate-delims (ly:grob-property col 'details))
               (set! cols (cons col cols)))))
          ((finalize engraver)
           (for-each (lambda (delim)
                       (ly:grob-set-object! delim 'replicate-on-cols (ly:grob-list->grob-array cols)))
                     delims)))))
    \override SystemStartBar.stencil = #replicate-stil
    \override SystemStartBracket.stencil = #replicate-stil
    \override SystemStartBrace.stencil = #replicate-stil
    \override SystemStartSquare.stencil = #replicate-stil
  }
}

replicateDelims = {
  \once \override Score.NonMusicalPaperColumn.details.replicate-delims = ##t
  \once \set Staff.forceClef = ##t
  \once \override Staff.Clef.full-size-change = ##t
  \once \set Score.measureBarType = ##f
  \once \override Score.BreakAlignment.X-extent =
  #(lambda (grob)
     (match-let (((a . b) (ly:axis-group-interface::width grob)))
                (cons (- a 0.8) b)))
}

sopmusic = \relative c' {
  c4 c c c
  \once \omit Staff.TimeSignature
  \stopStaff
  s2.
  \replicateDelims
  \startStaff
  \time 4/4
  c8 e f d c2
}

tenmusic = \relative c {
  \clef "treble_8"
  c4 c c c
  \once \omit Staff.TimeSignature
  \stopStaff
  s2.
  \replicateDelims
  \startStaff
  \time 4/4
  e8 g d f e2
}

organUp = \relative c' {
  c8 e g c e, g c e 
  \time 3/4
  g8 e c g c e
  \time 4/4
  g1
}

organDown = \relative c {
  \clef bass
  c8 e g c e, g c e 
  \time 3/4
  g8 e c g c e
  \time 4/4
  \clef treble
  g1
}

\score {
  <<
    \new ChoirStaff = “Choir_II” <<
      \new Staff = "soprano" \sopmusic
      \new Staff = "tenor" \tenmusic  >>
   
    \new PianoStaff = “Organ"  <<
      \new Staff \organUp
      \new Staff \organDown  >>
  >> 
}

% --------------

I should like, if possible, 
This has been the most challenging score I have tackled (my colleague having given up on other engraving programs for this). If it were possible to achieve any or all this I would be so grateful.

With many thanks in advance.

Alex Voice

reply via email to

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