Browse Source

\tastoSolo as a music function

Urs Liska 8 months ago
parent
commit
42a94d8d41
3 changed files with 56 additions and 2 deletions
  1. 1
    0
      includes/init-edition.ily
  2. 11
    2
      includes/lib/elements.ily
  3. 44
    0
      includes/lib/strich.ily

+ 1
- 0
includes/init-edition.ily View File

@@ -31,6 +31,7 @@
31 31
 \include "lib/target.ily"
32 32
 
33 33
 % Library of specific elements
34
+\include "lib/strich.ily"
34 35
 \include "lib/elements.ily"
35 36
 
36 37
 % Instrument definitions

+ 11
- 2
includes/lib/elements.ily View File

@@ -80,6 +80,15 @@ tastoSoloEnd = {
80 80
   s1*0^\markup \italic "Tutti"
81 81
 }
82 82
 
83
+% Implementation as a music function.
84
+% Enclose the music to be highlighted in the music function
85
+tastoSolo =
86
+#(define-music-function (music)(ly:music?)
87
+   #{
88
+     \print-registration "tasto"
89
+     \addArticulations ^\strich #music
90
+   #})
91
+
83 92
 % Print a large fermata over a barline to indicate a section end.
84 93
 barlineFermata = {
85 94
   \once \override
@@ -142,6 +151,6 @@ section =
142 151
     #}
143 152
     #{ #}))
144 153
 
145
-% Note: is this the file where we would put style information 
146
-% for the tempo markings, the fermata-with-double-bar markings, 
154
+% Note: is this the file where we would put style information
155
+% for the tempo markings, the fermata-with-double-bar markings,
147 156
 % and the like?

+ 44
- 0
includes/lib/strich.ily View File

@@ -0,0 +1,44 @@
1
+% \strich
2
+% vertical stroke which can partially be seen as a meta sign,
3
+% a bowing indication or an actual articulation.
4
+% (see https://github.com/ism-dme/lm-vs-ly/issues/23)
5
+%
6
+#(define strich-stencil
7
+   (lambda (grob)
8
+     (grob-interpret-markup grob
9
+       #{
10
+         \markup \path #0.19
11
+         #`((moveto 0 0)
12
+            (lineto 0 0.75))
13
+       #})))
14
+#(define strich-list
15
+   `("strich" .
16
+      ((avoid-slur . inside)
17
+       (padding . 0.5)
18
+       (stencil . ,strich-stencil)
19
+       (side-relative-direction . ,DOWN)
20
+       (toward-stem-shift . 1))))
21
+%% A macro setting the lists from above in the copy of `default-script-alist´
22
+%% For now, every new script has to be inserted in a single run.
23
+%% TODO
24
+%% Probably better to do simpler list processing with append, cons etc
25
+#(define-macro (set-my-script-alist! ls-1 ls-2)
26
+   "Creates a new key-value-pair, taken from ls-2, in ls-1"
27
+   `(set! ,ls-1
28
+          (if (and (pair? ,ls-2) (pair? (cadr ,ls-2)))
29
+              (assoc-set! ,ls-1 (car ,ls-2) (cdr ,ls-2))
30
+              (begin
31
+               (ly:warning (_"Unsuitable list\n\t~a \n\tdetected, ignoring. ") ,ls-2)
32
+               ,ls-1))))
33
+
34
+#(set-my-script-alist! default-script-alist strich-list)
35
+
36
+\layout {
37
+  \context {
38
+    \Score
39
+    scriptDefinitions = #default-script-alist
40
+  }
41
+}
42
+
43
+% Create actual articulations from the definitions
44
+strich = #(make-articulation "strich")