With quite a bit of trial and error I figured out a way to write the following bar in Lilypond:
There are four voices, the top voice has upward stems, the two lower voices have downward stems, and the stems of the middle voice (in eighth notes) should be chosen as if there were no other voices. Furthermore, the notes of the middle voice should be beamed per beat.
This is the code:
\new Staff \relative c' {
\key b \minor
\time 3/4
\clef "treble_8"
\mergeDifferentlyHeadedOn
<< { \voiceOne d2 d4 } \\
{ \voiceTwo s4 fis,2 } \\
{ \voiceThree \stemNeutral d'8[ b] fis[ b] d[ b] } \\
{ \voiceFour b,2. } >> |
}
I think the code is quite clumsy and I was wondering if there is a more elegant and efficient way to do this. There are still about 50 similar bars to come ...
I would be very curious to know how someone with better Lilypond skills than me would solve such a problem.