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."hhhhc8hhohhc8hh16hh
hhc4r4r2
}
drl=\drummode{
bd4sn8bdbd4<<bdss>>
bd8tommhtommhbdtomltomlbdtomfh16tomfh
}
timb=\drummode{
timh4sshtiml8sshrtimhr4
ssh8timlr4cb8cb
}
\score{
<<
\newDrumStaff\with{
instrumentName="timbales"
drumStyleTable=#timbales-style
\overrideStaffSymbol.line-count=#2
\overrideBarLine.bar-extent=#'(-1.1)
}
<<
\timb
>>
\newDrumStaff\with{instrumentName="drums"}
<<
\newDrumVoice{\stemUp\drh}
\newDrumVoice{\stemDown\drl}
>>
>>
\layout{}
\midi{\tempo4=120}
}

[image of music]


Cow and ride bell example

Two different bells, entered with ’cb’ (cowbell) and ’rb’ (ridebell).

\paper{tagline=##f}
#(definemydrums'((ridebelldefault#f3)
(cowbelldefault#f-2)))
\newDrumStaff\with{instrumentName=#"Different Bells"}
\drummode{
\setDrumStaff.drumStyleTable=#(alist->hash-tablemydrums)
\setDrumStaff.clefPosition=0.5
\overrideDrumStaff.StaffSymbol.line-positions=#'(-23)
\overrideStaff.BarLine.bar-extent=#'(-1.0.1.5)
\time2/4
rb88cb816rb16->~|
16816cb88|
}

[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 top-level list, where each entry should
%% be of the form:
%% (my-name
%% note-head-style-or-default
%% articulation-type-or-#f
%% staff-position)
%% Example:
%% #(define my-style
%% '(
%% (my-name default tenuto -1)
%% ; ...
%% ))
%% (3) Tell LilyPond to use these custom definitions, with
%% drumStyleTable = #(alist->hash-table my-style)
%% in a \layout or \with block
%%
%% Now we're done for layout. Here is a short but complete example:
%% \new DrumStaff
%% \with { drumStyleTable = #(alist->hash-table my-style) }
%% \drummode { my-name }
%%
%%%%%%%%%%%%
%% MIDI:
%%%%%%%%%%%%
%%
%% (1) Again at top-level, 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
%%
%% This will do the following:
%% 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
#(definedjembe
'((dbassdefault#f-2)
(dbassmutedefaultstopped-2)
(dopendefault#f0)
(dopenmutedefaultstopped0)
(dslapdefault#f2)
(dslapmutedefaultstopped2)))
midiDrumPitches.dbass=g
midiDrumPitches.dbassmute=fis
midiDrumPitches.dopen=a
midiDrumPitches.dopenmute=gis
midiDrumPitches.dslap=b
midiDrumPitches.dslapmute=ais
one=\drummode{r4dba4dodsrdbmdomdsm}
\score{
\newDrumStaff
\with{
\overrideStaffSymbol.line-count=#3
instrumentName=#"Djembe "
drumStyleTable=#(alist->hash-tabledjembe)
drumPitchTable=#(alist->hash-tablemidiDrumPitches)
}
\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=\relativec''{
\keyg\major
\compoundMeter#'((38)(28)(28)(38)(28)(28)
(28)(28)(38)(28)(28))
c8ccd4c8cbcba4gfis8edcb'cde4-^fis8g\break
c,4.d4c4d4.c4dc2d4.e4-^d4
c4.d4c4d4.c4dc2d4.e4-^d4\break
c4.d4c4d4.c4dc2d4.e4-^d4
c4.d4c4d4.c4dc2d4.e4-^d4\break
}
drum=\newDrumStaff\drummode{
\repeatvolta2{
bd4.^\markup{Drums}sn4bd\bar";"
sn4.bd4sn\bar";"
bdsnbd4.sn4bd
}
}
\newStaff\with{
instrumentName=\markup{\concat{"B"\flat" Sop."}}
}
{
\melody
\drum
}

[image of music]


High and Low woodblock example

Two Woodblocks, entered with ’wbh’ (high woodblock) and ’wbl’ (low woodblock). The length of the barline has been altered with an \override command otherwise it would be too short. The positions of the two stafflines also have to be explicitly defined.

\paper{tagline=##f}
% These lines define the position of the woodblocks in the stave;
% if you like, you can change it or you can use special note heads
% for the woodblocks.
#(definemydrums'((hiwoodblockdefault#f3)
(lowoodblockdefault#f-2)))
woodstaff={
% This defines a staff with only two lines.
% It also defines the positions of the two lines.
\overrideStaff.StaffSymbol.line-positions=#'(-23)
% This is necessary; if not entered,
% the barline would be too short!
\overrideStaff.BarLine.bar-extent=#'(-1.0.1.5)
% small correction for the clef:
\setDrumStaff.clefPosition=0.5
}
\newDrumStaff{
% with this you load your new drum style table
\setDrumStaff.drumStyleTable=#(alist->hash-tablemydrums)
\woodstaff
\drummode{
\time2/4
wbl816168->8|
wbl81616->~1616r8|
}
}

[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={
\overrideNoteHead.style=#'slash
\hideStem
}
nsl={
\revertNoteHead.style
\undo\hideStem
}
crOn=\overrideNoteHead.style=#'cross
crOff=\revertNoteHead.style
%% insert chord name style stuff here.
jazzChords={}
%%%%%%%%%%%% Keys'n'thangs %%%%%%%%%%%%%%%%%
global={\time4/4}
Key={\keyc\major}
% ############ Horns ############
% ------ Trumpet ------
trpt=\transposecd\relativec''{
\Key
c1|c|c|
}
trpHarmony=\transposec'd{
\jazzChords
}
trumpet={
\global
\cleftreble
<<
\trpt
>>
}
% ------ Alto Saxophone ------
alto=\transposeca\relativec'{
\Key
c1|c|c|
}
altoHarmony=\transposec'a{
\jazzChords
}
altoSax={
\global
\cleftreble
<<
\alto
>>
}
% ------ Baritone Saxophone ------
bari=\transposeca'\relativec{
\Key
c1
c1
\sl
d4^"Solo"ddd
\nsl
}
bariHarmony=\transposec'a\chordmode{
\jazzChordss1sd2:maje:m7
}
bariSax={
\global
\cleftreble
<<
\bari
>>
}
% ------ Trombone ------
tbone=\relativec{
\Key
c1|c|c
}
tboneHarmony=\chordmode{
\jazzChords
}
trombone={
\global
\clefbass
<<
\tbone
>>
}
% ############ Rhythm Section #############
% ------ Guitar ------
gtr=\relativec''{
\Key
c1
\sl
b4bbb
\nsl
c1
}
gtrHarmony=\chordmode{
\jazzChords
s1c2:min7+d2:maj9
}
guitar={
\global
\cleftreble
<<
\gtr
>>
}
%% ------ Piano ------
rhUpper=\relativec''{
\voiceOne
\Key
c1|c|c
}
rhLower=\relativec'{
\voiceTwo
\Key
e1|e|e
}
lhUpper=\relativec'{
\voiceOne
\Key
g1|g|g
}
lhLower=\relativec{
\voiceTwo
\Key
c1|c|c
}
PianoRH={
\cleftreble
\global
<<
\newVoice="one"\rhUpper
\newVoice="two"\rhLower
>>
}
PianoLH={
\clefbass
\global
<<
\newVoice="one"\lhUpper
\newVoice="two"\lhLower
>>
}
piano={
<<
\newStaff="upper"\PianoRH
\newStaff="lower"\PianoLH
>>
}
% ------ Bass Guitar ------
Bass=\relativec{
\Key
c1|c|c
}
bass={
\global
\clefbass
<<
\Bass
>>
}
% ------ Drums ------
up=\drummode{
\voiceOne
hh4<hhsn>hh<hhsn>
hh4<hhsn>hh<hhsn>
hh4<hhsn>hh<hhsn>
}
down=\drummode{
\voiceTwo
bd4sbds
bd4sbds
bd4sbds
}
drumContents={
\global
<<
\newDrumVoice\up
\newDrumVoice\down
>>
}
%%%%%%%%% It All Goes Together Here %%%%%%%%%%%%%%%%%%%%%%
\score{
<<
\newStaffGroup="horns"<<
\newStaff="trumpet"\with{instrumentName="Trumpet"}
\trumpet
\newStaff="altosax"\with{instrumentName="Alto Sax"}
\altoSax
\newChordNames="barichords"\with{instrumentName="Trumpet"}
\bariHarmony
\newStaff="barisax"\with{instrumentName="Bari Sax"}
\bariSax
\newStaff="trombone"\with{instrumentName="Trombone"}
\trombone
>>
\newStaffGroup="rhythm"<<
\newChordNames="chords"\gtrHarmony
\newStaff="guitar"\with{instrumentName="Guitar"}
\guitar
\newPianoStaff="piano"\with{
instrumentName="Piano"
midiInstrument="acoustic grand"
}
\piano
\newStaff="bass"\with{instrumentName="Bass"}
\bass
\newDrumStaff\with{instrumentName="Drums"}
\drumContents
>>
>>
\layout{
\context{\Staff\RemoveEmptyStaves}
\context{
\Score
\overrideBarNumber.padding=#3
\overrideRehearsalMark.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.

#(definemydrums'((bassdrumdefault#f4)
(snaredefault#f-4)
(tambourinedefault#f0)))
global={
\time3/8s4.
\time2/4s2*2
\time3/8s4.
\time2/4s2
}
drumsA={
\contextDrumVoice<<
{\global}
{\drummode{
\autoBeamOff
\stemDownsn8\stemUptambs8|
sn4\stemDownsn4|
\stemUptamb8\stemDownsn8\stemUpsn16\stemDownsn\stemUpsn8|
\stemDownsn8\stemUptambs8|
\stemUpsn4s8\stemUptamb
}
}
>>
}
drumsB={
\drummode{
s4bd8s2*2s4bd8s4bd8s8
}
}
\layout{
indent=40
\context{
\DrumStaff
drumStyleTable=#(alist->hash-tablemydrums)
}
}
\score{
\newStaffGroup<<
\newDrumStaff\with{
instrumentName=\markup\center-column{
"Tambourine"
"et"
"caisse claire s. timbre"
}
}
\drumsA
\newDrumStaff\with{
instrumentName="Grosse Caisse"
}
\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 Timing_translator is 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={\time3/4{s2.*3}\bar""\break{s2.*3}}
\layout{
\context{
\Score
\remove"Timing_translator"
\remove"Bar_number_engraver"
\overrideSpacingSpanner.uniform-stretching=##t
\overrideSpacingSpanner.strict-note-spacing=##t
proportionalNotationDuration=#(ly:make-moment1/64)
}
\context{
\Staff
\consists"Timing_translator"
}
\context{
\Voice
\remove"Forbid_line_break_engraver"
tupletFullLength=##t
}
}
Bassklarinette=\newStaff\with{
\consists"Bar_number_engraver"
barNumberVisibility=#(every-nth-bar-number-visible2)
\overrideBarNumber.break-visibility=#end-of-line-invisible
}<<
\global{
\bar"|"
\cleftreble
\time3/8
d''4.
\bar"|"
\time3/4
r8des''2(c''8)
\bar"|"
\time7/8
r4.ees''2~
\bar"|"
\time2/4
\tupletUp
\tuplet3/2{ees''4r4d''4~}
\bar"|"
\time3/8
\tupletUp
\tuplet4/3{d''4r4}
\bar"|"
\time2/4
e''2
\bar"|"
\time3/8
es''4.
\bar"|"
\time3/4
r8d''2r8
\bar"|"
}
>>
Perkussion=\newStaffGroup<<
\newStaff<<
\global{
\bar"|"
\clefpercussion
\time3/4
r4c'2~
\bar"|"
c'2.
\bar"|"
R2.
\bar"|"
r2g'4~
\bar"|"
g'2.~
\bar"|"
g'2.
}
>>
\newStaff<<
\global{
\bar"|"
\clefpercussion
\time3/4
R2.
\bar"|"
g'2.~
\bar"|"
g'2.
\bar"|"
r4g'2~
\bar"|"
g'2r4
\bar"|"
g'2.
}
>>
>>
\score{
<<
\Bassklarinette
\Perkussion
>>
}

[image of music]


Tam-tam example

A tam-tam example, entered with ’tt’

#(definemydrums'((tamtamdefault#f0)))
\newDrumStaff\with{instrumentName=#"Tamtam"}
\drummode{
\setDrumStaff.drumStyleTable=#(alist->hash-tablemydrums)
\overrideStaff.StaffSymbol.line-positions=#'(0)
\overrideStaff.BarLine.bar-extent=#'(-1.5.1.5)
tt1\pp\laissezVibrer
}

[image of music]


Tambourine example

A tambourine example, entered ’tamb’

\paper{tagline=##f}
#(definemydrums'((tambourinedefault#f0)))
\newDrumStaff\with{instrumentName=#"Tambourine"}
\drummode{
\setDrumStaff.drumStyleTable=#(alist->hash-tablemydrums)
\overrideStaff.StaffSymbol.line-positions=#'(0)
\overrideStaff.BarLine.bar-extent=#'(-1.5.1.5)
\time6/8
tamb8.168888|
tamb4.888|
% the trick with the scaled duration and the shorter rest
% is neccessary for the correct ending of the trill-span!
tamb2.*5/6\startTrillSpans8\stopTrillSpan|
}

[image of music]


<< Back to Documentation Index

LilyPond — Snippets v2.24.4 (stable-branch).

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