lilypond-user
[Top][All Lists]
Advanced

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

Re: TimeSignatures over BarLines


From: Thomas Morley
Subject: Re: TimeSignatures over BarLines
Date: Fri, 8 May 2015 02:38:57 +0200

2015-05-08 2:29 GMT+02:00 Thomas Morley <address@hidden>:
> 2015-05-07 18:48 GMT+02:00 Alexander Kobel <address@hidden>:
>> 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
>
>
>
> Hi,
>
> how about:
>
>
> \version "2.19.18"
>
> 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 #})
>
> move-time-sig-into-bar-line =
> \override Staff.BarLine.before-line-breaking =
>   #(lambda (grob)
>     (let* (
>            (b-a-g (ly:grob-parent grob X))
>            (b-a (ly:grob-parent b-a-g X))
>            (elts (ly:grob-array->list (ly:grob-object b-a 'elements)))
>            (break-align-groups
>              (filter
>                (lambda (g)
>                  (grob::has-interface g 'break-aligned-interface))
>                  elts))
>            (b-a-g-elts
>              (apply append
>               (map
>                (lambda (g)
>                  (ly:grob-array->list (ly:grob-object g 'elements)))
>                break-align-groups)))
>            (time-sig
>              (filter
>                (lambda (g)
>                    (grob::has-interface g 'time-signature-interface))
>                b-a-g-elts))
>            (bar-line
>              (filter
>                (lambda (g)
>                    (grob::has-interface g 'bar-line-interface))
>                b-a-g-elts)))
>   (if (and (not (null? time-sig)) (not (null? bar-line)))
>       ;; TODO:
>       ;; only the first entry of time-sig and bar-line are affected
>       ;; may cause problems in cases where a StaffGroup contains Staffs with
>       ;; different settings for TimeSignature and/or BarLine
>       (let* ((time-sig-length
>                (interval-length
>                  (ly:grob-extent (car time-sig) (car time-sig) X)))
>              (bar-line-length
>                (interval-length
>                  (ly:grob-extent (car bar-line) (car bar-line) X))))
>         (ly:grob-set-property! grob 'space-alist
>           `((time-signature extra-space
>               .
>               ,(/ (+ time-sig-length bar-line-length) -2))
>             (custos minimum-space . 2.0)
>             (clef minimum-space . 1.0)
>             (key-signature extra-space . 1.0)
>             (key-cancellation extra-space . 1.0)
>             (first-note fixed-space . 0.3)
>             (next-note semi-fixed-space . 0.9)
>             (right-edge extra-space . 0.0)))

Next two lines don't work. Delete them for now.

>        (if (= (ly:item-break-dir grob) LEFT)
>            (ly:grob-set-property! (car time-sig) 'X-extent '(0 . 0)))))))
>
>
> time-sig-space-at-line-end =
> \override Staff.TimeSignature.space-alist =
>   #'((cue-clef extra-space . 1.5)
>      (first-note fixed-space . 2.0)
>      ;; not sure how it should look, for now hardcoded
>      (right-edge extra-space . 0)
>      (staff-bar extra-space . 1.0))
>
> 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
>   \once \override Score.RehearsalMark.break-visibility = ##(#t #f #f)
>   \once \override Score.RehearsalMark.self-alignment-X = #0.85
>   \mark \markup \right-column { "not sure" "how it" "should look" ↓ }
>   | c1
> }
>
> #(set-global-staff-size 16.5)
>
> \paper {
>   left-margin = 15\mm
>   right-margin = 15\mm
> }
>
> \score {
>   \new Staff << \global \mel >>
>
>   \layout {
>     \context {
>       \Staff
>       \move-time-sig-into-bar-line
>       \time-sig-space-at-line-end
>       \override TimeSignature.style = #'single-digit
>       % \override TimeSignature.break-visibility = #end-of-line-invisible
>     }
>   }
> }
>
>
> There's a TODO in it ...
> And I'm not sure how the combination of time-sig and (double-)bar-line
> at line-end should look like.
> If the bar-line is really at line-end the time-sig will stick out to
> the right. Is this wanted?
>
> Cheers,
>   Harm



reply via email to

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