[icon]

GNU LilyPond

-- --

What is LilyPond
Home
Examples
Templates
Download
GNU/Linux binaries
Windows binaries
Source code
Documentation
Tutorial
Manual
Glossary
Index

Support
Mailing lists
Search
WikiWiki

External sites
lilypond.org/stable
lilypond.org/development
savannah.gnu.org
ftp.lilypond.org
Mutopia
Other music online

Percussion staves

To typeset more than one piece of percussion to be played by the same musician one typically uses a multiline staff where each staff position refers to a specific piece of percussion.

LilyPond is shipped with a bunch of scheme functions which allows you to do this fairly easily.

The system is based on the general midi drum-pitches. In order to use the drum pitches you include ly/drumpitch-init.ly. This file defines the pitches from the scheme variable drum-pitch-names - which definition can be read in scm/drums.scm. You see that each piece of percussion has a full name and an abbreviated name - and you may freely select whether to refer to the full name or the abbreviation in your music definition.

To typeset the music on a staff you apply the scheme function drums->paper to the percussion music. This function takes a list of percussion instrument names, notehead scripts and staff positions (that is: pitches relative to the C-clef) and uses this to transform the input music by moving the pitch, changing the notehead and (optionally) adding a script:

     \include "drumpitch-init.ly"
     up = \notes { crashcymbal4 hihat8 halfopenhihat hh hh hh openhihat }
     down = \notes { bassdrum4 snare8 bd r bd sn4 }
     \score {
         \apply #(drums->paper 'drums) \context Staff <
             \clef percussion
             \context Voice = up { \voiceOne \up }
             \context Voice = down { \voiceTwo \down }
         >
     }
     
     
[picture of music]
In the above example the music was transformed using the list 'drums. Currently the following lists are defined in scm/drums.scm:
'drums
To typeset a typical drum kit on a five-line staff.
[picture of music]

Notice that the scheme supports six different toms. If you are using fewer toms then you simply select the toms that produce the desired result - i.e. to get toms on the three middle lines you use tommh, tomml and tomfh.

Because the general midi contain no rimshots we use the sidestick for this purpose instead.

'timbales
To typeset timbales on a two line staff.
[picture of music]

'congas
To typeset congas on a two line staff.
[picture of music]

'bongos
To typeset bongos on a two line staff.
[picture of music]

'percussion
To typeset all kinds of simple percussion on one line staves.
[picture of music]

If you don't like any of the predefined lists you can define your own list at the top of your file:

     #(define mydrums `(
             (bassdrum     default   #f        ,(ly:make-pitch -1 2 0))
             (snare        default   #f        ,(ly:make-pitch 0 1 0))
             (hihat        cross     #f        ,(ly:make-pitch 0 5 0))
             (pedalhihat   xcircle   "stopped" ,(ly:make-pitch 0 5 0))
             (lowtom	      diamond   #f        ,(ly:make-pitch -1 6 0))
     ))
     \include "drumpitch-init.ly"
     up = \notes { hh8 hh hh hh hhp4 hhp }
     down = \notes { bd4 sn bd toml8 toml }
     \score {
         \apply #(drums->paper 'mydrums) \context Staff <
             \clef percussion
             \context Voice = up { \voiceOne \up }
             \context Voice = down { \voiceTwo \down }
         >
     }
     
[picture of music]

To use a modified existing list instead of building your own from scratch you can append your modifications to the start of the existing list:

     #(define mydrums (append `(
        (bassdrum default #f ,(ly:make-pitch -1 2 0))
        (lowtom   diamond #f ,(ly:make-pitch -1 6 0))
     ) drums ))
     
Percussion staves with normal staves

When you include drumpitch-init.ly then the default pitches are overridden so that you after the inclusion cannot use the common dutch pitch names anymore. Hence you might wan't to reinclude nederlands.ly after the drum-pattern-definitions:

     \include "drumpitch-init.ly"
     up = \notes { crashcymbal4 hihat8 halfopenhihat hh hh hh openhihat }
     down = \notes { bassdrum4 snare8 bd r bd sn4 }
     \include "nederlands.ly"
     bass = \notes \transpose c c,, { a4. e8 r e g e }
     \score {
         <
             \apply #(drums->paper 'drums) \context Staff = drums <
                 \clef percussion
                 \context Voice = up { \voiceOne \up }
                 \context Voice = down { \voiceTwo \down }
             >
             \context Staff = bass { \clef "F_8" \bass }
         >
     }
     
[picture of music]
Percussion midi output

In order to produce correct midi output you need to produce two score blocks - one for the paper and one for the midi. To use the percussion channel you set the property instrument to 'drums. Because the drum-pitches themself are similar to the general midi pitches all you have to do is to insert the voices with none of the scheme functions to get the correct midi output:

     \score {
         \apply #(drums->paper 'mydrums) \context Staff <
             \clef percussion
             \context Voice = up { \voiceOne \up }
             \context Voice = down { \voiceTwo \down }
         >
         \paper{}
     }
     \score {
         \context Staff <
             \property Staff.instrument = #'drums
             \up \down
         >
         \midi{}
     }
     

BUGS

This scheme is to be considered a temporary implementation. Even though the scheme will probably keep on working then the future might bring some other way of typesetting drums, and probably there will be made no great efforts in keeping things downwards compatible.

Go back to index of LilyPond.

Please send GNU LilyPond questions and comments to lilypond-user@gnu.org.

Please send comments on these web pages to (address unknown)

Copyright (c) 1997--2002 Han-Wen Nienhuys and Jan Nieuwenhuizen.

Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.


This page was built from LilyPond-1.7.14 (development-branch) by

Buchan Milne <(address unknown)>, Thu Mar 6 21:11:35 2003 CET.