Last active
March 4, 2024 19:38
-
-
Save cnicolai/9ba945cb2fd3fe7ab2846935665a817e to your computer and use it in GitHub Desktop.
File with self-defined Lilypond commands.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% Barree | |
%% da capo al fine | |
dcaf = { | |
\once \override Score.RehearsalMark #'break-visibility = #end-of-line-visible | |
\once \override Score.RehearsalMark #'self-alignment-X = #RIGHT | |
\mark "D.C. al Fine" | |
} | |
%% C with slash ------------------------------- | |
cWithSlash = \markup { | |
\combine \roman C \translate #'(0.6 . -0.4) \draw-line #'(0 . 2.0) | |
} | |
%% Span ----------------------------------- | |
%% Syntax: \bbarre #"text" { notes } - text = any number of box | |
bbarre = | |
#(define-music-function (barre location str music) (string? ly:music?) | |
(let ((elts (extract-named-music music '(NoteEvent EventChord)))) | |
(if (pair? elts) | |
(let ((first-element (first elts)) | |
(last-element (last elts))) | |
(set! (ly:music-property first-element 'articulations) | |
(cons (make-music 'TextSpanEvent 'span-direction -1) | |
(ly:music-property first-element 'articulations))) | |
(set! (ly:music-property last-element 'articulations) | |
(cons (make-music 'TextSpanEvent 'span-direction 1) | |
(ly:music-property last-element 'articulations)))))) | |
#{ | |
\once \override TextSpanner.font-size = #-2 | |
\once \override TextSpanner.font-shape = #'upright | |
\once \override TextSpanner.staff-padding = #3 | |
\once \override TextSpanner.style = #'line | |
\once \override TextSpanner.to-barline = ##f | |
\once \override TextSpanner.bound-details = | |
#`((left | |
(text . ,#{ \markup { \draw-line #'( 0 . -.5) } #}) | |
(Y . 0) | |
(padding . 0.25) | |
(attach-dir . -2)) | |
(right | |
(text . ,#{ \markup { \cWithSlash #str } #}) | |
(Y . 0) | |
(padding . 0.25) | |
(attach-dir . 2))) | |
%% uncomment this line for make full barred | |
% \once \override TextSpanner.bound-details.left.text = \markup{"B" #str} | |
$music | |
#}) | |
%% Copy and change the last line for full barred. Rename in 'fbarred.ly' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment