diff --git a/README.md b/README.md index 14f8f2a..135f883 100644 --- a/README.md +++ b/README.md @@ -1,25 +1,19 @@ # Lilydrum (pipeband-drumming notation) -[Lilypond](http://lilypond.org) does not cover drum notation for pipebands out of the box. -That is, right is above the line and left is below it. \ -In the same manner as the bagpipe.ly file included with Lilypond, this library allows to easily use this notation with opt-in elements. -See the [cheatsheet](./cheatsheet.pdf) ([ly](./cheatsheet.ly), [pdf](./cheatsheet.pdf)) for a handful of definitions. +Somehow, the drums part in lilypond does not cover a notation with only right and left hands +(also known as Swiss style drum notation). +That is, right is above the line and left is below it. +In the same manner as the bagpipe.ly file included with lilypond, flams and drags are defined as a shortcut. -![preview of the score](./example.preview.png) \ -*(see [./example.ly](./example.ly) for fully annotated code and its [score](./example.pdf))* - -There has been such a Lilypond include file earlier, made by Simon Froger. This repository builds on his work. -The ~~original~~ (updated) file can be found at [http://lsr.di.unimi.it/LSR/Snippet?id=970](http://lsr.di.unimi.it/LSR/Snippet?id=970). +There has been such a lilypond include file earlier, made by Simon Froger +(which includes all of the above). +This repository builds on work. +The original file can still be found at [http://lsr.di.unimi.it/LSR/Snippet?id=970](http://lsr.di.unimi.it/LSR/Snippet?id=970). [His website (French) can be found here](https://simonfroger.wordpress.com/lilypond/caisse-claire-ecossaise/) This repository has also been converted into a [lyp](https://github.com/noteflakes/lyp) package: [lyp/lilydrum](https://github.com/lyp-packages/lilydrum). -*shameless plug:* \ -An example of scores typeset with this library can be found in - [kastdeur/pipeband-music](https://github.com/kastdeur/pipeband-music) - or - [on my website (pdf)](https://deboone.nl/scores/pipeband). ## How to use Add the following line to include the definitions for use in your document: @@ -59,6 +53,48 @@ To make a pipeband drumstaff (a `DrumStaff` with a few specific changes) you can *You do not need to use PipeBandDrumStaff to use the music definitions.* +## Example piece +*(see [./example.ly](./example.ly) for fully annotated code and its [score](./example.pdf))* + +![preview of the score](./example.preview.png) + + +This was generated by the following code. + +```lilypond +\include "lilydrum.ly" + +\header { title = "Standards 6/8" } +\score { + \new PipeBandDrumStaff { + \drummode { + \time 6/8 + \repeat volta 2 { + \partial 8 d8:32( | + g8.)[ g16 \drag d8] d8.[ d16 \drag g8] | + g8.[ \drag d16 d8] d8.[ d16 \drag g8] | + + \tutti { + \flam d8. d16 g8 d4.:32( | + d8.) g16 d8 \flam g4 + } + + d8:32( | + g8.)[ g16 \drag d8] d8.[ d16 \drag g8] | + g8.[ \drag d16 d8] d8.[ d16 \drag g8] | + + + \tutti{ + \flam d8. d16:64( d8) \flam d8. d16 \flam g8 | + d8.:32( d16) \flam g8 \flam d4 + } + } + } + } + } +``` + + ### Embellishments (Side Drum) Flams and Drags can be added using `\flam` and `\drag`. They can determine whether to be left or right by themselves for simple expressions. diff --git a/lilydrum/embellishments.ily b/lib/embellishments.ily similarity index 84% rename from lilydrum/embellishments.ily rename to lib/embellishments.ily index 6f2154d..18c6651 100644 --- a/lilydrum/embellishments.ily +++ b/lib/embellishments.ily @@ -8,8 +8,8 @@ drumgrace = #(define-music-function (parser location notes ) ( ly:music? ) #{ \once \override Beam.positions = #'(2 . 2) \once \override DrumStaff.Stem.length = #5 \override Flag.stroke-style = #"grace" - \override Score.GraceSpacing.spacing-increment = #0 - \override Score.Stem.beamlet-max-length-proportion = #'(0.5 . 0.5) + \override Score.GraceSpacing #'spacing-increment = #0 + \override Score.Stem #'beamlet-max-length-proportion = #'(0.5 . 0.5) % Print notes % Grace note timing is scaled, so they do not wander off too @@ -18,7 +18,7 @@ drumgrace = #(define-music-function (parser location notes ) ( ly:music? ) #{ \times 1/4 { \grace $notes } % Revert back - \revert Score.Stem.beamlet-default-length + \revert Score.Stem #'beamlet-default-length \revert Flag.stroke-style \stemNeutral #}) @@ -42,10 +42,10 @@ dragddr = \drummode { \drumgrace { g16[\dr g] } } % Drag right with start repea draggdr = \drummode { \drumgrace { d16[\dr d] } } % Drag left with start repeat % Open Drags -odragd = \drummode { \drumgrace { << { g16[ g] } { s16 s32^\markup { \musicglyph #"scripts.open" } } >> } } % Open Drag right -odragg = \drummode { \drumgrace { << { d16[ d] } { s16 s32^\markup { \musicglyph #"scripts.open" } } >> } } % Open Drag left -odragddr = \drummode { \drumgrace { << { d16[\dr d] } { s16 s32^\markup { \musicglyph #"scripts.open" } } >> } } % Open Drag right with start repeat -odraggdr = \drummode { \drumgrace { << { g16[\dr g] } { s16 s32^\markup { \musicglyph #"scripts.open" } } >> } } % Open Drag left with start repeat +odragd = \drummode { \drumgrace { << { g16[ g] } { s16 s32^\markup { \musicglyph #"scripts.open" } } >> } } % Open Drag right +odragg = \drummode { \drumgrace { << { d16[ d] } { s16 s32^\markup { \musicglyph #"scripts.open" } } >> } } % Open Drag left +odragddr = \drummode { \drumgrace { << { d16[\dr d] } { s16 s32^\markup { \musicglyph #"scripts.open" } } >> } } % Open Drag right with start repeat +odraggdr = \drummode { \drumgrace { << { g16[\dr g] } { s16 s32^\markup { \musicglyph #"scripts.open" } } >> } } % Open Drag left with start repeat % Ruff ruffg = \drummode { \drumgrace { d16[ g d] } } % Ruff right @@ -63,12 +63,18 @@ sruffddr = \drummode { \drumgrace { d16[\dr g g] } } % Swiss Ruff left with sta %% Embellishment functions, automatic left or right %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +get-first-note = #(define-music-function (music) (ly:music?) + "Get the first note-event in @var{music}" + (let ((note (car (extract-typed-music music 'note-event)))) + note + ) +) #(define (autohandFunc left right) "Return a music function that prepends @var{left} if the first next note-event is of type 'left-hand, else it will prepend @var{right}" (define-music-function (parser location music) (ly:music? ) - (let ((note (_get-first-note music))) + (let ((note (get-first-note music))) #{ #(if (string=? (symbol->string (ly:music-property note 'drum-type)) "left-hand") #{ $left #} @@ -92,7 +98,6 @@ optflamdr = #(autohandFunc optflamgdr optflamddr ) % Drag drag = #(autohandFunc dragg dragd ) dragdr = #(autohandFunc draggdr dragddr ) - % Open Drag odrag = #(autohandFunc odragg odragd ) odragdr = #(autohandFunc odraggdr odragddr ) diff --git a/lilydrum/flourishing.ily b/lib/flourishing.ily similarity index 91% rename from lilydrum/flourishing.ily rename to lib/flourishing.ily index 64ec6ce..60038cb 100644 --- a/lilydrum/flourishing.ily +++ b/lib/flourishing.ily @@ -335,26 +335,13 @@ flourish = #(define-music-function (parser location notes) (ly:music?) #}) % See issue #4 (https://github.com/kastdeur/lilydrum/issues/4) -scoop = #(define-music-function (music) (ly:music?) - (define (grace-music-filter event) - (let ((eventname (ly:music-property event 'name))) - (not (eq? eventname 'GraceMusic)))) - (let* - ( - (music-copy (ly:music-deep-copy music)) - (es (extract-typed-music (music-filter grace-music-filter music-copy) 'note-event)) - ) - (if (< (length es) 2) - (ly:message "A scoop requires at least two notes for positioning")) - ; do it anyway - #{ - <> - -\tweak HorizontalBracketText.text "scoop" - -\tweak HorizontalBracketText.whiteout 1 - \startGroup - #music - \stopGroup - #})) +scoop = #(define-music-function (music) (ly:music?) + #{ + <>^"scoop"\startGroup + #(allbutlastnote music) + <>\stopGroup + #(lastnote music) + #}) %---------------------------------------------------% % music function definitions %---------------------------------------------------% diff --git a/lilydrum/layout_tweaks.ily b/lib/layout_tweaks.ily similarity index 100% rename from lilydrum/layout_tweaks.ily rename to lib/layout_tweaks.ily diff --git a/lilydrum/midi.ily b/lib/midi.ily similarity index 100% rename from lilydrum/midi.ily rename to lib/midi.ily diff --git a/lilydrum/musical_functions.ily b/lib/musical_functions.ily similarity index 86% rename from lilydrum/musical_functions.ily rename to lib/musical_functions.ily index 572e81d..889c378 100644 --- a/lilydrum/musical_functions.ily +++ b/lib/musical_functions.ily @@ -91,6 +91,18 @@ odr = #(define-event-function (parser location) () #{ -\tag #'tutti \startGroup ofr = #(define-event-function (parser location) () #{ -\tag #'tutti \stopGroup #}) rn = #(define-event-function (parser location) () #{ -\tag #'tutti ^\markup \path #0.1 #'((moveto 0 0)(rlineto 0 1)(rlineto 4 0)(rlineto 0 -1)) #}) +#(define (allbutlastnote mus) + "Reverse the elements, Pop of (cdr) the first element, Reverse again, put it in a SequentialMusic" + (let ((elts (ly:music-property mus 'elements))) + (make-music 'SequentialMusic 'elements (reverse (cdr (reverse elts)))) + ) +) +#(define (lastnote mus) + "Get the last element, make it a list, put it in a SequentialMusic" + (let ((elts (ly:music-property mus 'elements))) + (make-music 'SequentialMusic 'elements (list (last elts))) + ) +) tutti = #(define-music-function (myMusic) (ly:music?) (define (grace-music-filter event) @@ -103,8 +115,8 @@ tutti = ) (if (> (length es) 1) #{% multiple notes - <> - \dr + \once \override HorizontalBracket.connect-to-neighbor = #'(#t #t) + <>\dr #myMusic \fr #} diff --git a/lilydrum/rehearsal_marks.ily b/lib/rehearsal_marks.ily similarity index 64% rename from lilydrum/rehearsal_marks.ily rename to lib/rehearsal_marks.ily index 3d48301..002decf 100644 --- a/lilydrum/rehearsal_marks.ily +++ b/lib/rehearsal_marks.ily @@ -4,20 +4,20 @@ % From Svenax's bagpipemusic markText = #(define-music-function (parser location text) (string?) #{ - \once \override Score.RehearsalMark.self-alignment-X = #LEFT + \once \override Score.RehearsalMark #'self-alignment-X = #LEFT \mark \markup $text #}) markTextEol = #(define-music-function (parser location text) (string?) #{ - \once \override Score.RehearsalMark.break-visibility = #end-of-line-visible - \once \override Score.RehearsalMark.self-alignment-X = #RIGHT + \once \override Score.RehearsalMark #'break-visibility = #end-of-line-visible + \once \override Score.RehearsalMark #'self-alignment-X = #RIGHT \mark \markup $text #}) markTextEolDown = #(define-music-function (parser location text) (string?) #{ - \once \override Score.RehearsalMark.break-visibility = #end-of-line-visible - \once \override Score.RehearsalMark.self-alignment-X = #RIGHT - \once \override Score.RehearsalMark.direction = #DOWN + \once \override Score.RehearsalMark #'break-visibility = #end-of-line-visible + \once \override Score.RehearsalMark #'self-alignment-X = #RIGHT + \once \override Score.RehearsalMark #'direction = #DOWN \mark \markup $text #}) altBracket = #(define-music-function (parser location tag) (string?) #{ diff --git a/lilydrum/special_sticking.ily b/lib/special_sticking.ily similarity index 100% rename from lilydrum/special_sticking.ily rename to lib/special_sticking.ily diff --git a/lilydrum.ly b/lilydrum.ly index 4012e6f..25f12ff 100644 --- a/lilydrum.ly +++ b/lilydrum.ly @@ -6,7 +6,7 @@ This file builds on work done by Simon Froger. - Substantial changes by ET de Boone (https://etdeboone.nl) + Substantial changes by ET de Boone, Seaforth Highlanders of Holland (seaforth.nl) Include by using : \include "[pathtothisfile]" e.g. "~/lilydrum.ly" @@ -26,10 +26,10 @@ #(ly:set-option 'relative-includes #t) -\include "lilydrum/layout_tweaks.ily" -\include "lilydrum/musical_functions.ily" -\include "lilydrum/embellishments.ily" -\include "lilydrum/flourishing.ily" -\include "lilydrum/special_sticking.ily" -\include "lilydrum/rehearsal_marks.ily" -\include "lilydrum/midi.ily" +\include "lib/layout_tweaks.ily" +\include "lib/musical_functions.ily" +\include "lib/embellishments.ily" +\include "lib/flourishing.ily" +\include "lib/special_sticking.ily" +\include "lib/rehearsal_marks.ily" +\include "lib/midi.ily"