And
secondly, I know I'm probably missing something obvious
because I've made it work in similar settings, but how do I
get part-color to be an optional variable with a default in
the lambda context? Every version of (predicate? (predicate?
default)) type of definitions I've tried also errors out.
;;
my edit since not every note is colored in this use-case
(else 1)))
(outline-clr (if color-outline clr part-color))
(note-clr (if color-outline part-color clr)))
;; NO CHANGES REQUIRED PAST THIS POINT FOR DIFFERENT KEYS
;; REMAINDER OF FUNCTION DETERMINES THE PATHS AND DIMENSIONS
;; OF THE ACTUAL NOTES AND OUTLINES
;; UNTOUCHED FROM EXISTING LSR OUTLINE SNIPPET:
;;
http://lsr.di.unimi.it/LSR/Item?id=890
(set! stl
(cond
;; quarter notes and smaller
((> dur-log 1)
(grob-interpret-markup grob
#{
\markup {
\combine
\with-color #outline-clr
\path #(/ path-width 10)
#'((moveto 0.000 -0.200)
(curveto 0.000 -0.420 0.180
-0.542 0.420 -0.542)
(curveto 0.800 -0.542 1.318
-0.210 1.318 0.200)
(curveto 1.318 0.420 1.140
0.542 0.890 0.542)
(curveto 0.510 0.542 0.000
0.210 0.000 -0.200)
(closepath))
\translate #(cons (* 0.0002 path-width)
0)
\with-color #note-clr
\override #'(filled . #t)
\path #0.001
#'((moveto 0.000 -0.200)
(curveto 0.000 -0.420 0.180
-0.542 0.420 -0.542)
(curveto 0.800 -0.542 1.318
-0.210 1.318 0.200)
(curveto 1.318 0.420 1.140
0.542 0.890 0.542)
(curveto 0.510 0.542 0.000
0.210 0.000 -0.200)
(closepath))
}
#}
))
;; half notes
((= dur-log 1)
(grob-interpret-markup grob
#{
\markup {
\combine
\with-color #outline-clr
\path #(/ path-width 10)
#'((moveto 0.000 -0.250)
(moveto 0.110 -0.270)
(curveto 0.110 -0.380 0.210
-0.435 0.280 -0.435)
(curveto 0.370 -0.435 0.600
-0.300 0.850 -0.135)
(curveto 1.100 0.030 1.273
0.140 1.273 0.270)
(curveto 1.273 0.350 1.200
0.440 1.090 0.440)
(curveto 1.040 0.440 0.850
0.350 0.600 0.185)
(curveto 0.200 -0.080 0.110
-0.150 0.110 -0.270)
(closepath)
(moveto 0.000 -0.250)
(curveto 0.000 -0.200 0.060
0.210 0.350 0.365)
(curveto 0.510 0.460 0.700
0.545 1.050 0.545)
(curveto 1.200 0.545 1.380
0.500 1.380 0.270)
(curveto 1.380 0.120 1.290
-0.140 1.120 -0.300)
(curveto 0.870 -0.500 0.520
-0.542 0.320 -0.542)
(curveto 0.200 -0.542 0.000
-0.530 0.000 -0.250)
(closepath))
\translate #(cons (* 0.0002 path-width)
0)
\with-color #note-clr
\override #'(filled . #t)
\path #0.001
#'((moveto 0.000 -0.250)
(lineto 0.110 -0.270)
(curveto 0.110 -0.380 0.210
-0.435 0.280 -0.435)
(curveto 0.370 -0.435 0.600
-0.300 0.850 -0.135)
(curveto 1.100 0.030 1.273
0.140 1.273 0.270)
(curveto 1.273 0.350 1.200
0.440 1.090 0.440)
(curveto 1.040 0.440 0.850
0.350 0.600 0.185)
(curveto 0.200 -0.080 0.110
-0.150 0.110 -0.270)
(lineto 0.000 -0.250)
(curveto 0.000 -0.200 0.060
0.210 0.350 0.365)
(curveto 0.510 0.460 0.700
0.545 1.050 0.545)
(curveto 1.200 0.545 1.380
0.500 1.380 0.270)
(curveto 1.380 0.120 1.290
-0.140 1.120 -0.300)
(curveto 0.870 -0.500 0.520
-0.542 0.320 -0.542)
(curveto 0.200 -0.542 0.000
-0.530 0.000 -0.250)
(closepath))
}
#}
))
;; whole notes
((= dur-log 0)
(grob-interpret-markup grob
#{
\markup {
\combine
\with-color #outline-clr
\path #(/ path-width 10)
#'((moveto 0.660 -0.190)
(curveto 0.540 0.000 0.560
0.310 0.710 0.415)
(curveto 0.900 0.530 1.210
0.410 1.330 0.210)
(curveto 1.450 0.030 1.460
-0.300 1.290 -0.410)
(curveto 1.100 -0.530 0.790
-0.410 0.660 -0.190)
(closepath)
(moveto 0.000 0.000)
(curveto 0.000 -0.350 0.549
-0.545 1.000 -0.545)
(curveto 1.450 -0.545 2.000
-0.340 2.000 0.000)
(curveto 2.000 0.350 1.470
0.545 1.000 0.545)
(curveto 0.530 0.545 0.000
0.350 0.000 0.000)
(closepath))
\translate #(cons (* 0.0002 path-width) 0)
\with-color #note-clr
\override #'(filled . #t)
\path #0.001
#'((moveto 0.000 0.000)
(lineto 0.660 -0.190)
(curveto 0.540 0.000 0.560
0.310 0.710 0.415)
(curveto 0.900 0.530 1.210
0.410 1.330 0.210)
(curveto 1.450 0.030 1.460
-0.300 1.290 -0.410)
(curveto 1.100 -0.530 0.790
-0.410 0.660 -0.190)
(lineto 0.000 0.000)
(curveto 0.000 -0.350 0.549
-0.545 1.000 -0.545)
(curveto 1.450 -0.545 2.000
-0.340 2.000 0.000)
(curveto 2.000 0.350 1.470
0.545 1.000 0.545)
(curveto 0.530 0.545 0.000
0.350 0.000 0.000)
(closepath))
}
#}
))
;; breve notes
((< dur-log 0)
(grob-interpret-markup grob
#{
\markup {
\combine
\with-color #outline-clr
\path #(/ path-width 10)
#'((moveto 0.560 0.100)
(curveto 0.560 0.270 0.630
0.460 0.850 0.460)
(curveto 1.140 0.460 1.385
0.220 1.385 -0.100)
(curveto 1.385 -0.300 1.300
-0.455 1.110 -0.455)
(curveto 0.810 -0.455 0.560
-0.220 0.560 0.100)
(closepath)
(moveto -0.160 0.000)
(lineto -0.160 -0.610)
(curveto -0.160 -0.657 -0.122
-0.700 -0.075 -0.700)
(curveto -0.028 -0.700 0.010
-0.657 0.010 -0.610)
(lineto 0.010 -0.090)
(curveto 0.080 -0.350 0.510
-0.540 0.975 -0.540)
(curveto 1.480 -0.540 1.850
-0.350 1.940 -0.090)
(lineto 1.940 -0.610)
(curveto 1.940 -0.657 1.980
-0.700 2.025 -0.700)
(curveto 2.070 -0.700 2.110
-0.657 2.115 -0.610)
(lineto 2.115 0.610)
(curveto 2.115 0.657 2.070
0.700 2.025 0.700)
(curveto 1.980 0.700 1.940
0.657 1.940 0.610)
(lineto 1.940 0.090)
(curveto 1.850 0.370 1.430
0.545 0.975 0.545)
(curveto 0.520 0.550 0.070
0.350 0.010 0.090)
(lineto 0.010 0.610)
(curveto 0.010 0.657 -0.028
0.700 -0.075 0.700)
(curveto -0.122 0.700 -0.160
0.657 -0.160 0.610)
(lineto -0.160 0.100)
(closepath))
\translate #(cons (* 0.0002 path-width)
0)
\with-color #note-clr
\override #'(filled . #t)
\path #0.001
#'((moveto -0.160 0.000)
(lineto 0.560 0.100)
(curveto 0.560 0.270 0.630
0.460 0.850 0.460)
(curveto 1.140 0.460 1.385
0.220 1.385 -0.100)
(curveto 1.385 -0.300 1.300
-0.455 1.110 -0.455)
(curveto 0.810 -0.455 0.560
-0.220 0.560 0.100)
(lineto -0.160 0.000)
(lineto -0.160 -0.610)
(curveto -0.160 -0.657 -0.122
-0.700 -0.075 -0.700)
(curveto -0.028 -0.700 0.010
-0.657 0.010 -0.610)
(lineto 0.010 -0.090)
(curveto 0.080 -0.350 0.510
-0.540 0.975 -0.540)
(curveto 1.480 -0.540 1.850
-0.350 1.940 -0.090)
(lineto 1.940 -0.610)
(curveto 1.940 -0.657 1.980
-0.700 2.025 -0.700)
(curveto 2.070 -0.700 2.110
-0.657 2.115 -0.610)
(lineto 2.115 0.610)
(curveto 2.115 0.657 2.070
0.700 2.025 0.700)
(curveto 1.980 0.700 1.940
0.657 1.940 0.610)
(lineto 1.940 0.090)
(curveto 1.850 0.370 1.430
0.545 0.975 0.545)
(curveto 0.520 0.550 0.070
0.350 0.010 0.090)
(lineto 0.010 0.610)
(curveto 0.010 0.657 -0.028
0.700 -0.075 0.700)
(curveto -0.122 0.700 -0.160
0.657 -0.160 0.610)
(lineto -0.160 0.100)
(closepath))
}
#}
))
))
(set! (ly:grob-property grob 'stencil)
(ly:stencil-scale stl mult mult)))))
%%%% END OF coloredNoteheads-c FUNCTION %%%%