lilypond-common-includes/swing_style.ly

72 lines
1.9 KiB
Plaintext

swing = \mark \markup {
\line \general-align #Y #DOWN {
\score {
\new Staff \with {
fontSize = #-2
\override StaffSymbol.line-count = #0
% \override VerticalAxisGroup.Y-extent = #'(0 . 0)
}
\relative {
\stemUp
\override Score.SpacingSpanner.common-shortest-duration = #(ly:make-moment 3 16)
\override Beam.positions = #'(2 . 2)
h'8[ h8]
}
\layout {
ragged-right= ##t
indent = 0
\context {
\Staff \remove "Clef_engraver"
\remove "Time_signature_engraver"
}
}
}
" ="
\score {
\new Staff \with {
fontSize = #-2
\override StaffSymbol.line-count = #0
% \override VerticalAxisGroup.Y-extent = #'(0 . 0)
}
\relative {
\stemUp
\override Score.SpacingSpanner.common-shortest-duration = #(ly:make-moment 3 16)
\override Stem.length = #4.5
\tuplet 3/2 { h'4 h8 }
}
\layout {
ragged-right= ##t
indent = 0
\context {
\Staff
\remove "Clef_engraver"
\remove "Time_signature_engraver"
}
}
}
}
}
\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
#})