lilypond-user
[Top][All Lists]
Advanced

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

Re: explicit duration within \lyricsto


From: Christ van Willegen
Subject: Re: explicit duration within \lyricsto
Date: Thu, 12 Nov 2020 14:10:40 +0100

Hi,

On Tue, Nov 10, 2020 at 11:15 AM Aaron Hill <lilypond@hillvisions.com> wrote:
>
> (Re-adding mailing list for visibility...)

Whoops...

> On 2020-11-10 12:35 am, Christ van Willegen wrote:
> > Hi Aaron,
> >
> > Op ma 9 nov. 2020 23:39 schreef Aaron Hill:
> >
> > Above I show using a NullVoice so the notes do not appear though you
> > can
> >> still attach lyrics to them for timing.
> >>
> >> NOTE: As documented in the Notation Reference, changing
> >> associatedVoice
> >> must occur one syllable early to have the desired effect.
> >>
> >
> > Still, it would be very nice (TM) to be able to write "a lyric with
> > embedded4 lyrics8 lengths" within them.
> >
> > Perhaps a feature request?
>
> Technically, every lyric event has a duration whether or not you specify
> one.  If unspecified, the default duration is used similar to how you
> can specify a note event with just a pitch alone.  Something like the
> Lyric_combine_music_iterator would be unable to know when a duration is
> meant to be obeyed or not, as lyrics events with or without an explicit
> duration are indistinguishable.
>
> Perhaps a property could be introduced that temporarily disables
> automatic alignment, similar to how melismata can be ignored:
>
> %%%%
> \lyricsto melody {
>    some words that fol -- low the mel -- o -- dy
>    \set ignoreVoice = ##t
>    these4 syl8 -- la8 -- bles4 do not2
>    \unset ignoreVoice
>    back to a -- lign -- ing with the voice
> }
> %%%%
>
> I don't have a build environment setup, so I cannot easily tinker with
> the C++.  But I wonder if this would work:
>
> //// lyric-combine-music-iterator.cc
>    lyrics_found_ = true;
>    if (to_boolean (lyrics_context_->get_property ("ignoreVoice"))) {
>      Moment m = lyric_iter_->pending_moment ();
>      lyric_iter_->process (m);
>      return;
>    }
>    if (!music_context_)
>      return;
> ////

I tinkered around with this a bit:

$ git diff
diff --git a/lily/lyric-combine-music-iterator.cc
b/lily/lyric-combine-music-iterator.cc
index f585221c99..a2e3ea66fb 100644
--- a/lily/lyric-combine-music-iterator.cc
+++ b/lily/lyric-combine-music-iterator.cc
@@ -278,6 +278,11 @@ Lyric_combine_music_iterator::process (Moment /* when */)
     set_music_context (new_voice);

   lyrics_found_ = true;
+  if (from_scm<bool> (get_property(lyrics_context_, "ignoreMelismata"))) {
+         Moment m = lyric_iter_->pending_moment ();
+         lyric_iter_->process (m);
+         return;
+  }
   if (!music_context_)
     return;

diff --git a/lily/lyric-engraver.cc b/lily/lyric-engraver.cc
index 0a2b37e89c..a89473d3db 100644
--- a/lily/lyric-engraver.cc
+++ b/lily/lyric-engraver.cc
@@ -211,6 +211,7 @@ ADD_TRANSLATOR (Lyric_engraver,

                 /* read */
                 "ignoreMelismata "
+                "ignoreVoice "
                 "lyricMelismaAlignment "
                 "searchForVoice",


$ lily/out/lilypond test.ly
GNU LilyPond 2.23.0
Processing `test.ly'
Parsing...
test.ly:1: warning: no \version statement found, please add

\version "2.23.0"

for future compatibility
Interpreting music...
warning: cannot find property type-check for `ignoreVoice'
(translation-type?).  perhaps a typing error?
warning: skipping assignment
test.ly:11:24: warning: barcheck failed at: 5/8
boys4.
                       |
warning: cannot find property type-check for `ignoreVoice'
(translation-type?).  perhaps a typing error?
warning: skipping assignment
Preprocessing graphical objects...
Finding the ideal number of pages...
Fitting music on 1 page...
Drawing systems...
Converting to `test.pdf'...
Success: compilation successfully completed


$ cat test.ly
<<
\relative c'' {
\key g \major
\time 6/8
d4 b8 c4 a8 | d4 b8 g4
}
\addlyrics {
Girls and

\set ignoreVoice = ##t
boys4. |
\unset ignoreVoice
out to play
}
>>


I then tried to run the test.ly file again, changing ignoreVoice to
ignoreMelismata in it (and in the .cc file...) to see if it would pick
up the specified lyrics duration if I supplied a 'known' property, but
it also failed the bar check.

So, unfortunately this does not yield a solution (I would have turned
this into a patch if it worked, but I don't see how I could get this
to work). I searched the source for ignoreMelismata to see if I could
find 'the place' to define it, but was unable (I thought the change in
lyric-engraver.cc would do the trick...). Oh, I also found a few other
places that look interesting!

diff --git a/scm/define-context-properties.scm b/scm/define-context-properties.s
cm
index e65d978515..d9261baa67 100644
--- a/scm/define-context-properties.scm
+++ b/scm/define-context-properties.scm
@@ -359,6 +359,8 @@ string selector for tablature notation.")
      (ignoreFiguredBassRest ,boolean? "Don't swallow rest events.")
      (ignoreMelismata ,boolean? "Ignore melismata for this
 @rinternals{Lyrics} line.")
+     (ignoreVoice ,boolean? "Ignore voice for this
+@rinternals{Lyrics} line, use explicit lyrics lengths.")
      (implicitBassFigures ,list? "A list of bass figures that are not
 printed as numbers, but only as extender lines.")
      (initialTimeSignatureVisibility ,vector? "break visibility for
diff --git a/scm/song.scm b/scm/song.scm
index 8e8cee0e99..32fee67da9 100644
--- a/scm/song.scm
+++ b/scm/song.scm
@@ -192,6 +192,7 @@
   text
   duration
   unfinished
+  ignore-voice
   ignore-melismata
   context)

@@ -202,6 +203,8 @@
 (define (get-lyrics music context)
   ;; Returns list of lyrics and skip instances.
   (let ((lyrics-list '())
+        (next-ignore-voice #f)
+        (ignore-voice #f)
         (next-ignore-melismata #f)
         (ignore-melismata #f)
         (next-current-voice context)
@@ -217,10 +220,12 @@
                    #:text (ly:music-property lyric-event 'text)
                    #:duration (* (duration->number (ly:music-property
lyric-event 'duration)) 4)
                    #:unfinished (and (not (*syllabify*))
(find-child-named music 'HyphenEvent))
+                   #:ignore-voice ignore-voice
                    #:ignore-melismata ignore-melismata
                    #:context current-voice)
                   lyrics-list))
          ;; LilyPond delays applying settings
+         (set! ignore-voice next-ignore-voice)
          (set! ignore-melismata next-ignore-melismata)
          (set! current-voice next-current-voice)
          #t)
@@ -232,6 +237,9 @@
                 lyrics-list)
          #t)
         ;; parameter change
+        ((music-property? music 'ignoreVoice)
+         (set! next-ignore-voice (property-value music))
+         #t)
         ((music-property? music 'ignoreMelismata)
          (set! next-ignore-melismata (property-value music))
          #t)

After making these changes, and 'sudo make install', the warnings
about the property are gone, but the barcheck error remains, so the
explicit lyrics length has not been picked up.

I do see weird things when I add \displayMusic in the file: All the
lyrics are assigned a (ly:make-duration 2), which is a quarter note.
But, I have 4 syllables in the first measure, which adds up to 4
quarters = 8 eights. That way, the barCheck should fail, shouldn't it?
Well, it doesn't, so I interpret it wrong! But how are lyrics assigned
the correct durations, and where...

Any pointers?


Christ van Willegen



reply via email to

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