Three voices in same staff, from two variables

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Three voices in same staff, from two variables

Ben Rosen
Hi all,

I'm new here, so hopefully this isn't too basic of a question...

I'm trying to write out harmonizations for standard melodies, so my initial thought was to keep the melody in its own variable and the harmonies in another and then combine them using the "<< \\ >>" syntax (see below). This way, not only does it keep them conceptually separate in the file, but it would allow for multiple reharms that could be easily swapped out under the same melody. This seems to work fine when the harmony part is a single voice, but occasionally I want to break out into multiple voices to allow for moving inner parts. If I repeat the "<< \\ >>" syntax within the harmony part itself, then everything gets confused and it tries to draw a stem between parts that ought to be separate. Perhaps I should use something more explicit involving "\new Voice"? Is there a way to do this that preserves the variable structure I've laid out or is there a better approach for this situation?

Here is a simplified example of when things get confused:

\version "2.20.0"
\language "english"

melody = {
  af'2. af4 |
  af c g4. f8 |
}

harm = {
  << { <ef c>1 } \\ { bf2 af} >> |
  <df f> s |
}

\score {
  \relative c'
  <<
    \melody
    \\
    \harm
  >>
}

Thanks,
Ben
Reply | Threaded
Open this post in threaded view
|

Re: Three voices in same staff, from two variables

Francisco Vila
El 18/3/20 a las 20:41, Ben Rosen escribió:
> Perhaps I should use something more explicit involving "\new
> Voice"? Is there a way to do this that preserves the variable structure
> I've laid out or is there a better approach for this situation?

Here is how I would write your music.

\version "2.20.0"
\language "english"

melody = \relative c' {
   af'2. af4 |
   af c g4. f8 |
}

harm =  {
   <<
     \new Voice \relative c' { \voiceFour <ef c>1 }
     \new Voice \relative c' { \voiceTwo bf2 af <df f> s}
   >>

}

\score {
   \new Staff <<
     \new Voice { \voiceOne \melody }
     \harm
   >>
}

%%%%%%%%

I.e. go explicit as often as you can, so you don't lose control over
which voice number the music is in.

The part

   \voiceFour <ef c>1

comes from the aim to be an intermediate secondary voice.

https://cloud.paconet.org/index.php/s/wGaeX4CqYMHrD3Y/download

--
Francisco Vila, Ph.D. - Badajoz (Spain)
paconet.org , lilypond.es

attachment0 Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Three voices in same staff, from two variables

Ben Rosen
Thanks for your response!

I think I managed to get what I wanted (and no compilation errors) using just your "\new Voice { \voiceOne \melody }" in the \score block. The actual piece is a little different than this simplified example, and it seems like I don't need the multiple "\new Voice" statements in the "harm" variable, since I only need an extra voice for measure a single measure (9 of a 16-measure section), and using multiple new Voice statements would have meant using many measures' worth of spacers, which seemed excessive to me. But simply adding "\new Voice { \voiceOne \melody }" did the trick, and I may use your two-voiced example for other re-harmonizations, so thanks again!

Ben



On Wed, Mar 18, 2020 at 4:25 PM Francisco Vila <[hidden email]> wrote:
El 18/3/20 a las 20:41, Ben Rosen escribió:
> Perhaps I should use something more explicit involving "\new
> Voice"? Is there a way to do this that preserves the variable structure
> I've laid out or is there a better approach for this situation?

Here is how I would write your music.

\version "2.20.0"
\language "english"

melody = \relative c' {
   af'2. af4 |
   af c g4. f8 |
}

harm =  {
   <<
     \new Voice \relative c' { \voiceFour <ef c>1 }
     \new Voice \relative c' { \voiceTwo bf2 af <df f> s}
   >>

}

\score {
   \new Staff <<
     \new Voice { \voiceOne \melody }
     \harm
   >>
}

%%%%%%%%

I.e. go explicit as often as you can, so you don't lose control over
which voice number the music is in.

The part

   \voiceFour <ef c>1

comes from the aim to be an intermediate secondary voice.

https://cloud.paconet.org/index.php/s/wGaeX4CqYMHrD3Y/download

--
Francisco Vila, Ph.D. - Badajoz (Spain)
paconet.org , lilypond.es
Reply | Threaded
Open this post in threaded view
|

Re: Three voices in same staff, from two variables

David Kastrup
In reply to this post by Ben Rosen
Ben Rosen <[hidden email]> writes:

> Hi all,
>
> I'm new here, so hopefully this isn't too basic of a question...
>
> I'm trying to write out harmonizations for standard melodies, so my initial
> thought was to keep the melody in its own variable and the harmonies in
> another and then combine them using the "<< \\ >>" syntax (see below). This
> way, not only does it keep them conceptually separate in the file, but it
> would allow for multiple reharms that could be easily swapped out under the
> same melody. This seems to work fine when the harmony part is a single
> voice, but occasionally I want to break out into multiple voices to allow
> for moving inner parts. If I repeat the "<< \\ >>" syntax within the
> harmony part itself, then everything gets confused and it tries to draw a
> stem between parts that ought to be separate. Perhaps I should use
> something more explicit involving "\new Voice"? Is there a way to do this
> that preserves the variable structure I've laid out or is there a better
> approach for this situation?
>
> Here is a simplified example of when things get confused:
>
> \version "2.20.0"
> \language "english"
>
> melody = {
>   af'2. af4 |
>   af c g4. f8 |
> }
>
> harm = {
>   << { <ef c>1 } \\ { bf2 af} >> |
>   <df f> s |
> }
>
> \score {
>   \relative c'
>   <<
>     \melody
>     \\
>     \harm
>   >>
> }
In your case, you could probably write this as

\version "2.20.0"
\language "english"

melody = {
  af'2. af4 |
  af c g4. f8 |
}

harm = {
  \voices 4,2 << { <ef c>1 } \\ { bf2 af} >> |
  <df f> s |
}

\score {
  \relative c'
  <<
    \melody
    \\
    \harm
  >>
}


This relies on the knowledge that the harmony will take the lower voices
(and thus even voice numbers).

--
David Kastrup