\version "2.25.8"
\paper {
tagline = ##f
paper-height = 70\mm
}
% This function makes all tuplet brackets horizontal.
horizontalTuplets =
\override TupletBracket.stencil =
#(lambda (grob)
(let* ((pos (ly:grob-property grob 'positions))
(dir (ly:grob-property grob 'direction))
(new-pos (if (= dir 1)
(max (car pos)(cdr pos))
(min (car pos)(cdr pos)))))
(ly:grob-set-property! grob 'positions (cons new-pos new-pos))
(ly:tuplet-bracket::print grob)))
% A function to display large and centered time signatures between the
% staves, using a text font.
largeTimeSignatures =
\override TimeSignature.stencil =
#(lambda (grob)
(let ((fraction (ly:grob-property grob 'fraction '(4 . 4))))
(grob-interpret-markup
grob
(markup #:override '(font-size . 6)
#:override '(font-name . "New Century Schoolbook")
#:override '(baseline-skip . 3.5)
#:column ((ly:number->string (car fraction))
(ly:number->string (cdr fraction)))))))
% Within a `PianoStaff' context, dynamic marks can't be moved to the left of
% the preceding bar line by default (to avoid collisions with bar lines).
% The following macro overrides this, assigning a zero horizontal width to
% the dynamic mark.
noHorzSpace =
\tweak DynamicText.extra-spacing-width #'(+inf.0 . -inf.0) \etc
% A tweak-like function to move dynamics.
moveDyn =
#(define-event-function (x y event) (number? number? ly:event?)
#{ \tweak DynamicLineSpanner.outside-staff-priority ##f
\offset DynamicText.X-offset #x
\offset DynamicLineSpanner.Y-offset #y
#event #})
% Put the change clef after the bar line and time signature.
clefAfterBarline = {
\once \override Score.TimeSignature.space-alist.clef =
#'(minimum-space . 0)
\once \override Score.BreakAlignment.break-align-orders =
#(make-vector 3 '(staff-bar
time-signature
clef)) }
% Color shorthands.
blue = \override NoteHead.color = #blue
red = \override NoteHead.color = #red
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
RH = {
\set subdivideBeams = ##t
\set strictBeatBeaming = ##t
\override TupletBracket.bracket-visibility = ##t
\override TupletBracket.outside-staff-priority = #3
\horizontalTuplets
\tupletUp
% 1
\clef "treble"
\red
\tweak style #'dashed-line \tuplet 3/2 {
\tuplet 3/2 { d'4\noHorzSpace \moveDyn -1.5 -3.2 ^\ff r8 }
r8 } |
% 2
\blue
\tuplet 5/4 {
b'''16[\noHorzSpace \moveDyn -3.7 4 ^\mf
a''16.~\moveDyn 0 0.5 ^\ff }
\tuplet 5/4 {
a''32
\red
d'''8 \moveDyn 0 0 ^\ff }
\tuplet 5/4 {
\blue
r16.