\version "2.25.3" \language "english" stripArticulations = #(define-scheme-function (music) (ly:music?) (define (strip-articulations-i o) (define (f l) (if (null? l) '() (let ((o (car l))) (if (music-is-of-type? o 'articulation-event) (f (cdr l)) (cons o (f (cdr l))))) )) (let ((els (ly:music-property o 'elements))) (map strip-articulations-i els)) (let ((arts (ly:music-property o 'articulations))) (cond ((not (null? arts)) (let ((n-arts (f arts))) (ly:music-set-property! o 'articulations n-arts))))) o) (strip-articulations-i (ly:music-deep-copy music)) ) forceAccidental = #(define-scheme-function (on_off music) (index? ly:music?) (let ((yn (if (= on_off 0) #f #t))) (define (force-accidental-i o) (define (f o) (cond ((music-is-of-type? o 'note-event) (ly:music-set-property! o 'force-accidental yn))) (force-accidental-i o) o ) (let ((els (ly:music-property o 'elements))) (map f els)) (let ((arts (ly:music-property o 'articulations))) (map f arts)) o ) (force-accidental-i (ly:music-deep-copy music)) ) ) rmtext = #(define-scheme-function (o) (ly:music?) (define (f o) (ly:music-set-property! o 'text "") (ly:music-set-property! o 'span-text "") (let ((t (ly:music-property o 'name))) (let ((els (ly:music-property o 'elements))) (if (null? els) (let ((arts (ly:music-property o 'articulations))) (map (lambda (a) (f a)) arts)) (map (lambda (e) (f e) ) els)))) ) (let ((oo (ly:music-deep-copy o))) (f oo) oo) ) withDuration = #(define-scheme-function (music duration adjusts) (ly:music? number? number?) (define (with-duration-internal m duration) (cond ((or (music-is-of-type? m 'note-event) (music-is-of-type? m 'rest-event) (music-is-of-type? m 'skip-event)) (ly:music-set-property! m 'duration (apply ly:make-duration duration))) ((music-is-of-type? m 'event-chord) (map (lambda (n) (with-duration-internal n duration)) (ly:music-property m 'elements))) (else (ly:warning "Neither note event nor chord")) ) m ) (with-duration-internal (ly:music-deep-copy music) (list duration adjusts)) ) flattenPitch = #(define-scheme-function (music) (ly:music?) (define (adjust-first l) (if (null? l) 'done (let ((e (car l))) (if (music-is-of-type? e 'note-event) (adjust-pitch-i e) (adjust-first (cdr l)))) ) ) (define (adjust-pitch-i m) (cond ((music-is-of-type? m 'note-event) (let* ((p (ly:music-property m 'pitch)) (pa (ly:pitch-alteration p)) (pn (ly:pitch-notename p)) (pp (ly:make-pitch -1 pn pa)) ) (ly:music-set-property! m 'pitch pp)) ) ((or (music-is-of-type? m 'event-chord) (music-is-of-type? m 'any)) (adjust-first (ly:music-property m 'elements)) ) ) m ) (adjust-pitch-i (ly:music-deep-copy music)) ) rep = #(define-scheme-function (n m) (index? ly:music?) (let ((nn (- n 1)) (mm (flattenPitch (rmtext m))) ) (if (> nn 0) #{ $m \repeat unfold $nn $mm #} #{ $m #} ) ) ) fr = #(define-scheme-function (n) (ly:music?) (rep 4 n)) frr = #(define-scheme-function (n) (ly:music?) (rep 8 n) ) none = #(define-scheme-function (n1 n2 n3 n4 n5 n6 n7 n8 n9) (ly:music? ly:music? ly:music? ly:music? ly:music? ly:music? ly:music? ly:music? ly:music?) #{ \times 2/3 { $n1 $n2 $n3 } \times 2/3 { $n4 $n5 $n6 } \times 2/3 { $n7 $n8 $n9 } #} ) tri = #(define-scheme-function (n1 n2 n3) (ly:music? ly:music? ly:music?) #{ \times 2/3 { $n1 $n2 $n3 } #} ) triN = #(define-scheme-function (n1 n2 n3) (ly:music? ly:music? ly:music?) #{ \tuplet 3/2 { \once \omit TupletNumber \once \omit TupletBracket $n1 $n2 $n3 } #} ) triG = #(define-scheme-function (n1 n2 n3) (ly:music? ly:music? ly:music?) #{ \times 2/3 { $n1[ $n2 $n3] } #} ) triGn = #(define-scheme-function (n1 n2 n3) (ly:music? ly:music? ly:music?) #{ \tuplet 3/2 { \once \omit TupletNumber $n1[ $n2 $n3] } #} ) markupBetween = #(define-scheme-function (a b c) (ly:music? ly:music? markup?) #{ \once \override Stem.X-extent = #'(1 . 5) $a ^$c $b #} ) turnBetween = #(define-scheme-function (a b) (ly:music? ly:music?) #{ \markupBetween $a $b \markup { \halign #-3 { \musicglyph #"scripts.turn" } } #} ) turnNaturalBetween = #(define-scheme-function (a b) (ly:music? ly:music?) #{ \markupBetween $a $b \markup { \halign #-3 \column { { \musicglyph #"scripts.turn" } \super { \musicglyph #"accidentals.natural" } } } #} ) turnNatural = ^\markup { \column { { \musicglyph #"scripts.turn" } \super { \musicglyph #"accidentals.natural" } }}