lilypond-user
[Top][All Lists]
Advanced

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

Re: Repeats in \parallelMusic


From: David Kastrup
Subject: Re: Repeats in \parallelMusic
Date: Wed, 26 Aug 2015 17:12:47 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

David Sumbler <address@hidden> writes:

> On Wed, 2015-08-26 at 14:10 +0200, David Kastrup wrote:
>> David Sumbler <address@hidden> writes:

>> > But suppose that the repeat should start in the middle of bar 1 and end
>> > in the middle of bar 2.  This is easily done when setting the parts
>> > separately; but can it be done within a \parallelMusic structure?  On
>> > the face of it, the answer would seem to be "no".
>> >
>> > Or is it?
>> 
>> Any reason you neither try it out nor add any template to demonstrate
>> on?  A user list is primarily a knowledge resource: making use of the
>> different knowledge and skill levels of the participants for overcoming
>> hurdles, not for running the whole track.
>> 
>> It should be easy enough for yourself to modify the example such that
>> the repeats are on partial measure positions.
>
> With respect, I could see no obvious way in which it could be done,
> which is why I asked.  I suppose it was the proverbial "stupid
> question".
>
> Anyway, after trying several more (im)possibilities, I found a method
> that worked but produced error messages.  Then I remembered Stephen
> MacNeil's helpful suggestion a few months ago regarding incomplete final
> bars.  An example is:
>
> \version "2.18.0"

Ugh.  It's likely better to return to the method that worked but
produced error messages.  Possibly even to one that didn't.

There has been

    Issue 4426: Remove bar checks at the end of \parallelMusic passages
    
    This allows ending \parallelMusic at non-bar boundaries.

in version 2.19.22.  There has also been

Issue 3984: Let \parallelMusic cope with \repeat .. \alternative
    
    \parallelMusic's recursive decent only worked for comparatively simple
    cases.  It now should be able to deal with complex constructs
    gracefully.

in version 2.19.10 so I am surprised that my example presumably even
works in 2.18.0.

The contraptions you have been using, in contrast, are fairly noisome.

>
>
> \parallelMusic #'(Vone Vtwo) {
> %bar 1
>     \set Score.measureLength = #(ly:make-moment 3/4) c''2. |
>     \set Score.measureLength = #(ly:make-moment 3/4) e'2. |
>     \repeat volta 2 {
>       \set Score.measureLength = #(ly:make-moment 1/4) d''4 |
>       \set Score.measureLength = #(ly:make-moment 1/4) f'4 |
> %bar 2
>       \set Score.measureLength = #(ly:make-moment 4/4) e''1 |
>       \set Score.measureLength = #(ly:make-moment 4/4) g'1 |
> %bar 3
>       d''1 |
>       f'1 |
> %bar 4    
>       \set Score.measureLength = #(ly:make-moment 3/4) c''2. |
>       \set Score.measureLength = #(ly:make-moment 3/4) e'2. |
>     }
>     \set Score.measureLength = #(ly:make-moment 1/4) b'4 |
>     \set Score.measureLength = #(ly:make-moment 1/4) d'4 |
> %bar 5
>     \set Score.measureLength = #(ly:make-moment 4/4) c''1 |
>     \set Score.measureLength = #(ly:make-moment 4/4) e'1 |
> }
>
> \score {
>     <<
>       \new Staff { \Vone }
>       \new Staff { \Vtwo }
>     >>
> }
>
> Not exactly succinct, but it works.  I am sending this to the list (a)
> so that I can find it again when I actually need it (b) in case somebody
> knows a neater solution to the problem.

Well, upgrading.  Then the following will work just fine:

\version "2.19.22"

\parallelMusic #'(Vone Vtwo) {
%bar 1
    { c''2. |
     e'2. | }
    \repeat volta 2 {
        d''4 |
        f'4 |
%bar 2
        e''1 |
        g'1 |
%bar 3
        d''1 |
        f'1 |
%bar 4    
        c''2. |
        e'2. |
    }
    b'4 |
    d'4 |
%bar 5
    c''1 |
    e'1 |
}

\score {
  \displayLilyMusic
    <<
        \new Staff { \Vone }
        \new Staff { \Vtwo }
    >>
}
There is, indeed, a slight complication over the most simple version,
namely the additional { ... } pair before the \repeat.  The reason for
that is obvious when looking at the output of the \displayLilyMusic:

GNU LilyPond 2.19.26
Processing `sumb.ly'
Parsing...
<< \new Staff { { { c''2. } \repeat volta 2 {
         d''4 |
         e''1 |
         d''1 |
         c''2.
       }  b'4 |
       c''1 } } \new Staff { { { e'2. } \repeat volta 2 {
         f'4 |
         g'1 |
         f'1 |
         e'2.
       }  d'4 |
       e'1 } } >>

One can see that _most_ | events are preserved, but those at the end of
some music list are removed.  This caters fine for the _end_ of the
repeats but it doesn't help before they start.  So while the code
doesn't special-case this situation as well, one can employ this extra
brace pair to fix it.  Maybe the code _should_ meddle there as well.

-- 
David Kastrup

reply via email to

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