1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
|
\version "2.23.6"
\header {
texidoc = "Pitches for drums may have a defined articulation sign.
This test checks the predefined drum-styles and prints only drum-pitches with an
articulation sign."
}
\paper { indent = 35 }
%% the currently predefined styles, see /ly/drumpitch-init.ly
#(define predefined-drumstyles
'(drums-style
agostini-drums-style
weinberg-drums-style
timbales-style
congas-style
bongos-style
percussion-style))
$@(map
(lambda (predefined-style)
(let* (;; `predefined-drumstyles` is a symbol-list, thus lookup the style in
;; (current-module)
(current-style-hash-table
(module-ref (current-module) predefined-style))
;; transform the hash-table into an alist and sort it, to ensure
;; reproducibility
(current-style
(sort
(hash-table->alist current-style-hash-table)
(lambda (p q)
(symbol<? (car p) (car q)))))
;; keep only drum-pitches with scripts, and
;; add label with the appropriate name.
(relevant-drum-notes
(filter-map
(lambda (entry)
(if (third entry)
(make-music
'NoteEvent
'articulations
(list (make-music
'TextScriptEvent
'direction DOWN
'text (object->string (car entry))))
'drum-type (car entry)
'duration (ly:make-duration 2))
#f))
current-style)))
#{
\new DrumStaff
\with {
instrumentName = #(symbol->string predefined-style)
drumStyleTable = #current-style-hash-table
\textLengthOn
}
\drummode {
\cadenzaOn
%% for styles where no scripts are defined, print a spacer and a remark
#@(if (null? relevant-drum-notes)
(list #{ s1^"No scripts defined" #})
relevant-drum-notes)
\bar "||"
}
#}))
predefined-drumstyles)
|