[ << Keyboards ] | [Top][Contents][Index][ ? ] | [ Fretted strings >> ] | ||
[ < Keyboards: Vocal ensemble template with automatic piano reduction ] | [ Up : Top ] | [ Percussion: Adding drum parts > ] |
Percussion
[ << Percussion ] | [Top][Contents][Index][ ? ] | [ Fretted strings >> ] | ||
[ < Percussion ] | [ Up : Percussion ] | [ Percussion: Customize drumPitchNames drumStyleTable and drumPitchTable in layout and midi > ] |
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.
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][Index][ ? ] | [ Fretted strings >> ] | ||
[ < Percussion: Adding drum parts ] | [ Up : Percussion ] | [ Percussion: Heavily customized polymetric time signatures > ] |
Customize drumPitchNames drumStyleTable and drumPitchTable in layout and midi
If you want to use customized drum-pitch-names for an own drum-style with proper output for layout and midi, follow the steps as demonstrated in the code below. In short:
* define the names * define the appearence * tell LilyPond to use it for layout * assign pitches to the names * tell LilyPond to use them for midi
%% 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 %% or shorter: %% 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 = #(ly:make-pitch -1 4 FLAT) %% or shorter: %% 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 {} }
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!).
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 }
[ << Percussion ] | [Top][Contents][Index][ ? ] | [ Fretted strings >> ] | ||
[ < Percussion: Heavily customized polymetric time signatures ] | [ 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.
} } % 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][Index][ ? ] | [ Fretted strings >> ] | ||
[ < Percussion: Jazz combo template ] | [ Up : Percussion ] | [ Percussion: Printing music with different time signatures > ] |
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][Index][ ? ] | [ Fretted strings >> ] | ||
[ < Percussion: Percussion beaters ] | [ Up : Percussion ] | [ Fretted strings > ] |
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 >> }
[ << Percussion ] | [Top][Contents][Index][ ? ] | [ Fretted strings >> ] | ||
[ < Percussion: Percussion beaters ] | [ Up : Percussion ] | [ Fretted strings > ] |