From 50da682fb676c5fa3e8466abe68fa196c1a0f4af Mon Sep 17 00:00:00 2001 From: Eric Teunis de Boone Date: Tue, 8 Aug 2023 22:13:12 +0200 Subject: [PATCH 1/5] Move internal functions into separate file for deprecation --- lib/embellishments.ily | 17 ++++++----------- lib/flourishing.ily | 4 ++-- lib/internal_functions.ily | 27 +++++++++++++++++++++++++++ lib/musical_functions.ily | 12 ------------ lilydrum.ly | 2 ++ 5 files changed, 37 insertions(+), 25 deletions(-) create mode 100644 lib/internal_functions.ily diff --git a/lib/embellishments.ily b/lib/embellishments.ily index 18c6651..ea94cbe 100644 --- a/lib/embellishments.ily +++ b/lib/embellishments.ily @@ -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,18 +63,12 @@ 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 #} @@ -98,6 +92,7 @@ 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/lib/flourishing.ily b/lib/flourishing.ily index 60038cb..424984d 100644 --- a/lib/flourishing.ily +++ b/lib/flourishing.ily @@ -338,9 +338,9 @@ flourish = #(define-music-function (parser location notes) (ly:music?) scoop = #(define-music-function (music) (ly:music?) #{ <>^"scoop"\startGroup - #(allbutlastnote music) + #(_allbutlastnote music) <>\stopGroup - #(lastnote music) + #(_lastnote music) #}) %---------------------------------------------------% % music function definitions diff --git a/lib/internal_functions.ily b/lib/internal_functions.ily new file mode 100644 index 0000000..e885610 --- /dev/null +++ b/lib/internal_functions.ily @@ -0,0 +1,27 @@ +% ================================================= % +% Internal Functions % +% as used by other files in this library % +% ================================================= % +% Part of lilydrum + +#(define ( _get-first-note mus) + "Get the first note-event in @var{music}" + (let ((note (car (extract-typed-music mus 'note-event)))) + note + ) +) + +#(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))) + ) +) + diff --git a/lib/musical_functions.ily b/lib/musical_functions.ily index 889c378..787eedb 100644 --- a/lib/musical_functions.ily +++ b/lib/musical_functions.ily @@ -91,18 +91,6 @@ 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) diff --git a/lilydrum.ly b/lilydrum.ly index 25f12ff..1587eae 100644 --- a/lilydrum.ly +++ b/lilydrum.ly @@ -26,6 +26,8 @@ #(ly:set-option 'relative-includes #t) +\include "lib/internal_functions.ily" + \include "lib/layout_tweaks.ily" \include "lib/musical_functions.ily" \include "lib/embellishments.ily" From 5440780bb0fd239fa9e9699a957270c49b0e7ceb Mon Sep 17 00:00:00 2001 From: Eric Teunis de Boone Date: Tue, 8 Aug 2023 23:17:00 +0200 Subject: [PATCH 2/5] Put subfiles into subdirectory with the package name This allows someone to use `\include lilydrum/embellishments.ily` if needed. --- lilydrum.ly | 16 ++++++++-------- {lib => lilydrum}/embellishments.ily | 0 {lib => lilydrum}/flourishing.ily | 0 {lib => lilydrum}/internal_functions.ily | 0 {lib => lilydrum}/layout_tweaks.ily | 0 {lib => lilydrum}/midi.ily | 0 {lib => lilydrum}/musical_functions.ily | 0 {lib => lilydrum}/rehearsal_marks.ily | 0 {lib => lilydrum}/special_sticking.ily | 0 9 files changed, 8 insertions(+), 8 deletions(-) rename {lib => lilydrum}/embellishments.ily (100%) rename {lib => lilydrum}/flourishing.ily (100%) rename {lib => lilydrum}/internal_functions.ily (100%) rename {lib => lilydrum}/layout_tweaks.ily (100%) rename {lib => lilydrum}/midi.ily (100%) rename {lib => lilydrum}/musical_functions.ily (100%) rename {lib => lilydrum}/rehearsal_marks.ily (100%) rename {lib => lilydrum}/special_sticking.ily (100%) diff --git a/lilydrum.ly b/lilydrum.ly index 1587eae..a08ddbe 100644 --- a/lilydrum.ly +++ b/lilydrum.ly @@ -26,12 +26,12 @@ #(ly:set-option 'relative-includes #t) -\include "lib/internal_functions.ily" +\include "lilydrum/internal_functions.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" +\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" diff --git a/lib/embellishments.ily b/lilydrum/embellishments.ily similarity index 100% rename from lib/embellishments.ily rename to lilydrum/embellishments.ily diff --git a/lib/flourishing.ily b/lilydrum/flourishing.ily similarity index 100% rename from lib/flourishing.ily rename to lilydrum/flourishing.ily diff --git a/lib/internal_functions.ily b/lilydrum/internal_functions.ily similarity index 100% rename from lib/internal_functions.ily rename to lilydrum/internal_functions.ily diff --git a/lib/layout_tweaks.ily b/lilydrum/layout_tweaks.ily similarity index 100% rename from lib/layout_tweaks.ily rename to lilydrum/layout_tweaks.ily diff --git a/lib/midi.ily b/lilydrum/midi.ily similarity index 100% rename from lib/midi.ily rename to lilydrum/midi.ily diff --git a/lib/musical_functions.ily b/lilydrum/musical_functions.ily similarity index 100% rename from lib/musical_functions.ily rename to lilydrum/musical_functions.ily diff --git a/lib/rehearsal_marks.ily b/lilydrum/rehearsal_marks.ily similarity index 100% rename from lib/rehearsal_marks.ily rename to lilydrum/rehearsal_marks.ily diff --git a/lib/special_sticking.ily b/lilydrum/special_sticking.ily similarity index 100% rename from lib/special_sticking.ily rename to lilydrum/special_sticking.ily From a627bafd2a955593a5e0510dc3a3c97fa96afee5 Mon Sep 17 00:00:00 2001 From: Eric Teunis de Boone Date: Wed, 9 Aug 2023 00:33:39 +0200 Subject: [PATCH 3/5] Closes #19: deprecation warnings due to property paths --- lilydrum/embellishments.ily | 6 +++--- lilydrum/rehearsal_marks.ily | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lilydrum/embellishments.ily b/lilydrum/embellishments.ily index ea94cbe..6f2154d 100644 --- a/lilydrum/embellishments.ily +++ b/lilydrum/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 #}) diff --git a/lilydrum/rehearsal_marks.ily b/lilydrum/rehearsal_marks.ily index 002decf..3d48301 100644 --- a/lilydrum/rehearsal_marks.ily +++ b/lilydrum/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?) #{ From 3b3844d7cbce5719d855f64e9f6d04903963e596 Mon Sep 17 00:00:00 2001 From: Eric Teunis de Boone Date: Thu, 10 Aug 2023 13:47:09 +0200 Subject: [PATCH 4/5] Update README --- README.md | 64 ++++++++++++------------------------------------------- 1 file changed, 14 insertions(+), 50 deletions(-) diff --git a/README.md b/README.md index 135f883..14f8f2a 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,25 @@ # Lilydrum (pipeband-drumming notation) -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. +[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. -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). +![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). [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: @@ -53,48 +59,6 @@ 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. From bafcc6ef6f307e469929b0a38e47bcbc1ad9055a Mon Sep 17 00:00:00 2001 From: Eric Teunis de Boone Date: Thu, 10 Aug 2023 13:51:34 +0200 Subject: [PATCH 5/5] Remove internal functions file --- lilydrum.ly | 4 +--- lilydrum/flourishing.ily | 27 ++++++++++++++++++++------- lilydrum/internal_functions.ily | 27 --------------------------- lilydrum/musical_functions.ily | 4 ++-- 4 files changed, 23 insertions(+), 39 deletions(-) delete mode 100644 lilydrum/internal_functions.ily diff --git a/lilydrum.ly b/lilydrum.ly index a08ddbe..4012e6f 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, Seaforth Highlanders of Holland (seaforth.nl) + Substantial changes by ET de Boone (https://etdeboone.nl) Include by using : \include "[pathtothisfile]" e.g. "~/lilydrum.ly" @@ -26,8 +26,6 @@ #(ly:set-option 'relative-includes #t) -\include "lilydrum/internal_functions.ily" - \include "lilydrum/layout_tweaks.ily" \include "lilydrum/musical_functions.ily" \include "lilydrum/embellishments.ily" diff --git a/lilydrum/flourishing.ily b/lilydrum/flourishing.ily index 424984d..64ec6ce 100644 --- a/lilydrum/flourishing.ily +++ b/lilydrum/flourishing.ily @@ -335,13 +335,26 @@ 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?) - #{ - <>^"scoop"\startGroup - #(_allbutlastnote music) - <>\stopGroup - #(_lastnote music) - #}) +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 + #})) %---------------------------------------------------% % music function definitions %---------------------------------------------------% diff --git a/lilydrum/internal_functions.ily b/lilydrum/internal_functions.ily deleted file mode 100644 index e885610..0000000 --- a/lilydrum/internal_functions.ily +++ /dev/null @@ -1,27 +0,0 @@ -% ================================================= % -% Internal Functions % -% as used by other files in this library % -% ================================================= % -% Part of lilydrum - -#(define ( _get-first-note mus) - "Get the first note-event in @var{music}" - (let ((note (car (extract-typed-music mus 'note-event)))) - note - ) -) - -#(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))) - ) -) - diff --git a/lilydrum/musical_functions.ily b/lilydrum/musical_functions.ily index 787eedb..572e81d 100644 --- a/lilydrum/musical_functions.ily +++ b/lilydrum/musical_functions.ily @@ -103,8 +103,8 @@ tutti = ) (if (> (length es) 1) #{% multiple notes - \once \override HorizontalBracket.connect-to-neighbor = #'(#t #t) - <>\dr + <> + \dr #myMusic \fr #}