The notation for snare drum music used in bagpipe bands is somewhat nonstandard.

Here's some simple examples of the Association of North American Pipe Band Associations (ANAPBA) standardized "massed bands" scores.

I'm trying to determine the best way to typeset such scores with LilyPond. In my initial attempt, here are some challenges I've identified, with my workarounds where applicable. Are there better solutions, or existing solutions for the ones I haven't been able to fix?

  1. Unlike standard snare notation where all notes are on the line, the right hand is above the line, and the left below. I have solved this problem by defining a custom drum style table and using it.
  2. Ideally, all stems are at the same height. There are some cases, with un-beamed 8th notes, where this is not the case in the canonical examples above. I have managed to get all beams at the same height using \override Beam.positions = #'(-4 . -4), but have not found a workaround for un-beamed stems. Notably, my attempt has shorter quarter note and 8th note stems than the fixed beam position.
  3. The documentation recommends using tremolo for drum rolls. In my example below, the tremolo marks are perfectly horizontal and very narrow, making them difficult to distinguish from the 16th-note tails. In notation software specifically made for pipe band snare drumming, these lines are much thinner and closer to the note head. That would be the ideal. But just getting them diagonal would be acceptable.
  4. The music settings have a call-response framework. In the examples, you'll see some repeat-ending-shaped brackets above the staff. Those indicate sections that everyone should play. They're also often notated with a u. (for unison), where you'd normally see a 1 (for 1st ending). I can't figure out how to make these brackets. I tried playing with the manual repeat marks in the documentation, but couldn't figure out how to get the closing edge of the bracket without a repeat sign (as seen in the example below).

This code example replicates the first 4 measures of the 2/4 Massed Bands from the example link above. Then I doodle around for another 2 measures to properly demonstrate the other issues.

\version "2.22.1"

#(define scottish-snare '(
  (snare          default #f   1)  % right
  (acousticsnare  default #f  -1)  % left
  (sidestick      cross   #f   1)  % backstick right
  (hisidestick    cross   #f  -1)  % backstick left

\layout {
  indent = 0

rflam = #(define-music-function (dur) (ly:duration?)
  #{ \drummode { \slashedGrace sna8 sn$dur } #})
lflam = #(define-music-function (dur) (ly:duration?)
  #{ \drummode { \slashedGrace sn8 sna$dur } #})

\drums {
  \override Staff.StaffSymbol.line-count = #1
  \override Beam.positions = #'(-4 . -4)
  \set DrumStaff.drumStyleTable = #(alist->hash-table scottish-snare)

  \time 2/4
  \rflam8-> sn8:32( sna) sn8:32( | sna) sn16.-> sna32 sn16. 32 sna8 |
  \set Score.repeatCommands = #'((volta "2, 5"))
  \rflam8-> sn8:32( sna) sn8:32( | sna) sn16.-> sna32 sn16. 32 sna8 | \break \rflam8->
  \set Score.repeatCommands = #'((volta #f) end-repeat)
  sn4:32( 8) | 8 8 8 8 

Here is how each issue is demonstrated in the example above:

  1. My workaround works, with some notes above and some below the staff. Is this the best way to do this, though?
  2. The first line shows that all the beams are the same height. On the second line, we see that normal stems are shorter.
  3. The rolls/tremolos on line 1 just look bad to me. In the ANAPBA example, they are diagonal and here they are horizontal. Also compare with the tremolo/roll on the second line.
  4. The attempt at chip/unison notation ends up with a repeat sign mid-measure. But if I don't include end-repeat, the terminal vertical line for the bracket won't be there.
  • 1
    Normally I'd suggest splitting this into several smaller self-contained questions. Commented Oct 22, 2023 at 7:02

1 Answer 1


Firstly, I notice this code is in v2.22. This is probably not going to be an issue, but the latest stable version is v2.24 (and the latest unstable version is v2.25).


Secondly, when I copy your code into my setup and try to compile it, I get an error. This is because you've use percents % for comments inside the drum table. This is normally the right way to add comments, but because this part of the code is in Scheme you'll need to use semicolons ; instead (or both if you like ;%).

Drums style table

As for how to write the left and right hand parts, yeah the drum style table is what I'd be using too.

You might like to create some aliases for some more intuitive input (such as snl and ssl for the left hand), as can be seen in the answer to this question: aliases for notes in lilypond

Unison brackets

I wouldn't be using volta repeat brackets for the unison parts. This is mainly because you might need to use actual repeat brackets at some point, and then you'll be in trouble.

Fortunately, LilyPond has analysis brackets:

For these to work you'll need to add the following to your \layout block:

  \context {
    \consists "Horizontal_bracket_engraver"

To start and stop theses brackets use: \startGroup & \stopGroup.
Note that, like other brackets/parentheses in LilyPond, the code to start the bracket should be placed after the first note that is supposed to be inside the the bracket.
Also, note that you might have some trouble if grace notes appear at the very start.

To set these brackets above the staff use:
\override HorizontalBracket.direction = #UP

To move the bracket up a bit higher:
\override HorizontalBracket.staff-padding = #5

To get rid of the default flared ends:
\override HorizontalBracket.bracket-flare = #'(0 . 0)

And to get text above these use:
\override HorizontalBracketText.text = "u."

Tremolo beams

To get the tremolo beams on the already beamed/flagged notes, to match with the larger value notes you can override the slope with:
\override StemTremolo.slope = #0.25
and the width with:
\override StemTremolo.beam-width = #1.5

Tremolo syntax

There are actually two different ways to write tremolos in LilyPond: https://lilypond.org/doc/v2.24/Documentation/notation/short-repeats#tremolo-repeats

The method in your code uses colons, e.g. sn4:32. The numbers specify the total value of the tremolo, and then the sub-values.

The other method uses a repeat structure, e.g. \repeat tremolo 8 {sn32}. Here the numbers are the number of strokes, and value of each stroke respectively. It's arguably more complicated to think this way, but this method is compatible with MIDI output (if that is relevant).

Stem lengths

The stem lengths can all be increased with something like:
\override Stem.length = #10
but unfortunately this also affects the grace notes (which looks bad).

A simple fix to avoid this is by placing:
\once \revert Stem.length
inside your flam functions, but there is probably a cleaner way to achieve this.

  • Thanks for your detailed response. Regarding anaylsis brackets, is there a way to get text on the inside like in repeats? And for the stems, I would imagine setting the length means that left and right will end at different heights? Commented Oct 22, 2023 at 12:29
  • @user2676858 To get the analysis bracket text on the inside use: \override HorizontalBracketText.direction = #DOWN (but you'll probably need to increase the value of the staff padding). Commented Oct 22, 2023 at 12:38
  • @user2676858 Yeah, I suppose that the stem on a left hand notes will be lower/longer, but only if they're unbeamed. In the document you link to, the stems on the unbeamed left hand note actually seem to be considerably shorter than all the others. I'm not sure how to fix this, but it would make a good (separate) question. Commented Oct 22, 2023 at 13:09
  • "...because this part of the code is in Scheme." It's more than thirty years since I last had to use Scheme; Oh, the nostalgia!
    – Zaq
    Commented Oct 23, 2023 at 1:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.