# Stop Lilypond from placing beam around second voice

I have two voices in the right-hand staff. I'm not sure why Lilypond is doing what it is (see freehand circle) but I would like it to stop. The beam should ideally be somewhere near the red line, with the quaver it touches pointing upwards if necessary to avoid clashing.

In order to avoid this problem in the left hand, I tied a chord in only one voice (red arrow). I'm OK with this, because the notes are closer together and it's the easiest way to write it without the note's tail thingies clashing. However, that would worsen the situation in the right hand; the beam would go even higher.

What's the magic Lilypond command to fix all of the problems?

• Can you share your code? My first guess is that you have the voices mixed up. Remember that the higher voice should be placed first in the code. – Richard Mar 7 '19 at 21:28
• @Richard … Interesting. That is indeed what I've done. Care to write an answer? (I'll get an MCVE as soon as possible.) – wizzwizz4 Mar 7 '19 at 21:32

One possible problem may be how you organize your voices in the score.

Without seeing your code, I'm guessing you have something like this:

``````sample = \relative c'' {
g4. e8
<<
{
c8 b a g |
}
\\
{
g''4. e8 |
}
>>
}

\score {
\new Staff \sample
\layout { }
}
``````

The above code produces:

But remember that the higher voice should be input first, like so:

``````sample = \relative c'' {
g4. e8
<<
{
g'4. e8 |
}
\\
{
c,8 b a g |
}
>>
}

\score {
\new Staff \sample
\layout { }
}
``````

This code produces:

If you still want that lower voice to be stemUp, you can just precede its code with `\stemUp`, but there will be some warnings that result.

Depending on what you're trying to show with your score, you may want to adjust other aspects of this notation, too (like, for instance, whether the first two pitches are stemUp or stemDown).

The LilyPond manual clarifies where voices are located:

``````Voice 1: highest
Voice 2: lowest
Voice 3: second highest
Voice 4: second lowest
Voice 5: third highest
Voice 6: third lowest
etc.
``````