Having implemented some of the methods shown in Vaughan's marvellous
tutorial at
https://lists.gnu.org/archive/html/lilypond-user/2020-06/msg00114.html
I have been making rapid progress in setting the orchestral piece which
is my latest project.

But suddenly I came across a problem which, try as I might, I can't
figure out or solve.   I have managed to work around it.  Despite that
I should very much like to understand what is going on here so that I
will be better able to deal with similar or related problems in future.
Also the work-around makes my input code considerably more complex, and
may not work well if line breaks get moved around.

The problem is that, after using trillspanners, sometimes the trill
reappears later on after a change of staff setup.  The code below
reproduces this problem.  I have also attached a pdf file containing
the output.

In this example, it is quite easy to get rid of the unwanted
trillspanners in the second line by making small, apparently random,
alterations in the input.  For instance, if the 4th bar in the upper
instrument is changed to 2 minims, or the same bar in the lower
instrument is changed to a semibreve, the rogue trillspanners
disappear.  However, it is not true  to say that the trillspanners
always disappear whenever the rhythms in the two instruments are
exactly the same, and of course it wouldn't be a useful solution to the
problem even if it were true.  In fact, in my actual score the 2
instruments do have identical rhythms, but I still get these unwanted
trills in the next system.

My work-around, incidentally, involves creating another pair of staves
with a different VerticalAxisGroup.remove-layer value, and changing
\instScorePlan to use the first pair up to and including the trills,
and the replacement pair thereafter.  Not very elegant, and if there
were many trill passages it would quickly become unwieldy in the
extreme.

Can anyone figure out why these spare trills are appearing, and how one
can get rid of them reasonably simply?
 
David

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\version "2.21.2"

instOne = \relative {
  a'1 | a | a |
  a1 \startTrillSpan | a1 \stopTrillSpan |
  a | a | a | a | a | a | a |
}

instTwo = \relative {
  f'1 | f | f |
  f2 \startTrillSpan f2 \startTrillSpan | f1 \stopTrillSpan |
  f | f | f | f | f | f | f |
}

targetStaff = #(define-scheme-function (ctx) (string?)
  #{
    \set Staff.keepAliveInterfaces = #'()
    \context Staff = #ctx { \unset Staff.keepAliveInterfaces }
  #})

instScorePlan = {
  \targetStaff clarinetI s1*4
  \targetStaff bothClarinets s1*3
  \break s1*5 \break s1*5
}

\score {
    \new StaffGroup \with {
    \consists "Keep_alive_together_engraver" }
  <<
    \new Staff = bothClarinets \with {
      \RemoveAllEmptyStaves
      \override VerticalAxisGroup.remove-layer = 40 }
    << \partCombine \instOne \instTwo \instScorePlan >>
    %% Clarinets on 2 staves:
    \new Staff = clarinetI \with {
      \RemoveAllEmptyStaves
      \override VerticalAxisGroup.remove-layer = 20 }
    << \instOne \instScorePlan >>
    \new Staff = clarinetII \with {
      \RemoveAllEmptyStaves
      \override VerticalAxisGroup.remove-layer = 20 }
     << \instTwo \instScorePlan >>
  >>
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Attachment: trillTest.pdf
Description: Adobe PDF document

Reply via email to