lilypond-user
[Top][All Lists]
Advanced

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

Re: change barline type with time signature change


From: Jan-Peter Voigt
Subject: Re: change barline type with time signature change
Date: Wed, 23 Jan 2013 08:49:43 +0100
User-agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130106 Thunderbird/17.0.2

Hi Kieren, hi David,

I darkly remember a scheme engraver, that did something, whenever a time-sig-schange happens. IIRC it is based on snippet from you David.
One might reduce it to the following:

--snip--
% engraver
#(define-public timesig-barline
   (lambda (context)
(let ((last-fraction #f)) ; remember last time-sig-fraction in this context
       `(
         (process-music
          . ,(lambda (trans)
               (let (; get parental Timing context
                     (timingctx (ly:context-find context 'Timing))
                     ; get current time-sig-fraction
(frac (ly:context-property context 'timeSignatureFraction)))
                 ; compare the current with the last fraction
                 (if (and (not (equal? last-fraction frac))
                          (pair? frac))
                     ; if they are not equal, do something ...
                     (begin
                      ; action for this engraver: set barline
                      (ly:context-set-property! timingctx 'whichBar "||")
                      ; set last-fraction
                      (set! last-fraction frac)
                      )))))
         )
       )))

% example
\new Staff \with {
  \consists #timesig-barline
} \relative c'' {
  bes a c b | bes a c b | \time 3/4 cis c b | cis c b |
}
--snip--

You might create a scheme function to produce the engraver you need:

--snip--
% engraver builder
timeSigChangeEngraver =
#(define-scheme-function (parser location proc)(procedure?)
   (lambda (context)
(let ((last-fraction #f)) ; remember last time-sig-fraction in this context
       `(
         (process-music
          . ,(lambda (trans)
               (let (; get current time-sig-fraction
(frac (ly:context-property context 'timeSignatureFraction)))
                 ; compare the current with the last fraction
                 (if (and (not (equal? last-fraction frac))
                          (pair? frac))
                     ; if they are not equal, do something ...
                     (begin
                      ; action for this engraver
                      (proc context trans)
                      ; set last-fraction
                      (set! last-fraction frac)
                      )))))
         )
       )))

% example
\new Staff \with {
  \consists \timeSigChangeEngraver #(lambda (context trans)
(let ((timingctx (ly:context-find context 'Timing))) (ly:context-set-property! timingctx 'whichBar "||")
                                        ))
} \relative c'' {
  bes a c b | bes a c b | \time 3/4 cis c b | cis c b |
}
--snip--

HTH

Best, Jan-Peter


Am 22.01.2013 16:18, schrieb David Nalesnik:

Hi Kieren,

On Tue, Jan 22, 2013 at 8:56 AM, Kieren MacMillan <address@hidden <mailto:address@hidden>> wrote:

    Hello all!

    I'm working in Lilypond v2.17.9, and the conductor of my chamber
    opera (being performed in April) wants the following stylesheet
    override: the default barline type should be dashed or dotted, but
    the barline should be solid (i.e., standard) at every time
    signature change.

    What's the best way to do this, abstracted of course (because this
    is the only conductor who has so far requested such a thing).


Here's a thread containing a Scheme engraver which might be able to be adapted to the purpose:
http://www.mail-archive.com/address@hidden/msg72613.html

Unfortunately I won't be able to work on it at the moment...

-David


_______________________________________________
lilypond-user mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/lilypond-user




reply via email to

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