[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: tuplet full length at breaks with large time signatures
From: |
Thomas Morley |
Subject: |
Re: tuplet full length at breaks with large time signatures |
Date: |
Tue, 21 Mar 2017 23:41:02 +0100 |
2017-03-21 22:12 GMT+01:00 Juan Cristóbal Cerrillo <address@hidden>:
> Hello everyone,
>
> I’m working on a score with large time signatures. I’ve created a specific
> context for this purpose. However, overriding
> TimeSignature.break-align-symbol causes problems with full length tuplets at
> breaks. Please compare bars 3 and 4 in the following example. The bracket
> should ideally extend the same in both bars, but in bar 4 it is much shorter
> because of the break. The same happens in bar 8 but not in bar 12.
> How can I achieve this?
> Any help would be greatly appreciated.
>
> All best,
>
> jc
>
> \version "2.18.2"
>
> \paper {
> ragged-bottom = ##t
> ragged-right = ##t
> }
>
> \layout {
> \context {\type "Engraver_group"
> \consists "Time_signature_engraver"
> \consists "Axis_group_engraver"
> \name "TimeSig"
> \alias "Staff"
> \override TimeSignature.style = #'numbered
> \override TimeSignature.font-size = #6
> \override TimeSignature.break-align-symbol = #'staff-bar
> \override TimeSignature.X-offset =
> #ly:self-alignment-interface::x-aligned-on-self
> \override TimeSignature.self-alignment-X = #CENTER
>
> }
> \context {\Score
> \accepts TimeSig
> }
> \context {\StaffGroup
> \accepts TimeSig
> }
> \context {\Staff
> \remove "Time_signature_engraver"
> tupletFullLength = ##t
> \override TupletBracket.full-length-padding = -1
> }
> }
>
> music = \relative c''
> {
> \tupletUp
> \repeat unfold 3 {
> \time 4/4
> \tuplet 5/4 {
> c2 c c4
> }
> \time 3/4
> \tuplet 5/3 {
> c4 c2. c4
> }
> \time 4/4
> \tuplet 5/4 {
> c2 c c4
> }
> \time 4/4
> \tuplet 5/4 {
> c2 c c4
> }
> \break
> }
> }
>
> \score {
> \new StaffGroup
> <<
> \new TimeSig
> \new Staff \music
> \new Staff \music
> >>
> }
Hi,
how about below?
\version "2.19.57"
#(define (at-line-end? grob)
;; Thanks to David Nalesnik
(let* ((col (ly:item-get-column grob))
(ln (ly:grob-object col 'right-neighbor))
(col-to-check (if (ly:grob? ln) ln col)))
(and (eq? #t (ly:grob-property col-to-check 'non-musical))
(= -1 (ly:item-break-dir col-to-check)))))
\paper {
ragged-bottom = ##t
ragged-right = ##t
}
\layout {
\context {
\type "Engraver_group"
\consists "Time_signature_engraver"
\consists "Axis_group_engraver"
\name "TimeSig"
\alias "Staff"
\override TimeSignature.style = #'numbered
\override TimeSignature.font-size = #6
\override TimeSignature.break-align-symbol = #'staff-bar
\override TimeSignature.X-offset =
#ly:self-alignment-interface::x-aligned-on-self
\override TimeSignature.self-alignment-X = #CENTER
%% Adjust extension of the TimeSig, otherwise it interferes with other items
%% TODO is this the best method?
%% Check whether moving for half X-extent is possible/cheaper
\override TimeSignature.stencil =
#(lambda (grob)
(let* ((stil (ly:time-signature::print grob))
(stil-center (interval-center (ly:stencil-extent stil X))))
(ly:make-stencil
(ly:stencil-expr stil)
(cons stil-center stil-center)
(ly:stencil-extent stil Y))))
}
\context {\Score
\accepts TimeSig
}
\context {\StaffGroup
\accepts TimeSig
}
\context {
\Staff
\remove "Time_signature_engraver"
tupletFullLength = ##t
%% shorten the length of the TupletBracket at line-end, _iff_
%% tupletFullLength is set true
\applyContext
#(lambda (ctx)
(ly:context-pushpop-property ctx 'TupletBracket 'after-line-breaking
(lambda (g)
(if (and (at-line-end? (ly:spanner-bound g RIGHT))
(->bool (ly:context-property ctx 'tupletFullLength)))
(ly:grob-set-property! g 'shorten-pair
(cons 0
(+ (/ (ly:staff-symbol-staff-space g) 2)
(ly:staff-symbol-line-thickness g))))))))
}
}
music = \relative c''
{
\tupletUp
\repeat unfold 3 {
\time 4/4
\tuplet 5/4 {
c2 c c4
}
\time 3/4
\tuplet 5/3 {
c4 c2. c4
}
\time 4/4
\tuplet 5/4 {
c2 c c4
}
\time 4/4
\tuplet 5/4 {
c2 c c4
}
\break
}
}
\score {
\new StaffGroup
<<
\new TimeSig
\new Staff \music
\new Staff \music
>>
}
Cheers,
Harm