On 2024-04-16 21:59, Gerardo Ballabio wrote:
Hello all,
I'm trying to typeset a percussion score with several instruments on
the same staff. When they play simultaneous notes I want to line them
up all on the same stem, like this (output attached, percussion1.pdf):

%%%%%%%%%%
\version "2.24.1"

\new Staff \relative {
   \clef "varpercussion"
   \stemDown
   R1 |
   r2 <e b' f'>2\f-> |
   R1 |
   r2 q2-> |
}
%%%%%%%%%%

But I'd like to write down each part separately, so that I may also
print the single parts without redoing everything. And I also want to
use different note heads for each instrument.
This is the best I could come up with:

%%%%%%%%%%
\version "2.24.1"

bassDrum = \relative {
   \stemDown
   s1 |
   s2 b2-> |
   s1 |
   s2 b2-> |
}

cymbals = \relative {
   \override NoteHead.style = #'xcircle \stemDown
   s1 |
   s2 f'2 |
   s1 |
   s2 f2 |
}

tamTam = \relative {
   \override NoteHead.style = #'cross \stemDown
   s1 |
   s2 e2 |
   s1 |
   s2 e2 |
}

pause = \new Voice {
   \clef "varpercussion"
   \time 4/4
   R1 |
   r2 s2\f |
   R1 |
   r2 s2 |
}

percussions = \new Voice \relative {
   <<
     \cymbals
   \\
     \tamTam
   \\
     \bassDrum
   >>
}

\new Staff
<<
   \pause
   \percussions
%%%%%%%%%%

But as you can see (output attached, percussion2.pdf) the three notes
aren't aligned on the same stem, only two of them are.

I tried \partCombine, it works nicely with two parts, but if there's a
way to combine three or more I didn't find it.

Any help is much appreciated.

Just remove the "\\" in your definition of percussions:

percussions = \new Voice \relative {
  <<
    \cymbals
    \tamTam
    \bassDrum
  >>
}
In that way, all three lines of music will belong to the same Voice.

When you use the construct << ... \\ ... >>, you explicitly ask LilyPond to create separate voices with separate stems, for the different lines of music, which is not what you want in this particular situation.

    /Mats


Reply via email to