Hi Holleyanne,
please always try to provide a complete (minimal) example which is ready
to try it out.
It is more likely then that somebody will respond to your question.
An adapted version of your snippet is attached.
First few remarks for providing optional arguments.
In a simple (lambda) statement, as you tried, this is not possible. A
common approach
then is to provide an argument list and extract what you need.
Like:
colorNoteheads-c =
#(lambda (args)
(let ((color-outline? (car args))
(line-width (second args))
[...]
You can check the length of the argument list and see, if (or how many)
optional
arguments are given.
Another possibility is to use the built-in (define-scheme-function),
which also has
the possibility to do simple type checks.
See:
http://lilypond.org/doc/v2.18/Documentation/extending/scheme-function-definitions.html
The problem with optional arguments is, that the last argument cannot be
optional.
(Reasons are described in
http://lilypond.org/doc/v2.18/Documentation/extending/scheme-function-usage.html)
Thus I changed the order of arguments:
coloredNoteheads-c =
#(define-scheme-function (tonic-pitch line-width tonic-color part-color
color-outline?)
(ly:pitch? number? color? (color? black) boolean?)
It is of course possible to pass a tonic pitch to this function as an
argument.
Using context properties with this kind of callback function is not
possible, IMHO, since
you cannot afterwards determine the context a grob was created in.
Anyway I think a better solution for what you want to achieve would be a
scheme engraver.
That way you could access context properties, acknowledge NoteHead grobs
and modify the stencil
as you like.
To be honest, I think that the underlying snippet with all its hardcoded
paths is not the best way to color note heads with black outline,
because it will break for every change in the note head shape and so on.
I would propose a different solution, shown here as callback function:
%%%%%
\version "2.18.2"
\relative c' { c4 d e f }
color-notehead =
#(define-scheme-function (parser location color-outline color-fill
border-width)
(color? color? number?)
(lambda (grob)
(let* ((stencil-orig (ly:note-head::print grob))
(scale-factors (cons (- 1 border-width)
(- 1 border-width))))
(grob-interpret-markup grob
#{
\markup \halign #LEFT \overlay {
\with-color $color-outline \halign #CENTER \stencil
$stencil-orig
\with-color $color-fill \halign #CENTER \scale
$scale-factors \stencil $stencil-orig
}
#}))))
\layout {
\context {
\Staff
\override NoteHead.stencil = \color-notehead #black #red #0.3
}
}
%%%%
Cheers,
Michael
Am 16.12.2019 um 22:38 schrieb Holleyanne McDaniel:
Hi - I've been working to adapt Colored Noteheads/Outlines
(http://lsr.di.unimi.it/LSR/Item?id=890) to highlight tonic notes, and
also be able to color a given voice. I've adjusted the variables to
let me specify tonic-color and part-color when I call the function,
and I've narrowed the note comparison to look only at the tonic value.
(my edited function included below)
There are two things I'm still struggling with. First, I'm currently
having to include/call a separate function for every single key. (If I
include them all in a library file, the parser maxes out its memory
and fails.) In a previous solution that only colored tonic noteheads,
I used a tonic variable from the EZ numbers engraver, allowing it to
adapt to key changes on the fly:
(tonic-pitch (ly:context-property context 'tonic))
(tonic-name (ly:pitch-notename tonic-pitch))
Is there a way to use these variables in my current function? If not,
can I specify the key through a variable when I call it? Every form of
sending pitch, string, etc. that I've tried has broken the function.
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.
coloredNoteheads-c = %% <---- rename per key
#(lambda (color-outline line-width tonic-color part-color)
;; @var{color-outline} is a boolean for whether
;; the outline is colored (#t) or the note head (#f).
;; @var{line-width} is a number, the width of
;; the outline, 7 is a good default.
;; @var{tonic-color} is a color, the key note's
;; color or outline.
;; @var{part-color} is a color, used if you want a particular
;; voice's notes highlighted. If not, set to black.
(lambda (grob)
(let* ((fsz (ly:grob-property grob 'font-size 0.0))
(mult (magstep fsz))
(stl empty-stencil)
(dur-log (ly:grob-property grob 'duration-log))
(pch (ly:event-property (event-cause grob) 'pitch))
;; get the pitch of current grob
(nnm (ly:pitch-notename pch))
(alt (ly:pitch-alteration pch))
(clr (case nnm
((0) (case alt ;; <---- change number to tonic
key, 0=C
((0) tonic-color) ;; <-- change number to
tonic alt
;; -1/2 flat, 0
nat, 1/2 sharp
(else part-color)))
(else part-color)))
(path-width (case nnm ;; <---- change number to tonic key
((0) (case alt ;; <---- change to tonic alteration
((0) line-width)
;; if tonic note, path-width = @var{line-width}
(else 1)))
;; else path-width=1 to avoid chunky notes
;; 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 %%%%
Thanks for any help!
Holleyanne McDaniel
\version "2.18.2"
coloredNoteheads-c =
#(define-scheme-function (tonic-pitch line-width tonic-color part-color
color-outline?)
(ly:pitch? number? color? (color? black) boolean?)
;; @var{color-outline?} is a boolean for whether
;; the outline is colored (#t) or the note head (#f).
;; @var{line-width} is a number, the width of
;; the outline, 7 is a good default.
;; @var{tonic-color} is a color, the key note's
;; color or outline.
;; @var{part-color} is a color, used if you want a particular
;; voice's notes highlighted. If not, set to black.
(lambda (grob)
(let* ((fsz (ly:grob-property grob 'font-size 0.0))
(mult (magstep fsz))
(stl empty-stencil)
(dur-log (ly:grob-property grob 'duration-log))
(pch (ly:event-property (event-cause grob) 'pitch))
;; get the pitch of current grob
(nnm (ly:pitch-notename pch))
(alt (ly:pitch-alteration pch))
(nnm-tonic (ly:pitch-notename tonic-pitch))
(alt-tonic (ly:pitch-alteration tonic-pitch))
(clr (if (and (= nnm nnm-tonic)
(= alt alt-tonic))
tonic-color
part-color))
(path-width (if (and (= nnm nnm-tonic)
(= alt alt-tonic))
line-width
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 %%%%
music =
\relative f' {
c4 d e f
g4 a b c
d2 e
f2 g
a1 b
c1
}
\new Staff \with {
\override NoteHead.layer = #2
\override NoteHead.before-line-breaking = \coloredNoteheads-c d #7 #blue #red
##f
} { \music }