lilypond-user
[Top][All Lists]
Advanced

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

Re: \repeat with upbeat (partial) and alternatives


From: Dan Eble
Subject: Re: \repeat with upbeat (partial) and alternatives
Date: Fri, 18 Jul 2008 05:20:11 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

 <E.Weehaeli> writes:
> it is only after a long search that I found an easy way to repeat a part of a 
> melody 
> - with an upbeat 
> - ending before the end of a measure 
> - having different durations in the alternatives
> - without producing warnings in the log
> 
> \version "2.11.49"
> { 
>  \repeat volta 2 { \partial 8 c'8 | c'2.}
>  \alternative {{ f'8 } { \partial 4 f'4 | }}
>  d'1 |
>  }
> 

I'm sorry to be the bearer of bad tidings, but this trick is not
generally useful. \partial moves the timing counter backwards, which effectively
combines the last measure of the first alternative with the
first measure of the second alternative, forming one longer-than-usual
measure that is split visually by a repeat sign.

>From your example, it doesn't seem like a big deal, but change your
"f" to "fis" and see what happens.  The sharp sign will be missing from
the second alternative.  Another thing you can do is turn on bar numbers
and add enough measures to the example to make lilypond print one.  You
will see that the first alternative is not counted as a measure.

Try using the following "\measure" function instead of "\partial 4" in
your example.  It should be used in the same place, at the beginning of
the second alternative, otherwise it will cause problems if you ever
unfold the repeat.

% End a measure prematurely.  For example, when an alternate ending
% ends in a partial measure.
measure =
#(define-music-function
   (parser location) ()
   (let ((m (make-music 'ApplyContext)))

     (define (do-it context)
       (let* ((measurePos (ly:context-property context 'measurePosition))
              (measureLen (ly:context-property context 'measureLength)))

         (if (and (ly:moment<? ZERO-MOMENT measurePos)
                  (ly:moment<? measurePos measureLen))
             (ly:context-set-property! context 'measurePosition measureLen))))

     (set! (ly:music-property m 'procedure) do-it)

     (context-spec-music m 'Timing)))

If there are any scheme gurus in the audience, I don't mind criticism.





reply via email to

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