Re: Lyric extenders in/out of alternatives

2024-03-29 Thread Xavier Scheuer
On Tue, 5 Oct 2021 at 10:51, Lukas-Fabian Moser  wrote:
>
> Thanks for that explanation, which goes on the heap of things I have to
> try to wrap my head around. :-)

Hello,

We have just had the question on the French list and from what I see the
documentation still mentions \skip 1 and is less good than what
Lukas-Fabian proposes.
https://lilypond.community/t/lyrics-et-reprises-alternatives/5674
Would it be possible to replace this part of Lyrics and repeats? Or is
there a reason not to?
Or would it be necessary to change Lyric_combine_music_iterator so as not
to have to do this at all (the right result automatically)?
But in both cases what is currently documented in NR 2.1.2 doesn't give the
best result.

Best regards,
Xavier


Re: Lyric extenders in/out of alternatives

2021-10-05 Thread Lukas-Fabian Moser

Am 05.10.21 um 01:41 schrieb Dan Eble:


I'd basically be interested in trying to understand the mechanics involved, but 
seeing as term started today at our university, I'm sceptical I can spend 
serious time on this before Christmas break. (And there's a fair chance it 
would be above my head anyway.)

Volta_specced_music_iterator emits VoltaSpanEvents carrying i,j,k at the start 
and end of \volta i,j,k {}.  I expect that Lyric_combine_music_iterator could 
register for these events and use them to ignore notes that do not apply to the 
volta of interest.
Thanks for that explanation, which goes on the heap of things I have to 
try to wrap my head around. :-)

You would want a way to indicate in the ly code that a span of lyrics should be 
set to a specific volta of the music.  The existing stanza number feature seems 
obvious, but it would be limiting.  (Examples: a partly through-composed 
arrangement with 2 stanzas per volta; a transcription of stanzas 1, 5, and 9 of 
a source in a situation where renumbering is undesirable)


Yes, I agree that StanzaNumber is not the right tool for this: This is 
presentation layer, and as I abuse this every day with (the German 
version of) stuff like \set Stanza = "C major:" - music theory teacher 
here :-) -, I'd be vary of adding any semantic meaning to the contents 
of the Stanza markup.



I am asking myself, "Why not use \volta for that?" and I don't have an answer 
yet.


If I understand correctly, this would require writing \volta i,j,k { } 
in \lyricmode at precisely the "right" places in sync with the 
repeats/alternatives in the music. Is that right?


My gut feeling is that stanza-behaviour might be more of a persistent 
(changeable) property of a line of Lyrics: If unset, Lyrics ignore any 
\volta's they encounter in the associated voice. If set (to a volta 
number or a list of such), any voltas they encounter along the way would 
be skipped if the numbers don't match.


Feel free to ignore this if this obvious nonsense with respect to the 
inner workings.


Lukas




Re: Lyric extenders in/out of alternatives

2021-10-04 Thread Dan Eble
On Oct 4, 2021, at 12:44, Lukas-Fabian Moser  wrote:
> 
>>> Of course, the ideal solution would be a possibility to tell the Lyrics 
>>> context that it should "take" the second alternative and make it skip the 
>>> first alternative automatically (and suspend the LyricExtender along the 
>>> way). But my feeling is that this would be not so easy to implement.
>> 
>> Probably doable, and probably a fair bit of work.
> 
> I'd basically be interested in trying to understand the mechanics involved, 
> but seeing as term started today at our university, I'm sceptical I can spend 
> serious time on this before Christmas break. (And there's a fair chance it 
> would be above my head anyway.)

Volta_specced_music_iterator emits VoltaSpanEvents carrying i,j,k at the start 
and end of \volta i,j,k {}.  I expect that Lyric_combine_music_iterator could 
register for these events and use them to ignore notes that do not apply to the 
volta of interest.

You would want a way to indicate in the ly code that a span of lyrics should be 
set to a specific volta of the music.  The existing stanza number feature seems 
obvious, but it would be limiting.  (Examples: a partly through-composed 
arrangement with 2 stanzas per volta; a transcription of stanzas 1, 5, and 9 of 
a source in a situation where renumbering is undesirable)

I am asking myself, "Why not use \volta for that?" and I don't have an answer 
yet.
— 
Dan




Re: Lyric extenders in/out of alternatives

2021-10-04 Thread Jean Abou Samra

Le 04/10/2021 à 18:44, Lukas-Fabian Moser a écrit :




Does anybody see a better solution that might be good enough for the 
NR?


Well-invented. I don't see anything better.


Thanks (also for looking at this in the first place).

My feeling is that this should replace the "_something" example in the 
NR, but because of its complexity, it should perhaps rather be a 
"selected snippet" than a regular NR example. Would that be reasonable?



There is not much of a difference between
snippets and regular examples, except that
snippets are normally synced back to the
LSR so they become searchable there. But the
LSR is lagging behind in 2.18 and I haven't
heard of plans to port it.

So, follow your intuition I would say.

Best,
Jean



Re: Lyric extenders in/out of alternatives

2021-10-04 Thread Lukas-Fabian Moser





Does anybody see a better solution that might be good enough for the NR?


Well-invented. I don't see anything better.


Thanks (also for looking at this in the first place).

My feeling is that this should replace the "_something" example in the 
NR, but because of its complexity, it should perhaps rather be a 
"selected snippet" than a regular NR example. Would that be reasonable?


Of course, the ideal solution would be a possibility to tell the 
Lyrics context that it should "take" the second alternative and make 
it skip the first alternative automatically (and suspend the 
LyricExtender along the way). But my feeling is that this would be 
not so easy to implement.


Probably doable, and probably a fair bit of work.


I'd basically be interested in trying to understand the mechanics 
involved, but seeing as term started today at our university, I'm 
sceptical I can spend serious time on this before Christmas break. (And 
there's a fair chance it would be above my head anyway.)


Lukas





Re: Lyric extenders in/out of alternatives

2021-10-03 Thread Jean Abou Samra




Le 03/10/2021 à 11:34, Lukas-Fabian Moser a écrit :

Folks,

in my quest to maybe get rid of the recommendations of "\skip 1" for 
lyrics in the NR I stumbled upon the following example in 
http://lilypond.org/doc/v2.23/Documentation/notation/techniques-specific-to-lyrics.html:


% If you wish to show extenders and hyphens into and out
% of alternative sections these must be inserted manually.

\version "2.23.4"

\relative {
  \time 2/4
  \repeat volta 2 { b'4 b ~}
  \alternative {
    \volta 1 { b b }
    \volta 2 { b \repeatTie c }
  }
  c4 c
}
\addlyrics {
  Here's a __ verse.
  \repeat unfold 2 { \skip 1 } % btw: why this line?
}
\addlyrics {
  Here's "a_"
  \skip 1
  "_" sec -- ond one.
}

(I simplified the input code a bit - which I actually also would like 
to propose for the NR -, but the gist of the original example remains 
unchanged.)


Now this looks kind-of decent in the NR, but once you issue 
ragged-last = ##f, the limits of that hack show clearly (see attached 
image). And there should be a difference between a LyricExtender and 
an underscore as part of literal lyrics.


Of course the problem is exacerbated if the second alternative extends 
the melisma with multiple notes.


The best I could come up with is:

\relative {
  \time 2/4
  \repeat volta 2 { b'4 b ~}
  \alternative {
    \volta 1 { b b }
    \volta 2 { b \repeatTie c }
  }
  c4 c
}
\addlyrics {
  Here's a __ verse.
}
\addlyrics {
  Here's \set ignoreMelismata = ##t a __
  "" "" \set ignoreMelismata = ##f
  \markup\null __  sec -- ond one.
  % \markup\null doesn't kill melismata,
  % in contrast to ""
}

This has the advantage of being more-or-less semantically correct 
input, and it works with longer melismata:


\relative {
  \time 2/4
  \repeat volta 2 { b'4 b( | c8 b a g | }
  \alternative {
    \volta 1 { b4) b }
    \volta 2 {
  \shape #'((-3 . 0) (-2 . 0) (-1 . 0) (0 . 0)) Slur
  a8( b c b) | }
  }
  a8 g g4
}
\addlyrics {
  Here's a __ verse.
}
\addlyrics {
  Here's \set ignoreMelismata = ##t a __ _ _ _ _
  "" ""
  \set ignoreMelismata = ##f \markup\null __  sec -- ond one.
}

Does anybody see a better solution that might be good enough for the NR?



Well-invented. I don't see anything better.


Of course, the ideal solution would be a possibility to tell the 
Lyrics context that it should "take" the second alternative and make 
it skip the first alternative automatically (and suspend the 
LyricExtender along the way). But my feeling is that this would be not 
so easy to implement.


Probably doable, and probably a fair bit of work.

Best,
Jean