Hi, Neil!
On Sat, Jun 23, 2012 at 5:46 PM, Neil Thornock <[email protected]>wrote:
> I'm using music expressions, each with their own time signatures, in
> random orderings. I won't know when two measures will have the same
> time signature in a row, so I'm wondering if there is some way to
> check for the time sig of the previous measure and, if it is the same
> as the current measure, turn off the stencil for the current measure.
>
> Is there an auto setting for this? Or do I need scheme (which I'm not good
> at)?
I'm not aware of a setting to do this automatically (which doesn't mean
there isn't one!) Here's a Scheme engraver which should hopefully do what
you want:
\version "2.14.2"
suppressExtraTimeSig =
#(lambda (ctx)
(let ((time-sig '())
(to-compare #f))
`((acknowledgers
(time-signature-interface
. ,(lambda (engraver grob source-engraver)
(if to-compare
(set! time-sig grob)
(set! to-compare grob)))))
(process-music
. ,(lambda (trans)
(if (and (ly:grob? to-compare)
(ly:grob? time-sig)
(not (eq? to-compare time-sig))) ; check for same grob
(if (equal? (ly:grob-property to-compare 'fraction)
(ly:grob-property time-sig 'fraction))
(begin
(ly:grob-suicide! time-sig)
(set! time-sig '()))
(set! to-compare time-sig))))))))
expA = {
\time 3/4
c c c
}
expB = {
\time 5/4
c c c c c
}
expC = {
\time 4/4
c c c c
}
\relative c'' {
\expA
\expB
\expC
\repeat unfold 5 \expA
\expB
\expB
\repeat unfold 10 \expC
}
\layout {
\context {
\Staff
\consists \suppressExtraTimeSig
}
}
HTH,
David
_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user