lilypond-user
[Top][All Lists]
Advanced

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

Re: TimeSignature Event


From: Jan-Peter Voigt
Subject: Re: TimeSignature Event
Date: Sun, 14 Aug 2011 09:48:15 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.18) Gecko/20110617 Lightning/1.0b2 Thunderbird/3.1.11

Thank you Neil,

now I created the following time-signature engraver:
--snip--
\version "2.14.2"

#(define-public orff (lambda (context)
          (let ((time-signature '())
                (last-fraction #f))

               `((process-music
                  . ,(lambda (trans)
(let ((frac (ly:context-property context 'timeSignatureFraction)))
                               (if (and (null? time-signature)
                                        (not (equal? last-fraction frac))
                                        (pair? frac))
                                   (begin
(set! time-signature (ly:engraver-make-grob trans 'TimeSignature '())) (set! (ly:grob-property time-signature 'fraction) frac) (set! (ly:grob-property time-signature 'stencil) ly:text-interface::print) (set! (ly:grob-property time-signature 'text) (markup #:translate '(0 . 2) #:concat ( #:bold (format "~a " (car frac)) #:translate '(-2 . -2) #:draw-line '(3 . 3) #:translate '(-2 . -3.5) #:smaller #:smaller #:note (format "~a" (cdr frac)) UP)
                                     ))

                                     (and (not last-fraction)
(set! (ly:grob-property time-signature 'break-visibility) (ly:context-property context 'implicitTimeSignatureVisibility)))

                                     (set! last-fraction frac))))))

                (stop-translation-timestep
                  . ,(lambda (trans)
                          (set! time-signature '()))))
)))

meta = {
  \key bes \major \time 3/4 s2.*2
  \key a \minor \time 5/8 s8*5
  \key bes \major \time 3/4 s2.*2
}

mel = \relative c'' {
a8 bes c d c d | a bes c d c d | a c d c d | ees d c bes a bes | ees d c bes a bes |
}

\score {
  \new StaffGroup <<
    \new Dynamics \with {
      \consists \orff
      \override TimeSignature #'extra-offset = #'(-1 . 0)
    } { \meta }
    \new Staff \with {
      \remove "Time_signature_engraver"
    } <<
      \meta
      \new Voice = "mel" { \mel } >> >> % e-mail-compatible line breaks ;-)
}
--snip--

I will optimize and use overrides for this engraver - the markup is a first shot. If I have time and/or a need, I will look for another context than Dynamics.

Cheers,
Jan-Peter

Am 13.08.2011 16:31, schrieb Neil Puttock:
On 13 August 2011 10:27, Jan-Peter Voigt<address@hidden>  wrote:

So my question is: How do I catch the right event and get the time sig probs to 
display?
There's no event* for time signatures; they're generated when certain
context properties change.

See the scheme engraver I posted here for an idea:

http://lists.gnu.org/archive/html/lilypond-user/2011-05/msg00468.html

* there is a music object (TimeSignatureMusic), but that's only used
for iteration so the relevant settings are accessible by
\displayLilyMusic

Cheers,
Neil





reply via email to

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