2015-11-05 01:39:52 +01:00
|
|
|
% ================================================= %
|
|
|
|
% Musical Functions %
|
|
|
|
% ================================================= %
|
|
|
|
% Part of lilydrum
|
|
|
|
|
2015-11-05 03:28:25 +01:00
|
|
|
eighthBeaming = {
|
2017-05-29 17:09:06 +02:00
|
|
|
\set baseMoment = #(ly:make-moment 1/8)
|
|
|
|
\set beatStructure = #'( 2 2 2 2)
|
2015-11-05 03:28:25 +01:00
|
|
|
}
|
2016-04-27 02:57:44 +02:00
|
|
|
eighthReelBeaming = {
|
2017-05-29 17:09:06 +02:00
|
|
|
\set baseMoment = #(ly:make-moment 1/8)
|
|
|
|
\set beatStructure = #'( 4 4 4 4)
|
2016-04-27 02:57:44 +02:00
|
|
|
}
|
2016-07-12 11:19:49 +02:00
|
|
|
eighthCompoundBeaming = {
|
2017-05-29 17:09:06 +02:00
|
|
|
\set baseMoment = #(ly:make-moment 1/8)
|
|
|
|
\set beatStructure = #'( 3 3 3 3)
|
2015-11-05 03:28:25 +01:00
|
|
|
}
|
|
|
|
|
2016-11-23 03:24:56 +01:00
|
|
|
sixteenthBeaming = {
|
2017-05-29 17:09:06 +02:00
|
|
|
\set baseMoment = #(ly:make-moment 1/16)
|
|
|
|
\set beatStructure = #'( 4 4 4 4)
|
2016-11-23 03:24:56 +01:00
|
|
|
}
|
|
|
|
sixteenthReelBeaming = {
|
2017-05-29 17:09:06 +02:00
|
|
|
\set baseMoment = #(ly:make-moment 1/16)
|
|
|
|
\set beatStructure = #'( 8 8 8 8)
|
2016-11-23 03:24:56 +01:00
|
|
|
}
|
|
|
|
sixteenthCompoundBeaming = {
|
2017-05-29 17:09:06 +02:00
|
|
|
\set baseMoment = #(ly:make-moment 1/16)
|
|
|
|
\set beatStructure = #'( 6 6 6 6)
|
2016-11-23 03:24:56 +01:00
|
|
|
}
|
2015-11-05 01:39:52 +01:00
|
|
|
% triplet
|
2018-01-30 16:19:05 +01:00
|
|
|
triplet = #(define-music-function (parser location music) (ly:music?) #{ \tuplet 3/2 { $music } #})
|
2020-08-06 16:43:37 +02:00
|
|
|
quintuplet = #(define-music-function (parser location music) (ly:music?) #{ \tuplet 5/2 { $music } #})
|
|
|
|
sextuplet = #(define-music-function (parser location music) (ly:music?) #{ \tuplet 6/4 { $music } #})
|
2015-11-05 01:39:52 +01:00
|
|
|
|
|
|
|
% dynamics
|
|
|
|
v = #(define-event-function (parser location) () #{ \upbow #})
|
|
|
|
|
2017-05-29 17:09:06 +02:00
|
|
|
|
|
|
|
#(define (text-spanner-start-stop mus)
|
|
|
|
(let ((elts (ly:music-property mus 'elements)))
|
2018-02-27 23:33:31 +01:00
|
|
|
(make-music 'SequentialMusic 'elements
|
|
|
|
(append
|
2017-05-29 17:09:06 +02:00
|
|
|
(list (make-music 'TextSpanEvent 'span-direction -1))
|
|
|
|
(reverse (cdr (reverse elts)))
|
|
|
|
(list (make-music 'TextSpanEvent 'span-direction 1))
|
|
|
|
(list (last elts))
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
2015-11-05 01:39:52 +01:00
|
|
|
% dynamics with extended lines
|
|
|
|
dynLine = #(define-music-function
|
|
|
|
(parser location text)
|
|
|
|
(markup?)
|
|
|
|
#{
|
|
|
|
\once \override TextSpanner.style = #'line
|
|
|
|
\once \override TextSpanner.bound-details.left.text = \markup {
|
|
|
|
\combine
|
|
|
|
\draw-line #'(0 . -1)
|
|
|
|
\draw-line #'(1 . 0)
|
|
|
|
\dynamic #text
|
|
|
|
}
|
|
|
|
\once \override TextSpanner.bound-details.right.text = \markup { \draw-line #'(0 . -1) }
|
|
|
|
#})
|
|
|
|
|
2016-10-26 11:21:41 +02:00
|
|
|
% unison brackets
|
2017-02-02 17:06:20 +01:00
|
|
|
% TODO: a little 'u'
|
|
|
|
% TODO: open ended brackets(\odr,\ofr)
|
2017-05-29 17:09:06 +02:00
|
|
|
%unisonbracket = {
|
|
|
|
% \once \override TextSpanner.style = #'line
|
|
|
|
% \once \override TextSpanner #'to-barline = ##t
|
|
|
|
% \once \override TextSpanner.bound-details.left.text = \markup {
|
|
|
|
% \combine
|
|
|
|
% \combine
|
|
|
|
% \draw-line #'(0 . -1)
|
|
|
|
% \draw-line #'(1 . 0)
|
|
|
|
% \translate #'(1 . -0.5 ) \whiteout \box "u"
|
|
|
|
% }
|
|
|
|
% \once \override TextSpanner.bound-details.right.text = \markup { \draw-line #'(0 . -1) }
|
|
|
|
% \once \override TextSpanner.bound-details.right.attach-dir = #RIGHT
|
|
|
|
%}
|
|
|
|
%dr = { \unisonbracket <>\="unison"\startTextSpan }
|
|
|
|
%fr = { <>\="unison"\stopTextSpan }
|
|
|
|
%odr = { \unisonbracket <>\="unison"\startTextSpan }
|
|
|
|
%ofr = { <>\="unison"\stopTextSpan }
|
2018-02-27 23:33:31 +01:00
|
|
|
dr = #(define-event-function (parser location) () #{ -\tag #'tutti \startGroup #})
|
|
|
|
fr = #(define-event-function (parser location) () #{ -\tag #'tutti \stopGroup #})
|
|
|
|
odr = #(define-event-function (parser location) () #{ -\tag #'tutti \startGroup #})
|
|
|
|
ofr = #(define-event-function (parser location) () #{ -\tag #'tutti \stopGroup #})
|
2021-11-16 16:08:05 +01:00
|
|
|
rn = #(define-event-function (parser location) () #{ -\tag #'tutti ^\markup \path #0.1 #'((moveto 0 0)(rlineto 0 1)(rlineto 4 0)(rlineto 0 -1)) #})
|
2017-05-29 17:09:06 +02:00
|
|
|
|
|
|
|
#(define (allbutlastnote mus)
|
2018-10-22 02:52:33 +02:00
|
|
|
"Reverse the elements, Pop of (cdr) the first element, Reverse again, put it in a SequentialMusic"
|
2017-05-29 17:09:06 +02:00
|
|
|
(let ((elts (ly:music-property mus 'elements)))
|
|
|
|
(make-music 'SequentialMusic 'elements (reverse (cdr (reverse elts))))
|
|
|
|
)
|
|
|
|
)
|
|
|
|
#(define (lastnote mus)
|
2018-10-22 02:52:33 +02:00
|
|
|
"Get the last element, make it a list, put it in a SequentialMusic"
|
2017-05-29 17:09:06 +02:00
|
|
|
(let ((elts (ly:music-property mus 'elements)))
|
|
|
|
(make-music 'SequentialMusic 'elements (list (last elts)))
|
|
|
|
)
|
|
|
|
)
|
2021-11-16 16:08:05 +01:00
|
|
|
tutti =
|
|
|
|
#(define-music-function (myMusic) (ly:music?)
|
|
|
|
(define (grace-music-filter event)
|
|
|
|
(let ((eventname (ly:music-property event 'name)))
|
|
|
|
(not (eq? eventname 'GraceMusic))))
|
|
|
|
(let*
|
|
|
|
(
|
|
|
|
(music-copy (ly:music-deep-copy myMusic))
|
|
|
|
(es (extract-typed-music (music-filter grace-music-filter music-copy) 'note-event))
|
|
|
|
)
|
|
|
|
(if (> (length es) 1)
|
|
|
|
#{% multiple notes
|
|
|
|
\once \override HorizontalBracket.to-barline = ##t
|
|
|
|
\override HorizontalBracket.connect-to-neighbor = #'(#t #t)
|
|
|
|
<>\dr
|
|
|
|
#(allbutlastnote myMusic)
|
|
|
|
<>\fr
|
|
|
|
#(lastnote myMusic)
|
|
|
|
\revert HorizontalBracket.connect-to-neighbor
|
|
|
|
#}
|
|
|
|
#{% single note
|
|
|
|
<>\rn
|
|
|
|
#myMusic
|
|
|
|
#}
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|