[ << Keyboards ] | [Top][Contents] | [ Fretted strings >> ] |
[ < Keyboards: Vocal ensemble template with automatic piano reduction ] | [ Up : Top ] | [ Percussion: Adding drum parts > ] |
Percussion
[ << Percussion ] | [Top][Contents] | [ Fretted strings >> ] |
[ < Percussion ] | [ Up : Percussion ] | [ Percussion: Cow and ride bell example > ] |
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 } }
[ << Percussion ] | [Top][Contents] | [ Fretted strings >> ] |
[ < Percussion: Adding drum parts ] | [ Up : Percussion ] | [ Percussion: Customized drum notation in printed and MIDI output > ] |
Cow and ride bell example
Two different bells, entered with ’cb’ (cowbell) and ’rb’ (ridebell).
\paper { tagline = ##f } #(define mydrums '((ridebell default #f 3) (cowbell default #f -2))) \new DrumStaff \with { instrumentName = #"Different Bells" } \drummode { \set DrumStaff.drumStyleTable = #(alist->hash-table mydrums) \set DrumStaff.clefPosition = 0.5 \override DrumStaff.StaffSymbol.line-positions = #'(-2 3) \override Staff.BarLine.bar-extent = #'(-1.0 . 1.5) \time 2/4 rb8 8 cb8 16 rb16-> ~ | 16 8 16 cb8 8 | }
[ << Percussion ] | [Top][Contents] | [ Fretted strings >> ] |
[ < Percussion: Cow and ride bell example ] | [ Up : Percussion ] | [ Percussion: Heavily customized polymetric time signatures > ] |
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:
- defines some "pitch" names,
- defines how they will be rendered,
- tells LilyPond to use them for layout,
- assigns pitches to the names,
- tells LilyPond to use them for MIDI output.
%% 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 #(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 {} }
[ << Percussion ] | [Top][Contents] | [ Fretted strings >> ] |
[ < Percussion: Customized drum notation in printed and MIDI output ] | [ Up : Percussion ] | [ Percussion: High and Low woodblock example > ] |
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 { \repeat volta 2 { bd4.^\markup { Drums } sn4 bd \bar ";" sn4. bd4 sn \bar ";" bd sn bd4. sn4 bd } } \new Staff \with { instrumentName = \markup { \concat { "B" \flat " Sop." } } } { \melody \drum }
[ << Percussion ] | [Top][Contents] | [ Fretted strings >> ] |
[ < Percussion: Heavily customized polymetric time signatures ] | [ Up : Percussion ] | [ Percussion: Jazz combo template > ] |
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. #(define mydrums '((hiwoodblock default #f 3) (lowoodblock default #f -2))) woodstaff = { % This defines a staff with only two lines. % It also defines the positions of the two lines. \override Staff.StaffSymbol.line-positions = #'(-2 3) % This is necessary; if not entered, % the barline would be too short! \override Staff.BarLine.bar-extent = #'(-1.0 . 1.5) % small correction for the clef: \set DrumStaff.clefPosition = 0.5 } \new DrumStaff { % with this you load your new drum style table \set DrumStaff.drumStyleTable = #(alist->hash-table mydrums) \woodstaff \drummode { \time 2/4 wbl8 16 16 8-> 8 | wbl8 16 16-> ~ 16 16 r8 | } }
[ << Percussion ] | [Top][Contents] | [ Fretted strings >> ] |
[ < Percussion: High and Low woodblock example ] | [ Up : Percussion ] | [ Percussion: Percussion beaters > ] |
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 { } }
[ << Percussion ] | [Top][Contents] | [ Fretted strings >> ] |
[ < Percussion: Jazz combo template ] | [ Up : Percussion ] | [ Percussion: Percussion example > ] |
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 }
[ << Percussion ] | [Top][Contents] | [ Fretted strings >> ] |
[ < Percussion: Percussion beaters ] | [ Up : Percussion ] | [ Percussion: Printing music with different time signatures > ] |
Percussion example
A short example taken from Stravinsky’s L’Histoire du soldat.
#(define mydrums '((bassdrum default #f 4) (snare default #f -4) (tambourine default #f 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 \context { \DrumStaff drumStyleTable = #(alist->hash-table mydrums) } } \score { \new StaffGroup << \new DrumStaff \with { instrumentName = \markup \center-column { "Tambourine" "et" "caisse claire s. timbre" } } \drumsA \new DrumStaff \with { instrumentName = "Grosse Caisse" } \drumsB >> }
[ << Percussion ] | [Top][Contents] | [ Fretted strings >> ] |
[ < Percussion: Percussion example ] | [ Up : Percussion ] | [ Percussion: Tam-tam example > ] |
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 = { \time 3/4 { s2.*3 } \bar "" \break { s2.*3 } } \layout { \context { \Score \remove "Timing_translator" \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" } \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 >> }
[ << Percussion ] | [Top][Contents] | [ Fretted strings >> ] |
[ < Percussion: Printing music with different time signatures ] | [ Up : Percussion ] | [ Percussion: Tambourine example > ] |
Tam-tam example
A tam-tam example, entered with ’tt’
#(define mydrums '((tamtam default #f 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 }
[ << Percussion ] | [Top][Contents] | [ Fretted strings >> ] |
[ < Percussion: Tam-tam example ] | [ Up : Percussion ] | [ Fretted strings > ] |
Tambourine example
A tambourine example, entered ’tamb’
\paper { tagline = ##f } #(define mydrums '((tambourine default #f 0))) \new DrumStaff \with { instrumentName = #"Tambourine" } \drummode { \set DrumStaff.drumStyleTable = #(alist->hash-table mydrums) \override Staff.StaffSymbol.line-positions = #'( 0 ) \override Staff.BarLine.bar-extent = #'(-1.5 . 1.5) \time 6/8 tamb8. 16 8 8 8 8 | tamb4. 8 8 8 | % the trick with the scaled duration and the shorter rest % is neccessary for the correct ending of the trill-span! tamb2.*5/6 \startTrillSpan s8 \stopTrillSpan | }
[ << Percussion ] | [Top][Contents] | [ Fretted strings >> ] |
[ < Percussion: Tam-tam example ] | [ Up : Percussion ] | [ Fretted strings > ] |