Re: Bottom-right-aligned, multi-line paragraphs within headings

2021-06-09 Thread Lukas-Fabian Moser

Hi Harm,


Thus I took a different approach.
Remember, dir-column _respects_ baselines. Following this idea means:
- create a list of line-stencils
- right-align them
- stack them up(!) in reverse order
And after deleting \general-align #Y #DOWN from scoreTitleMarkup we're done.


Amazing! And again there's something I'll enjoy digesting more fully. 
Thanks!


Lukas




Re: Bottom-right-aligned, multi-line paragraphs within headings

2021-06-09 Thread Thomas Morley
Am Di., 8. Juni 2021 um 19:07 Uhr schrieb Lukas-Fabian Moser :
>
> Hi Brent,
>
> > This is marvellous, thank you! Just one question: if I wanted to
> > remove the preceding zeros from the number, how would I do that?
>
> Just omit the (not very elegant) code that I added in order to add the
> preceding zeros. :-)
>
> To wit, replace
>
>(markup (format #f
>(string-append "~" (number->string digits)
> ",'0d")
>n)))
>
> by
>
>(number->string n))
>
> I attach a complete version.
>
> One problem with my code is the fine-tuning of the bottom-alignment of
> the various \markup's: If you look closely, you see that LilyPond
> doesn't use the baselines of the text lines, but the actual lowest point
> of the markups: The lowest point of "Gottes Sohn ist kommen" (no
> descenders) are aligned to the lowest point of the 'g' in 'long'. Not
> ideal, but I don't know how to improve this.
>
> Lukas
>

Hi Lukas,

some remarks:
You refer to my very first LSR snippet
https://lsr.di.unimi.it/LSR/Item?id=765
originally coded with 2.14. (or was it even 2.12.?, don't remember exactly ...)

There I c/p-ed general-column from define-markup-commands.scm, because
it is not public.
For wordwrap-right you obviously had copied (and renamed) the original
textRight (with a hardcoded baseline-skip).

Nowadays I'd rather use general-column from a more recent version. The
LSR-snippet was already improved to have baseline-skip adjustable.


That said...
The problem of not base-aligned texts persist, because general-align
aligns the whole markup, not respecting baselines.
Thus I took a different approach.
Remember, dir-column _respects_ baselines. Following this idea means:
- create a list of line-stencils
- right-align them
- stack them up(!) in reverse order
And after deleting \general-align #Y #DOWN from scoreTitleMarkup we're done.

Leading to:
#(define-markup-command (column-right-up layout props args) (markup-list?)
  #:properties ((baseline-skip))
  (let* ((lines (wordwrap-internal-markup-list layout props #f args))
 (right-aligned-lines
   (map (lambda (stil) (ly:stencil-aligned-to stil X RIGHT)) lines)))
(stack-lines
  UP
  0.0
  baseline-skip
  (reverse right-aligned-lines

#(define-markup-command (number-fromproperty layout props digits symbol)
   (index? symbol?)
   (let ((n (chain-assoc-get symbol props)))
 (if (index? n)
 (interpret-markup
  layout props
  (markup (format #f
  (string-append "~" (number->string digits) ",'0d")
  n)))
 empty-stencil)))

#(define-markup-command (wordwrap-right-field layout props symbol)
   (symbol?)
   (let* ((m (chain-assoc-get symbol props)))
 (if (markup-list? m)
 (column-right-up-markup layout props m)
 empty-stencil)))

\paper {
  scoreTitleMarkup = \markup
  \overlay {
  %% Only to demonstrate aligning to baseline, delete me!
  \translate #'(0 . -0.1) \draw-hline
\fill-line {
  \line {
\fontsize #7 \number-fromproperty #3 #'header:piece-nr
\hspace #1
\normal-text \large \fromproperty #'header:piece-title
  }
  \italic \small
  %% probably:
  \override #'(baseline-skip . 2.5)
  \override #'(line-width . 50)
  \wordwrap-right-field #'header:infotext
}
  }
}

\paper {
  indent = 0
}

\score {
  \header {
piece-nr = 0
piece-title = "Gottes Sohn ist kommen"
infotext = \markuplist {
  This paragraph is in two or more rows, and the last line needs
  to be level with the bit on the left. It really can be as long
  as you want.
}
  }
  \relative c' { c1 c e f g a g }
}


\score {
  \header {
piece-nr = 1
piece-title = "Another piece"
infotext = \markuplist {
  This paragraph is in two or more rows, and the last line needs
  to be level with the bit on the left. It really can be as long
  as you want. Bla bla text, bla bla text? Really important bla
bla text, bla bla text.
}
  }
  \relative g' { g2 f e c d b c1 }
}

The draw-hline is only there to visualize baselines, should be deleted ...

Best,
  Harm



Re: cresc over whole notes with lyrics

2021-06-09 Thread Thomas Morley
Am Mi., 9. Juni 2021 um 01:35 Uhr schrieb Molly Preston
:
>
> What is the best way to handle crescendos and decrescendos when they need to 
> start on beat 4 of a whole note for example.
>
> Lyrics that start in one voice also disappear when introducing <<...\\ ...>>
> using spacers for crescendos and decrescendos over a whole note that start on 
> a different beat other than the downbeat.
>
> In the following example the second syllable should start on the d'1 not it's 
> tied note.
> What is the best way to do crescendos, decrescendos, ties, \sustainOn etc in 
> these situations? Especially if the lyrics disappear, that's a problem.
>
> I seem to be missing something regarding voices I assume?
>
> How would you all handle this so the lyrics don't disappear?
>
>
> \version "2.20.0"
>  \new Staff <<
> \new Voice = "music"  {
>
>   e'1 ~
>   <<
> {e'1 | d'1 ~  }
> \\
> {s2 s \> }
>   >>
>
> d'1
>
> }
>
>\new Lyrics \with {
>  \override VerticalAxisGroup.
> nonstaff-relatedstaff-spacing.padding = #2
>   \override VerticalAxisGroup.
> nonstaff-unrelatedstaff-spacing.padding = #2
>   }
>
>   %}
>  \lyricsto "music"  { Hel -- lo }
>
>  >>
>
> -Molly

Hi Molly,

iiuc you use the << {…} \\ {…} >> construct to start/end spanners at
measure positions not covered by entered notes or rests in the "main"
voice.
Because this construct creates _new_ Voices called "1", "2", etc it is
not suitable for this purpose as soon as said spanners are not
started/ended in the same Voice. And ofcourse Lyrics associated to the
main Voice will simply skip those Voices.
While there are always ways around it, I'd recommend not to use << {…}
\\ {…} >> for anything other then _short_ and temporary polyphonic
situation and close to never when Lyrics are part of the game.

You may try:
For associated Lyrics the NullVoice (not demonstarted below)
and/or simultaneous music in _one_, the main Voice for starting ending
spanners or use \at (by David K.)

Examples:

\version "2.20.0"

at =
#(define-music-function (time event music)
  (ly:duration? ly:music? ly:music?)
"Place @var{event} at a relative duration @var{time} in relation
to @var{music}."
  #{ \context Bottom << { \skip $time <>$event } $music >> #})

<<
  \new Staff = "control" \repeat unfold 16 r2
  \new Staff
\new Voice = "music" {
  %% simultaneous music in one Voice
  e'1~ e'1 << d'1~ { s2 s\> } >> d'1\!
  \break
  %% using \at (actually very similiar to the above, more verbose coding)
  e'1~ e'1 \at 2 \> d'1~  d'1\!
}

  \new Lyrics \lyricsto "music"  { Hel -- lo Hel -- lo }
>>

HTH,
  Harm



Re: partCombine: how to print "a due" automatically again

2021-06-09 Thread Timothy Lanfear

On 09/06/2021 10:05, Stefan Thomas wrote:

Dear community,
is there a way to get the "a due" text in combined parts automatically?


I do it by adding a \once \partCombineChords. It doesn't feel great as a 
solution, but it works.


\version "2.22.0"
voiceA = \relative c'' {
  c4 d e f g4 f e d c1
  \once \partCombineChords R1*27 \break
  c4 d e f g4 f e d c1  }
voiceB = { \voiceA }

\score {
 <<
   \new Staff {  \partCombine \voiceA \voiceB }
 >>
}

--
Timothy Lanfear, Bristol, UK.



Re: cresc over whole notes with lyrics

2021-06-09 Thread Molly Preston
Thank you all for explaining the NullVoice and Dynamics contexts.

I think I got it for now.

On Wed, Jun 9, 2021, 10:31 Knute Snortum  wrote:

> Well, I'm seeing two things: 1) there is no ending to the decrescendo,
> so it throws a warning, and 2) the tie from the first e'1 to the
> second won't work, because the second is in a different voice.  I
> don't know exactly what you want to do with the decrescendo, but I'd
> put it in a separate Dynamics voice, like this:
>
> %%%
> \version "2.20.0"
>
> \new Staff <<
>   \new Voice = "music"  {
> e'1 ~ | e'1 | d'1 ~ | d'1
>   }
>
>   \new Dynamics {
> s1 | s2 s \> | s s\! | s1
>   }
>
>   \new Lyrics \with {
> \override VerticalAxisGroup.
> nonstaff-relatedstaff-spacing.padding = #2
> \override VerticalAxisGroup.
> nonstaff-unrelatedstaff-spacing.padding = #2
>   }
>
>   \lyricsto "music"  { Hel -- lo }
> >>
> %%%
>
> --
> Knute Snortum
>
> On Tue, Jun 8, 2021 at 4:35 PM Molly Preston 
> wrote:
> >
> > What is the best way to handle crescendos and decrescendos when they
> need to start on beat 4 of a whole note for example.
> >
> > Lyrics that start in one voice also disappear when introducing <<...\\
> ...>>
> > using spacers for crescendos and decrescendos over a whole note that
> start on a different beat other than the downbeat.
> >
> > In the following example the second syllable should start on the d'1 not
> it's tied note.
> > What is the best way to do crescendos, decrescendos, ties, \sustainOn
> etc in these situations? Especially if the lyrics disappear, that's a
> problem.
> >
> > I seem to be missing something regarding voices I assume?
> >
> > How would you all handle this so the lyrics don't disappear?
> >
> >
> > \version "2.20.0"
> >  \new Staff <<
> > \new Voice = "music"  {
> >
> >   e'1 ~
> >   <<
> > {e'1 | d'1 ~  }
> > \\
> > {s2 s \> }
> >   >>
> >
> > d'1
> >
> > }
> >
> >\new Lyrics \with {
> >  \override VerticalAxisGroup.
> > nonstaff-relatedstaff-spacing.padding = #2
> >   \override VerticalAxisGroup.
> > nonstaff-unrelatedstaff-spacing.padding = #2
> >   }
> >
> >   %}
> >  \lyricsto "music"  { Hel -- lo }
> >
> >  >>
> >
> > -Molly
>


Re: cresc over whole notes with lyrics

2021-06-09 Thread Knute Snortum
Well, I'm seeing two things: 1) there is no ending to the decrescendo,
so it throws a warning, and 2) the tie from the first e'1 to the
second won't work, because the second is in a different voice.  I
don't know exactly what you want to do with the decrescendo, but I'd
put it in a separate Dynamics voice, like this:

%%%
\version "2.20.0"

\new Staff <<
  \new Voice = "music"  {
e'1 ~ | e'1 | d'1 ~ | d'1
  }

  \new Dynamics {
s1 | s2 s \> | s s\! | s1
  }

  \new Lyrics \with {
\override VerticalAxisGroup.
nonstaff-relatedstaff-spacing.padding = #2
\override VerticalAxisGroup.
nonstaff-unrelatedstaff-spacing.padding = #2
  }

  \lyricsto "music"  { Hel -- lo }
>>
%%%

--
Knute Snortum

On Tue, Jun 8, 2021 at 4:35 PM Molly Preston  wrote:
>
> What is the best way to handle crescendos and decrescendos when they need to 
> start on beat 4 of a whole note for example.
>
> Lyrics that start in one voice also disappear when introducing <<...\\ ...>>
> using spacers for crescendos and decrescendos over a whole note that start on 
> a different beat other than the downbeat.
>
> In the following example the second syllable should start on the d'1 not it's 
> tied note.
> What is the best way to do crescendos, decrescendos, ties, \sustainOn etc in 
> these situations? Especially if the lyrics disappear, that's a problem.
>
> I seem to be missing something regarding voices I assume?
>
> How would you all handle this so the lyrics don't disappear?
>
>
> \version "2.20.0"
>  \new Staff <<
> \new Voice = "music"  {
>
>   e'1 ~
>   <<
> {e'1 | d'1 ~  }
> \\
> {s2 s \> }
>   >>
>
> d'1
>
> }
>
>\new Lyrics \with {
>  \override VerticalAxisGroup.
> nonstaff-relatedstaff-spacing.padding = #2
>   \override VerticalAxisGroup.
> nonstaff-unrelatedstaff-spacing.padding = #2
>   }
>
>   %}
>  \lyricsto "music"  { Hel -- lo }
>
>  >>
>
> -Molly



partCombine: how to print "a due" automatically again

2021-06-09 Thread Stefan Thomas
Dear community,
is there a way to get the "a due" text in combined parts automatically?
Here's my short snippet:
\version "2.22.0"
voiceA = \relative c'' {
  c4 d e f g4 f e d c1
  R1*27 \break
  c4 d e f g4 f e d c1  }
voiceB = { \voiceA }

\score {
 <<
   \new Staff {  \partCombine \voiceA \voiceB }
 >>
}
Thanks for any help,
Stefan