Dear all,

I'm trying to move time signatures to print over bar lines for a modern piece, to allow for a proportional (or almost proportional) note spacing despite several time changes.

The usual approach is to place them over the staff, like here:
  http://lsr.di.unimi.it/LSR/Item?id=272
However, the full piece has a whole bunch of staves, so vertical space is at a premium; for each staff, the signatures do not fit, and I feel that a single time signature over the score is not enough. Hence, I decided to break the bar line stencil into two short slices, and squeeze the time signature in between.

I'm almost there. The missing piece is automatic adjustment of time signatures at the beginning of a system. If realignTimeSignatures in the attached example is delayed by one measure, the default placement of the first time signature is perfect - as usual. However, I could not find a way to do the same for the time signature in the fourth system (other than manually reverting the overrides).
I achieve either
1) a nice placement of the in-line signature (with \realignTimeSignatures), but have to shift the begin-of-line ones by some amount and cannot make enough space for them, xor 2) the default position for the begin-of-line signatures (with \realignTimeSignaturesII), but then I cannot position barlines and time signatures on top of each other.
Can anyone enlighten me here?

Bonus points for someone who can come up with a proper centered alignment of the "4" in the double bar line at the /end/ of the third system...


Thanks in advance,
Alexander
\version "2.19.15"

cTime =
#(define-music-function (parser location time) (fraction?)
   #{ \once \override Staff.BarLine #'stencil =
      #(lambda (grob)
         (ly:grob-set-property! grob 'bar-extent '(-2 . -1))
         (ly:stencil-add
          (ly:bar-line::print grob)
          (ly:stencil-translate-axis (ly:bar-line::print grob) 3 Y)))
      \time $time #})

global = {
  \cTime 2/4 s2*8 \cTime 3/4 s2. \cTime 2/4 s2*4 \break
  s2*2 \cTime 3/4 s2. \cTime 2/4 s2 \cTime 3/4 s2. \cTime 2/4 s2*5 \cTime 3/4 s2. \cTime 2/4 s2 \cTime 3/4 s2. \break
  s2. \cTime 2/4 s2 \cTime 3/4 s2. \cTime 2/4 s2*2 \cTime 4/4 s1 \cTime 2/4 s2*5 \cTime 4/4 s1 \cTime 2/4 s2 \bar "||" \break
  \cTime 4/4 s1
}

mel = \relative c'' {
  | c2 | c | c | c | R | R
  | c2 | c | c c4 | c2 | c | R | R
  | c2 | c | c c4 | c2 | c c4 | c2 c | R
  | c2 | c | c c4 | c2 | c c4 | c2. | c4 c | c2 c4 | c2 | c | R1 | R2
  | c2 | c | c | c | R1 | R2
  | c1
}

realignTimeSignatures = {
  \override Staff.TimeSignature.break-align-symbol = ##f
  \override Staff.TimeSignature.X-offset = #ly:self-alignment-interface::x-aligned-on-self
  \override Staff.TimeSignature.self-alignment-X = #CENTER
  \override Staff.TimeSignature.after-line-breaking =
  #(lambda (grob)
     (if (= (ly:item-break-dir grob) RIGHT)
         (ly:grob-translate-axis! grob 5.5 X)))
}

realignTimeSignaturesII = {
  \override Staff.TimeSignature.after-line-breaking =
  #(lambda (grob)
     (if (not (= (ly:item-break-dir grob) RIGHT))
         (begin
          (ly:grob-set-property! grob 'break-align-symbol #f)
          (ly:grob-set-property! grob 'X-offset ly:self-alignment-interface::x-aligned-on-self)
          (ly:grob-set-property! grob 'self-alignment-X CENTER))))
}

perStaff = {
 \override Staff.BarLine #'stencil =
    #(lambda (grob)
      (let ((default-bar-glyph? (equal? (ly:grob-property grob 'glyph) "|")))
      (if default-bar-glyph?
        (begin
          (ly:grob-set-property! grob 'bar-extent '(1 . 2))
          ;(ly:grob-set-property! grob 'extra-offset '(0 . 1))
          (ly:bar-line::print grob))
        (ly:bar-line::print grob))))
  \realignTimeSignatures
  % \set Score.proportionalNotationDuration = #(ly:make-moment 1/4)
  \override Score.SpacingSpanner.strict-note-spacing = ##t
}

#(set-global-staff-size 16.5)

\paper {
  left-margin = 15\mm
  right-margin = 15\mm
}

\score {
  \new Staff << \global \perStaff \mel >>
  \layout {
    \context {
      \Staff
      \override BarLine.space-alist.next-note = #'(semi-fixed-space . 0)
      \override TimeSignature.style = #'single-digit
      % \override TimeSignature.break-visibility = #end-of-line-invisible
    }
  }
}
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to