Am Sa., 29. Juni 2019 um 11:06 Uhr schrieb Craig Dabelstein <craig.dabelst...@gmail.com>: > > Hi all, > > Is there a way to modify the Flams, Drags and Ruff snippet from the LSR > (http://lsr.di.unimi.it/LSR/Item?id=566) so that there can be open versions > of the drag and ruff (that's what exists now), and also a closed version of > the drag and ruff; i.e. joining the two or three notes with a slur. > > At the moment, to write a closed drag takes this code: > \grace { sn16 ( sn ) } > > Could the snippet be modified so that one could type: \dragclosed or > \dragopen. The same for the ruffs. > > All the best, > > Craig
Do you mean like below (2.19.x required): \version "2.19.82" %% http://lsr.di.unimi.it/LSR/Item?id=566 %% Return repeated single notes or chords, depending on @var{print-chord?} %% If @var{print-chord?} is set @code{#f}, the first written note is taken. %% The Number of repeats is set by @var{lngth} %% Only notes are returned. Other stuff like @code{Script}, @code{Fingering} %% is thrown away. #(define (grace-from-main-note print-chord? lngth music slurred?) (let* ((elts (ly:music-property music 'elements)) (has-duration? (lambda (x) (ly:duration? (ly:music-property x 'duration)))) ;; If the whole chord should be printed catch Notes only. ;; If the first written note should be printed catch it. ;; Otherwise, don't touch the music. (mus (cond ((and (music-is-of-type? music 'event-chord) print-chord?) (make-event-chord (event-chord-notes music))) ((music-is-of-type? music 'event-chord) (first (event-chord-notes music))) (else music))) ;; Set duration of note, clear 'articulations. (note (map-some-music (lambda (m) (and (has-duration? m) (begin (set! (ly:music-property m 'duration) (ly:make-duration (if (> lngth 1) 4 3) 0 1 1)) (set! (ly:music-property m 'articulations) '()) m))) (ly:music-deep-copy mus))) (next-note (ly:music-deep-copy note)) (last-note (ly:music-deep-copy note)) ;; Create a list of notes for use with (> lngth 1) (m-list (flatten-list (list note (make-list (max 0 (- lngth 2)) next-note) last-note)))) ;; Return a single note if (= lngth 1 ). ;; Insert Beam for (> lngth 1) and return the result. (cond ((= lngth 1 ) note) ((> lngth 1) (list-set! m-list 0 (begin (ly:music-set-property! note 'articulations (cons (make-music 'BeamEvent 'span-direction -1) (if slurred? (list (make-music 'SlurEvent 'spanner-id 'drag+ruff 'span-direction -1)) '()))) note)) (list-set! m-list (- lngth 1) (begin (ly:music-set-property! last-note 'articulations (cons (make-music 'BeamEvent 'span-direction 1) (if slurred? (list (make-music 'SlurEvent 'spanner-id 'drag+ruff 'span-direction 1)) '()))) last-note)) (make-sequential-music m-list)) ;; fall back (else (make-sequential-music '()))))) graceRepeat = #(define-music-function (chord-repeat? how-much note) ((boolean? #f) integer? ly:music?) "Return @var{note} preceded by repeated and beamed grace-notes. The number of grace-notes is specified by @var{how-much}. If @var{note} is a chord the first written note of it is used. If @var{chord-repeat?} is specified the whole chord is repeated during @code{GraceMusic}." #{ \slashedGrace { $(grace-from-main-note chord-repeat? how-much note #f) } $note #}) slurredGraceRepeat = #(define-music-function (chord-repeat? how-much note) ((boolean? #f) integer? ly:music?) "Return @var{note} preceded by repeated and beamed grace-notes. The number of grace-notes is specified by @var{how-much}. If @var{note} is a chord the first written note of it is used. If @var{chord-repeat?} is specified the whole chord is repeated during @code{GraceMusic}. Graces are slurred." #{ \slashedGrace { $(grace-from-main-note chord-repeat? how-much note #t) } $note #}) flam = #(define-music-function (music)(ly:music?) "Return @var{music} preceded by 1 grace-note" #{ \graceRepeat #1 $music #}) drag = #(define-music-function (slurred music)((boolean? #f) ly:music?) "Return @var{music} preceded by 2 grace-notes. Optionally slurred graces." #{ \slashedGrace { $(grace-from-main-note #f 2 music slurred) } $music #}) slurredDrag = \drag ##t \etc ruff = #(define-music-function (parser location slurred music)((boolean? #f) ly:music?) "Return @var{music} preceded by 3 grace-notes. Optionally slurred graces." #{ \slashedGrace { $(grace-from-main-note #f 3 music slurred) } $music #}) slurredRuff = \ruff ##t \etc %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % EXAMPLE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Note: the new coding works now for \notemode too. #(set-global-staff-size 18) \paper { indent = 0 } \layout { \context { \Score \override NonMusicalPaperColumn.line-break-permission = ##f } } << \new DrumStaff { \new DrumVoice \drummode { r4 \flam sn4 \drag cymr4 \ruff bd4 | \flam <sn bd>2 \flam <bd sn>2 | \graceRepeat ##t #4 <bd sn>1 | \graceRepeat #1 <bd sn>1 \graceRepeat #2 <bd sn>1 \graceRepeat #3 <bd sn>1 \graceRepeat #1 <bd sn>1 \graceRepeat #2 <bd sn>1 \graceRepeat #3 <bd sn>1 \graceRepeat #4 <bd sn>1 \graceRepeat #5 <bd sn>1 } } \new Staff \new Voice \relative c' { \flam c \drag d \ruff e \graceRepeat #4 f-1\2^"foo" \flam <c f> % Insert the beginning of a (Phrasing)Slur before the grace-notes. <>^\( \drag <f c> % Change appearance of grace-notes. $(add-grace-property 'Voice 'NoteHead 'style 'cross) \ruff <c f>~ <c f> $(remove-grace-property 'Voice 'NoteHead 'style) \graceRepeat #4 <f c> % Insert the beginning of a (Phrasing)Slur before the grace-notes. <>( \graceRepeat #5 <c f> \graceRepeat ##t #6 <f c-2\3>-"foo"-> )\) } >> \new DrumVoice \drummode { \drag sn4 \slurredDrag sn4 \ruff sn4 \slurredRuff sn4 \graceRepeat ##t #6 <bd sn>1 \slurredGraceRepeat ##t #6 <bd sn>1 } Cheers, Harm _______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user