Percussion

Percussion


Adding drum parts

Using the powerful pre-configured tools such as the \drummode function and the DrumStaff context, inputting drum parts is quite easy: drums are placed at their own staff positions (with a special clef symbol) and have note heads according to the drum. Attaching an extra symbol to the drum or restricting the number of lines is possible.

drh = \drummode {
 cymc4.^"crash" hhc16^"h.h." hh hhc8 hho hhc8 hh16 hh
 hhc4 r4 r2
 }
drl = \drummode {
 bd4 sn8 bd bd4 << bd ss >>
 bd8 tommh tommh bd toml toml bd tomfh16 tomfh
 }
timb = \drummode {
 timh4 ssh timl8 ssh r timh r4
 ssh8 timl r4 cb8 cb
 }
\score {
 <<
 \new DrumStaff \with {
 instrumentName = "timbales"
 drumStyleTable = #timbales-style
 \override StaffSymbol.line-count = #2
 \override BarLine.bar-extent = #'(-1 . 1)
 }
 <<
 \timb
 >>
 \new DrumStaff \with { instrumentName = "drums" }
 <<
 \new DrumVoice { \stemUp \drh }
 \new DrumVoice { \stemDown \drl }
 >>
 >>
 \layout { }
 \midi { \tempo 4 = 120 }
}

[image of music]


Customized drum notation in printed and MIDI output

Customized drum “pitch” names (suitable for a custom drum style, for example) may be used both in printed and MIDI output by defining such variables as drumPitchNames, drumStyleTable and midiDrumPitches, as demonstrated here. In short, this snippet:

%% This snippet tries to amend
%% NR 2.5.1 Common notation for percussion - Custom percussion staves
%% http://lilypond.org/doc/v2.18/Documentation/notation/common-notation-for-percussion#custom-percussion-staves
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%% To use custom drum-pitch-names for your score and midi you need to follow
%% this route:
%%
%%%%%%%%%%%%
%% LAYOUT:
%%%%%%%%%%%%
%%
%% (1) Define a name and put it in `drumPitchNames'
%% This can be done at toplevel with
%% drumPitchNames.my-name = #'my-name
%% It's possible to add an alias as well.
%% (2) Define how it should be printed
%% Therefore put them into a toplevel-list, where each entry should look:
%% (my-name
%% note-head-style-or-default
%% articulation-string-or-#f
%% staff-position)
%% Example:
%% #(define my-style
%% '(
%% (my-name default "tenuto" -1)
%% ; ...
%% ))
%% (3) Tell LilyPond to use this custom-definitions, with
%% drumStyleTable = #(alist->hash-table my-style)
%% in a \layout or \with
%%
%% Now we're done for layout, here a short, but complete example:
%% \new DrumStaff
%% \with { drumStyleTable = #(alist->hash-table my-style) }
%% \drummode { my-name }
%%
%%%%%%%%%%%%
%% MIDI:
%%%%%%%%%%%%
%%
%% (1) Again at toplvel, assign a pitch to your custom-note-name
%% midiDrumPitches.my-name = ges
%% Note that you have to use the name, which is in drumPitchNames, no alias
%% (2) Tell LilyPond to use this pitch(es), with
%% drumPitchTable = #(alist->hash-table midiDrumPitches)
%%
%% Example:
%% \score {
%% \new DrumStaff
%% \with {
%% drumStyleTable = #(alist->hash-table my-style)
%% drumPitchTable = #(alist->hash-table midiDrumPitches)
%% }
%% \drummode { my-name4 }
%% \layout {}
%% \midi {}
%% }
%%
%%%%%%%%%%%%
%% TESTING
%%%%%%%%%%%%
%%
%% To test whether all is fine, run the following sequence in terminal:
%% lilypond my-file.ly
%% midi2ly my-file.midi
%% gedit my-file-midi.ly
%%
%% Which will do:
%% 1. create pdf and midi
%% 2. transform the midi back to a .ly-file
%% (note: midi2ly is not always good in correctly identifying enharmonic pitches)
%% 3. open this file in gedit (or use another editor)
%% Now watch what you've got.
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% FULL EXAMPLE
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
drumPitchNames.dbass = #'dbass
drumPitchNames.dba = #'dbass % 'db is in use already
drumPitchNames.dbassmute = #'dbassmute
drumPitchNames.dbm = #'dbassmute
drumPitchNames.do = #'dopen
drumPitchNames.dopenmute = #'dopenmute
drumPitchNames.dom = #'dopenmute
drumPitchNames.dslap = #'dslap
drumPitchNames.ds = #'dslap
drumPitchNames.dslapmute = #'dslapmute
drumPitchNames.dsm = #'dslapmute
#(define djembe
 '((dbass default #f -2)
 (dbassmute default "stopped" -2)
 (dopen default #f 0)
 (dopenmute default "stopped" 0)
 (dslap default #f 2)
 (dslapmute default "stopped" 2)))
midiDrumPitches.dbass = g
midiDrumPitches.dbassmute = fis
midiDrumPitches.dopen = a
midiDrumPitches.dopenmute = gis
midiDrumPitches.dslap = b
midiDrumPitches.dslapmute = ais
one = \drummode { r4 dba4 do ds r dbm dom dsm }
\score {
 \new DrumStaff
 \with {
 \override StaffSymbol.line-count = #3
 instrumentName = #"Djembe "
 drumStyleTable = #(alist->hash-table djembe)
 drumPitchTable = #(alist->hash-table midiDrumPitches)
 }
 \one
 \layout {}
 \midi {}
}

[image of music]


Heavily customized polymetric time signatures

Though the polymetric time signature shown was not the most essential item here, it has been included to show the beat of this piece (which is the template of a real Balkan song!).

melody = \relative c'' {
 \key g \major
 \compoundMeter #'((3 8) (2 8) (2 8) (3 8) (2 8) (2 8)
 (2 8) (2 8) (3 8) (2 8) (2 8))
 c8 c c d4 c8 c b c b a4 g fis8 e d c b' c d e4-^ fis8 g \break
 c,4. d4 c4 d4. c4 d c2 d4. e4-^ d4
 c4. d4 c4 d4. c4 d c2 d4. e4-^ d4 \break
 c4. d4 c4 d4. c4 d c2 d4. e4-^ d4
 c4. d4 c4 d4. c4 d c2 d4. e4-^ d4 \break
}
drum = \new DrumStaff \drummode {
 \bar ".|:" bd4.^\markup { Drums } sn4 bd \bar ";" sn4.
 bd4 sn \bar ";" bd sn bd4. sn4 bd \bar ":|."
}
 \new Staff \with {
 instrumentName = \markup { \concat { "B" \flat " Sop." } }
 }
{
 \melody
 \drum
}

[image of music]


Jazz combo template

This is quite an advanced template, for a jazz ensemble. Note that all instruments are notated in \key c \major. This refers to the key in concert pitch; the key will be automatically transposed if the music is within a \transpose section.

\header {
 title = "Song"
 subtitle = "(tune)"
 composer = "Me"
 meter = "moderato"
 piece = "Swing"
 tagline = \markup {
 \column {
 "LilyPond example file by Amelie Zapf,"
 "Berlin 07/07/2003"
 }
 }
}
% To make the example display in the documentation
\paper {
 paper-width = 130
}
%#(set-global-staff-size 16)
\include "english.ly"
%%%%%%%%%%%% Some macros %%%%%%%%%%%%%%%%%%%
sl = {
 \override NoteHead.style = #'slash
 \hide Stem
}
nsl = {
 \revert NoteHead.style
 \undo \hide Stem
}
crOn = \override NoteHead.style = #'cross
crOff = \revert NoteHead.style
%% insert chord name style stuff here.
jazzChords = { }
%%%%%%%%%%%% Keys'n'thangs %%%%%%%%%%%%%%%%%
global = { \time 4/4 }
Key = { \key c \major }
% ############ Horns ############
% ------ Trumpet ------
trpt = \transpose c d \relative c'' {
 \Key
 c1 | c | c |
}
trpHarmony = \transpose c' d {
 \jazzChords
}
trumpet = {
 \global
 \clef treble
 <<
 \trpt
 >>
}
% ------ Alto Saxophone ------
alto = \transpose c a \relative c' {
 \Key
 c1 | c | c |
}
altoHarmony = \transpose c' a {
 \jazzChords
}
altoSax = {
 \global
 \clef treble
 <<
 \alto
 >>
}
% ------ Baritone Saxophone ------
bari = \transpose c a' \relative c {
 \Key
 c1
 c1
 \sl
 d4^"Solo" d d d
 \nsl
}
bariHarmony = \transpose c' a \chordmode {
 \jazzChords s1 s d2:maj e:m7
}
bariSax = {
 \global
 \clef treble
 <<
 \bari
 >>
}
% ------ Trombone ------
tbone = \relative c {
 \Key
 c1 | c | c
}
tboneHarmony = \chordmode {
 \jazzChords
}
trombone = {
 \global
 \clef bass
 <<
 \tbone
 >>
}
% ############ Rhythm Section #############
% ------ Guitar ------
gtr = \relative c'' {
 \Key
 c1
 \sl
 b4 b b b
 \nsl
 c1
}
gtrHarmony = \chordmode {
 \jazzChords
 s1 c2:min7+ d2:maj9
}
guitar = {
 \global
 \clef treble
 <<
 \gtr
 >>
}
%% ------ Piano ------
rhUpper = \relative c'' {
 \voiceOne
 \Key
 c1 | c | c
}
rhLower = \relative c' {
 \voiceTwo
 \Key
 e1 | e | e
}
lhUpper = \relative c' {
 \voiceOne
 \Key
 g1 | g | g
}
lhLower = \relative c {
 \voiceTwo
 \Key
 c1 | c | c
}
PianoRH = {
 \clef treble
 \global
 <<
 \new Voice = "one" \rhUpper
 \new Voice = "two" \rhLower
 >>
}
PianoLH = {
 \clef bass
 \global
 <<
 \new Voice = "one" \lhUpper
 \new Voice = "two" \lhLower
 >>
}
piano = {
 <<
 \new Staff = "upper" \PianoRH
 \new Staff = "lower" \PianoLH
 >>
}
% ------ Bass Guitar ------
Bass = \relative c {
 \Key
 c1 | c | c
}
bass = {
 \global
 \clef bass
 <<
 \Bass
 >>
}
% ------ Drums ------
up = \drummode {
 \voiceOne
 hh4 <hh sn> hh <hh sn>
 hh4 <hh sn> hh <hh sn>
 hh4 <hh sn> hh <hh sn>
}
down = \drummode {
 \voiceTwo
 bd4 s bd s
 bd4 s bd s
 bd4 s bd s
}
drumContents = {
 \global
 <<
 \new DrumVoice \up
 \new DrumVoice \down
 >>
}
%%%%%%%%% It All Goes Together Here %%%%%%%%%%%%%%%%%%%%%%
\score {
 <<
 \new StaffGroup = "horns" <<
 \new Staff = "trumpet" \with { instrumentName = "Trumpet" }
 \trumpet
 \new Staff = "altosax" \with { instrumentName = "Alto Sax" }
 \altoSax
 \new ChordNames = "barichords" \with { instrumentName = "Trumpet" }
 \bariHarmony
 \new Staff = "barisax" \with { instrumentName = "Bari Sax" }
 \bariSax
 \new Staff = "trombone" \with { instrumentName = "Trombone" }
 \trombone
 >>
 \new StaffGroup = "rhythm" <<
 \new ChordNames = "chords" \gtrHarmony
 \new Staff = "guitar" \with { instrumentName = "Guitar" }
 \guitar
 \new PianoStaff = "piano" \with {
 instrumentName = "Piano"
 midiInstrument = "acoustic grand"
 }
 \piano
 \new Staff = "bass" \with { instrumentName = "Bass" }
 \bass
 \new DrumStaff \with { instrumentName = "Drums" }
 \drumContents
 >>
 >>
 \layout {
 \context { \Staff \RemoveEmptyStaves }
 \context {
 \Score
 \override BarNumber.padding = #3
 \override RehearsalMark.padding = #2
 skipBars = ##t
 }
 }
 \midi { }
}

[image of music]


Percussion beaters

Graphic symbols for percussion instruments are not natively supported; however it is possible to include such symbols, either as an external EPS file or as embedded PostScript code inside a markup, as demonstrated in this example.

stick = \markup {
 \with-dimensions #'(0 . 5) #'(0 . 5)
 \postscript "
 0 6 translate
 0.8 -0.8 scale
 0 0 0 setrgbcolor
 [] 0 setdash
 1 setlinewidth
 0 setlinejoin
 0 setlinecap
 gsave [1 0 0 1 0 0] concat
 gsave [1 0 0 1 -3.5406095 -199.29342] concat
 gsave
 0 0 0 setrgbcolor
 newpath
 7.1434065 200.94354 moveto
 7.2109628 200.90454 7.2785188 200.86554 7.3460747 200.82654 curveto
 8.2056347 202.31535 9.0651946 203.80414 9.9247546 205.29295 curveto
 9.8571989 205.33195 9.7896429 205.37095 9.7220864 205.40996 curveto
 8.8625264 203.92115 8.0029664 202.43233 7.1434065 200.94354 curveto
 closepath
 eofill
 grestore
 gsave
 0 0 0 setrgbcolor
 newpath
 4.9646672 203.10444 moveto
 5.0036707 203.03688 5.0426744 202.96933 5.0816777 202.90176 curveto
 6.5704792 203.76133 8.0592809 204.6209 9.5480824 205.48045 curveto
 9.5090791 205.54801 9.4700754 205.61556 9.4310717 205.68311 curveto
 7.94227 204.82356 6.4534687 203.96399 4.9646672 203.10444 curveto
 closepath
 eofill
 grestore
 gsave
 <<
 /ShadingType 3
 /ColorSpace /DeviceRGB
 /Coords [113.13708 207.87465 0 113.13708 207.87465 16.162441]
 /Extend [true true]
 /Domain [0 1]
 /Function <<
 /FunctionType 3
 /Functions
 [
 <<
 /FunctionType 2
 /Domain [0 1]
 /C0 [1 1 1]
 /C1 [0.72941178 0.72941178 0.72941178]
 /N 1
 >>
 ]
 /Domain [0 1]
 /Bounds [ ]
 /Encode [ 0 1 ]
 >>
 >>
 newpath
 7.6422017 200.76488 moveto
 7.6505696 201.02554 7.3905363 201.24867 7.1341335 201.20075 curveto
 6.8759501 201.16916 6.6949602 200.87978 6.7801462 200.63381 curveto
 6.8480773 200.39155 7.1438307 200.25377 7.3728389 200.35861 curveto
 7.5332399 200.42458 7.6444521 200.59122 7.6422017 200.76488 curveto
 closepath
 clip
 gsave [
 0.052859054 0.063089841 -0.020912282 0.017521108 5.7334261 189.76443
 ] concat
 shfill
 grestore
 grestore
 0 0 0 setrgbcolor
 [] 0 setdash
 0.027282091 setlinewidth
 0 setlinejoin
 0 setlinecap
 newpath
 7.6422017 200.76488 moveto
 7.6505696 201.02554 7.3905363 201.24867 7.1341335 201.20075 curveto
 6.8759501 201.16916 6.6949602 200.87978 6.7801462 200.63381 curveto
 6.8480773 200.39155 7.1438307 200.25377 7.3728389 200.35861 curveto
 7.5332399 200.42458 7.6444521 200.59122 7.6422017 200.76488 curveto
 closepath
 stroke
 gsave
 <<
 /ShadingType 3
 /ColorSpace /DeviceRGB
 /Coords [113.13708 207.87465 0 113.13708 207.87465 16.162441]
 /Extend [true true]
 /Domain [0 1]
 /Function <<
 /FunctionType 3
 /Functions
 [
 <<
 /FunctionType 2
 /Domain [0 1]
 /C0 [1 1 1]
 /C1 [0.72941178 0.72941178 0.72941178]
 /N 1
 >>
 ]
 /Domain [0 1]
 /Bounds [ ]
 /Encode [ 0 1 ]
 >>
 >>
 newpath
 5.2721217 202.83181 moveto
 5.2804896 203.09247 5.0204563 203.3156 4.7640539 203.26768 curveto
 4.5058701 203.23609 4.3248803 202.94671 4.4100662 202.70074 curveto
 4.4779975 202.45848 4.7737511 202.3207 5.0027593 202.42554 curveto
 5.1631598 202.49149 5.2743721 202.65813 5.2721217 202.83181 curveto
 closepath
 clip
 gsave [
 0.052859054 0.063089841 -0.020912282 0.017521108 3.363346 191.83136
 ] concat
 shfill
 grestore
 grestore
 0 0 0 setrgbcolor
 [] 0 setdash
 0.027282091 setlinewidth
 0 setlinejoin
 0 setlinecap
 newpath
 5.2721217 202.83181 moveto
 5.2804896 203.09247 5.0204563 203.3156 4.7640539 203.26768 curveto
 4.5058701 203.23609 4.3248803 202.94671 4.4100662 202.70074 curveto
 4.4779975 202.45848 4.7737511 202.3207 5.0027593 202.42554 curveto
 5.1631598 202.49149 5.2743721 202.65813 5.2721217 202.83181 curveto
 closepath
 stroke
 grestore
 grestore
 "
}
\score {
 b1^\stick
}

[image of music]


Percussion example

A short example taken from Stravinsky’s L’histoire du Soldat.

#(define mydrums '((bassdrum default #t 4)
 (snare default #t -4)
 (tambourine default #t 0)))
global = {
 \time 3/8 s4.
 \time 2/4 s2*2
 \time 3/8 s4.
 \time 2/4 s2
}
drumsA = {
 \context DrumVoice <<
 { \global }
 { \drummode {
 \autoBeamOff
 \stemDown sn8 \stemUp tamb s8 |
 sn4 \stemDown sn4 |
 \stemUp tamb8 \stemDown sn8 \stemUp sn16 \stemDown sn \stemUp sn8 |
 \stemDown sn8 \stemUp tamb s8 |
 \stemUp sn4 s8 \stemUp tamb
 }
 }
 >>
}
drumsB = {
 \drummode {
 s4 bd8 s2*2 s4 bd8 s4 bd8 s8
 }
}
\layout {
 indent = #40
}
\score {
 \new StaffGroup <<
 \new DrumStaff \with {
 instrumentName = \markup {
 \center-column {
 "Tambourine"
 "et"
 "caisse claire s. timbre"
 }
 }
 drumStyleTable = #(alist->hash-table mydrums)
 }
 \drumsA
 \new DrumStaff \with {
 instrumentName = #"Grosse Caisse"
 drumStyleTable = #(alist->hash-table mydrums)
 }
 \drumsB
 >>
}

[image of music]


Printing music with different time signatures

In the following snippet, two parts have a completely different time signature, yet remain synchronized.

The bar lines can no longer be printed at the Score level; to allow independent bar lines in each part, the Default_barline_engraver and Timing_translator are moved from the Score context to the Staff context.

If bar numbers are required, the Bar_number_engraver should also be moved, since it relies on properties set by the Timing_translator; a \with block can be used to add bar numbers to the relevant staff.

\paper {
 indent = #0
 ragged-right = ##t
}
global = { \time 3/4 { s2.*3 } \bar "" \break { s2.*3 } }
\layout {
 \context {
 \Score
 \remove "Timing_translator"
 \remove "Default_bar_line_engraver"
 \remove "Bar_number_engraver"
 \override SpacingSpanner.uniform-stretching = ##t
 \override SpacingSpanner.strict-note-spacing = ##t
 proportionalNotationDuration = #(ly:make-moment 1/64)
 }
 \context {
 \Staff
 \consists "Timing_translator"
 \consists "Default_bar_line_engraver"
 }
 \context {
 \Voice
 \remove "Forbid_line_break_engraver"
 tupletFullLength = ##t
 }
}
Bassklarinette = \new Staff \with {
 \consists "Bar_number_engraver"
 barNumberVisibility = #(every-nth-bar-number-visible 2)
 \override BarNumber.break-visibility = #end-of-line-invisible
} <<
 \global {
 \bar "|"
 \clef treble
 \time 3/8
 d''4.
 \bar "|"
 \time 3/4
 r8 des''2( c''8)
 \bar "|"
 \time 7/8
 r4. ees''2 ~
 \bar "|"
 \time 2/4
 \tupletUp
 \tuplet 3/2 { ees''4 r4 d''4 ~ }
 \bar "|"
 \time 3/8
 \tupletUp
 \tuplet 4/3 { d''4 r4 }
 \bar "|"
 \time 2/4
 e''2
 \bar "|"
 \time 3/8
 es''4.
 \bar "|"
 \time 3/4
 r8 d''2 r8
 \bar "|"
 }
>>
Perkussion = \new StaffGroup <<
 \new Staff <<
 \global {
 \bar "|"
 \clef percussion
 \time 3/4
 r4 c'2 ~
 \bar "|"
 c'2.
 \bar "|"
 R2.
 \bar "|"
 r2 g'4 ~
 \bar "|"
 g'2. ~
 \bar "|"
 g'2.
 }
 >>
 \new Staff <<
 \global {
 \bar "|"
 \clef percussion
 \time 3/4
 R2.
 \bar "|"
 g'2. ~
 \bar "|"
 g'2.
 \bar "|"
 r4 g'2 ~
 \bar "|"
 g'2 r4
 \bar "|"
 g'2.
 }
 >>
>>
\score {
 <<
 \Bassklarinette
 \Perkussion
 >>
}

[image of music]


Tam-tam example

A tam-tam example, entered with ’tt’

#(define mydrums '((tamtam default #t 0)))
\new DrumStaff \with { instrumentName = #"Tamtam" }
\drummode {
 \set DrumStaff.drumStyleTable = #(alist->hash-table mydrums)
 \override Staff.StaffSymbol.line-positions = #'( 0 )
 \override Staff.BarLine.bar-extent = #'(-1.5 . 1.5)
 tt 1 \pp \laissezVibrer
}

[image of music]


<< Back to Documentation Index

LilyPond — Snippets v2.21.82 (development-branch).

AltStyle によって変換されたページ (->オリジナル) /