I finally have a fairly complete solution to the problem. The examples in NR 2.1.3 did not quite cut the mustard of switching back and forth between a main melody and one or more alternates.


There are a couple of gotchas:

1. There must be a "\new Voice" for the main melody at the outermost level, otherwise the "\set associatedVoice" does not see it.

2. "\set associatedVoice" has to be placed one syllable earlier than you think. This is documented in the NR. I'm not sure what happens if you want the alternation on the very first syllable.



Attachment: MWE3.pdf
Description: Adobe PDF document

\version "2.24.3"
\language "english"

\header {
  title = "Variant Rhythms 2"
  subtitle = "Named voices"
}

global = {
  \key c \major
  \time 4/4
  \partial 4
}

melody = \relative c'' \new Voice = "main" {
  \global
  % Music follows here.
   {
    \voiceOne
    c4 |
    c4 c 
  }
  << 
    {\voiceOne  c4 } 
    \new Voice = "alt"  {\voiceTwo  a8  a8   }
  >>
  {
    \voiceOne
    c4 |
    c4 c8 c c4
  }
}

verseA = \lyricmode {
  % Lyrics follow here.
  Verse with smooth
  rhythm  
  words
  And stac -- ca -- to.
}

%%% \set associatedVoice has to be set one syllable earlier than you experc
%%% See NR 2.1.3 "Switching to an alternative melody"
verseB = \lyricmode {
  % Lyrics follow here.
  Verse with  
  \set associatedVoice = "alt" 
  short jer -- 
  \set associatedVoice = "main"  
  ky words
  And stac -- ca -- to.
}

\score {
  <<
    \new Staff {  
      \melody    
      \bar "|."
    }
    \new Lyrics \lyricsto "main" { \verseA }
    \new Lyrics \lyricsto "main" { \verseB }
  >>
  \layout { }
}

Reply via email to