From ed30b34df21b75281f018b1d47e4701174016821 Mon Sep 17 00:00:00 2001 From: Christoph Wagner Date: Sun, 8 Dec 2024 16:05:25 +0100 Subject: [PATCH] swingMusic for midi that works with partials --- swing_style.ly | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/swing_style.ly b/swing_style.ly index c9602fe..4c45f0c 100644 --- a/swing_style.ly +++ b/swing_style.ly @@ -45,4 +45,28 @@ swing = \mark \markup { } } } -} \ No newline at end of file +} + +\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 +#}) \ No newline at end of file