swingMusic for midi that works with partials

This commit is contained in:
Christoph Wagner 2024-12-08 16:05:25 +01:00
parent a558a0b02f
commit ed30b34df2

View File

@ -46,3 +46,27 @@ swing = \mark \markup {
} }
} }
} }
\include "swing.ly"
swingMusic =
#(define-music-function (parser location music) (ly:music?)
(define (partial-duration-length m)
(let ((name (ly:music-property m 'name))
(es (ly:music-property m 'elements))
(e (ly:music-property m 'element)))
(if (pair? es)
(partial-duration-length (car es))
(if (ly:music? e)
(if (and (eq? name 'ContextSpeccedMusic) (eq? (ly:music-property e 'name) 'PartialSet))
(ly:duration-length (ly:music-property e 'duration))
(if (eq? name 'NoteEvent)
ZERO-MOMENT
(partial-duration-length e)
)
)
ZERO-MOMENT))))
#{
\swing
\applySwingWithOffset 8 #'(2 1) #(partial-duration-length music) #music
#})