This scheme engraver searches for specified successive intervals in a voice, e.g.
a minor third. If the interval occurs somewhere, the note heads of both notes defining
the interval are colored. The engraver can be added to every Voice context.
Usage:
\color_interval_engraver #intervaldefs #debug? #intervals-given
intervaldefs: alist containing information about semitonical distances for
certain intervals, diatonical distance is calculated in the engraver using
`string-diatonic-semi-tonic-list`, relying on the key.
debug?: (optional) boolean, if true, output information about the processed
pitches
intervals-given: list of the form
#`((interval1 ,dir1 enh1 ,color1)
(interval2 ,dir2 enh2 ,color2)
...
(intervalN ,dirN enhN ,colorN))
with
intervalN: string - specifying the interval to search after
dirN: integer -
UP
(=1)
DOWN
(=-1) or 0 (up and down)
enhN: boolean - search for enharmonically equivalent intervals, too?
colorN: lilypond color value, see NR A.7.
Example:
\layout {
\context {
\Voice
\consists \color_interval_engraver #intervaldefs
#`(("2--" ,UP #f ,green)
("3+" ,DOWN #t ,blue))
}
}
Debug mode:
With debug?
set to #t
, the engraver does output
- The preprocessed list of intervals to search after
- Detailed information about all note head grobs the engraver has acknowledged
Warnings:
The engraver tries to provide helpful warning messages when fed
with invalid input or if other issues prevent the engraver from
working correctly.
Some examples:
Warning: Color_interval_engraver: In interval (2++ 2 #f (0.5 0.5 0.0)), wrong type argument: 2, needs to be a direction.
Warning: Color_interval_engraver: Recoloring note head in Voice N/A, bar number 1
# belongs to intervals ((2 . 3) 1 #f (0.0 1.0 0.0)) and ((3 . 5) -1 #f (1.0 0.0 0.0))
Warning: Adding color_interval_engraver to a Staff context may lead to unexpected results if the Staff contains more than one voice.