From 16fb8cc6bb3024b5479de4668b9c9d28ae53102c Mon Sep 17 00:00:00 2001 From: Richard Gay Date: Wed, 31 Mar 2010 22:12:14 +0200 Subject: [PATCH] includeGraceNotes: lyrics syllables of grace notes --- Documentation/de/notation/vocal.itely | 31 +++++++++++++++++++++++++++++++ Documentation/notation/vocal.itely | 30 ++++++++++++++++++++++++++++++ lily/extender-engraver.cc | 3 ++- lily/include/context.hh | 2 +- lily/lyric-combine-music-iterator.cc | 3 +-- lily/lyric-engraver.cc | 18 ++++++++++++------ scm/define-context-properties.scm | 2 ++ 7 files changed, 79 insertions(+), 10 deletions(-) diff --git a/Documentation/de/notation/vocal.itely b/Documentation/de/notation/vocal.itely index 9393cc6..56392cf 100644 --- a/Documentation/de/notation/vocal.itely +++ b/Documentation/de/notation/vocal.itely @@ -1194,6 +1194,37 @@ Es ist notwendig, explizit @code{\set} und @code{\unset} zu verwenden, um den Text einzugrenzen, für den Melismen ignoriert werden sollen. address@hidden Silben zu Verzierungsnoten hinzufügen + +Normalerweise werden Verzierungsnoten (z.B. durch @code{\grace}) bei address@hidden keine Silben zugeordnet. Dieses Verhalten kann +geändert werden, indem @code{includeGraceNotes} im address@hidden gesetzt wird. Damit Silben auch address@hidden und @code{\acciaccatura}-Noten zugeordnet +werden, muss zusätzlich @code{ignoreMelismata} gesetzt werden. + address@hidden,ragged-right,quote] +<< + { + f'4 \appoggiatura b'32 c''4 + \grace { f'16 [a'16] } c''2 + \appoggiatura b'32 c''4 + \acciaccatura b'8 c''4 + \afterGrace c''2 { f'16 [a'16] } + } + \addlyrics { + normal + \set ignoreMelismata = ##t + \set includeGraceNotes = ##t + case, + gra -- ce case, + app. case, + acc. case, + after -- grace case + } +>> address@hidden lilypond + @subsubheading Zu einer alternativen Melodie umschalten diff --git a/Documentation/notation/vocal.itely b/Documentation/notation/vocal.itely index 34f6cc4..fd63c75 100644 --- a/Documentation/notation/vocal.itely +++ b/Documentation/notation/vocal.itely @@ -1152,6 +1152,36 @@ not work if prefixed with @code{\once}. It is necessary to use @code{\set} and @code{\unset} to bracket the lyrics where melismata are to be ignored. address@hidden Adding syllables to grace notes + +By default, grace notes (e.g. via @code{\grace}) do not get assigned +syllables when using @code{\lyricsto}. This behavior can be changed by +setting @code{includeGraceNotes} in the @code{Lyrics} context. For +syllables to be assigned to @code{\appoggiatura} and address@hidden notes, @code{ignoreMelismata} has to be set. + address@hidden,ragged-right,quote] +<< + { + f'4 \appoggiatura b'32 c''4 + \grace { f'16 [a'16] } c''2 + \appoggiatura b'32 c''4 + \acciaccatura b'8 c''4 + \afterGrace c''2 { f'16 [a'16] } + } + \addlyrics { + normal + \set ignoreMelismata = ##t + \set includeGraceNotes = ##t + case, + gra -- ce case, + app. case, + acc. case, + after -- grace case + } +>> address@hidden lilypond + @subsubheading Switching to an alternative melody More complex variations in text underlay are possible. It is possible diff --git a/lily/extender-engraver.cc b/lily/extender-engraver.cc index 097b479..02adbab 100644 --- a/lily/extender-engraver.cc +++ b/lily/extender-engraver.cc @@ -100,7 +100,7 @@ Extender_engraver::stop_translation_timestep () if (extender_ || pending_extender_) { Context *voice = get_voice_to_lyrics (context ()); - Grob *h = voice ? get_current_note_head (voice) : 0; + Grob *h = voice ? get_current_note_head (voice, to_boolean (get_property ("includeGraceNotes"))) : 0; if (h) { @@ -198,6 +198,7 @@ ADD_TRANSLATOR (Extender_engraver, /* read */ "extendersOverRests ", + "includeGraceNotes " /* write */ "" diff --git a/lily/include/context.hh b/lily/include/context.hh index 45e94ab..1d6886d 100644 --- a/lily/include/context.hh +++ b/lily/include/context.hh @@ -146,7 +146,7 @@ Context *find_context_below (Context *where, bool melisma_busy (Context *); Context *get_voice_to_lyrics (Context *lyrics); -Grob *get_current_note_head (Context *voice); +Grob *get_current_note_head (Context *voice, bool includeGraceNotes); Grob *get_current_rest (Context *voice); DECLARE_UNSMOB (Context, context); diff --git a/lily/lyric-combine-music-iterator.cc b/lily/lyric-combine-music-iterator.cc index 7b304cf..ddf7fd1 100644 --- a/lily/lyric-combine-music-iterator.cc +++ b/lily/lyric-combine-music-iterator.cc @@ -293,14 +293,13 @@ Lyric_combine_music_iterator::process (Moment /* when */) set_music_context (0); } - if (music_context_ && (start_new_syllable () || (busy_moment_ >= pending_grace_moment_)) && lyric_iter_->ok ()) { Moment now = music_context_->now_mom (); - if (now.grace_part_) + if (!to_boolean (lyrics_context_->get_property ("includeGraceNotes")) && now.grace_part_) { pending_grace_moment_ = now; pending_grace_moment_.grace_part_ = Rational (0); diff --git a/lily/lyric-engraver.cc b/lily/lyric-engraver.cc index 999efaa..7bf4d7d 100644 --- a/lily/lyric-engraver.cc +++ b/lily/lyric-engraver.cc @@ -127,7 +127,7 @@ get_voice_to_lyrics (Context *lyrics) } Grob * -get_current_note_head (Context *voice) +get_current_note_head (Context *voice, bool includeGraceNotes) { Moment now = voice->now_mom (); for (SCM s = voice->get_property ("busyGrobs"); @@ -141,10 +141,14 @@ get_current_note_head (Context *voice) continue; } - if (end_mom->main_part_ > now.main_part_ - && dynamic_cast (g) - && Note_head::has_interface (g)) - return g; + if (((end_mom->main_part_ > now.main_part_) || + (includeGraceNotes && (bool)now.grace_part_ + && end_mom->main_part_ == now.main_part_ + && end_mom->grace_part_ > now.grace_part_)) + && dynamic_cast(g) + && Note_head::has_interface(g)) { + return g; + } } return 0; @@ -159,7 +163,8 @@ Lyric_engraver::stop_translation_timestep () if (voice) { - Grob *head = get_current_note_head (voice); + Grob *head = get_current_note_head (voice, + to_boolean (get_property ("includeGraceNotes"))); if (head) { @@ -191,6 +196,7 @@ ADD_TRANSLATOR (Lyric_engraver, /* read */ "ignoreMelismata " + "includeGraceNotes " "lyricMelismaAlignment ", /* write */ diff --git a/scm/define-context-properties.scm b/scm/define-context-properties.scm index 16b2538..5f937f6 100644 --- a/scm/define-context-properties.scm +++ b/scm/define-context-properties.scm @@ -267,6 +267,8 @@ string selector for tablature notation.") printed as numbers, but only as extender lines.") (implicitTimeSignatureVisibility ,vector? "break visibility for the default time signature.") + (includeGraceNotes ,boolean? "Do not ignore grace notes for address@hidden") (instrumentCueName ,markup? "The name to print if another instrument is to be taken.") (instrumentEqualizer ,procedure? "A function taking a string -- 1.6.4.4