coloring notes with humdrum/verovio

Skip to first unread message

Malcolm Sailor

Feb 8, 2022, 11:28:17 AMFeb 8
to starstarhug
I'm wondering if it is possible with humdrum and verovio to color specific notes specific colors? (E.g., have some notes show up as green.) Or alternately/in addition, to annotate them? (I.e., have a text label show up below/above a given note.)

Thanks so much!

Craig Sapp

Feb 8, 2022, 11:43:23 AMFeb 8
Hi Malcolm, et al.,

There are a few ways to do what you want, which are illustrated below.  These work in VHV, Humdrum Notation Plugin (, and plain verovio -- since they are implemented in the Humdrum import to verovio.   

Verovio can be run from the command-line for batch-processing of Humdrum into SVG images.  To download and compile:
       cd verovio/tools
       git checkout develop-humdrum  # (for the latest version of the Humdrum converter)
       make install

Then to compile a Humdrum file into notation:
       verovio file.krn
this will create file.svg containing the graphical music notation.

There are lots of options to verovio (see with verovio options colored purple).  Or type "verovio" as a command without arguments to the the list on the command line.   Useful ones for short examples:

--adjust-page-height   == make the SVG the height of the music, not of the page height (i.e., shrink the page to the height of the music.

--adjust-page-width     == the same for the width of the music.

--page-height  # == set the height of the page, # is roughly 1/10 mm, default 2970

--page-width # == set the width of the page, default for # is 2100

--scale (or -s) == set the scale of the music (meaning the size)  Units are percentages where I typically use 40, and default is 100.

-o filename  == output to a different filename than automatically given.  Using "-o -" will output to standard output.

example of using some of the commands (which can go before or after the filename):

verovio file.krn --adjust-page-height --scale 55 -o image.svg

Here are the three main ways of coloring notes:

(1) Marking individual notes with color:

Screen Shot 2022-02-08 at 7.08.06 AM.png

There are a limited number of user-signifiers (characters that do not have predefined meanings in Humdrum. Some others are |, +, i, j.

(2) Color interpretation: useful to set color of all notes to one specific color afterwards:

Screen Shot 2022-02-08 at 7.12.59 AM.png

(3) Color spine: An independent spine for color can be used to color all **kern spines to its left.  This is useful for harmonic colorings:

Screen Shot 2022-02-08 at 7.18.03 AM.png
(you can have multiple **color lines, and each one will apply to all **kern spines

There are also more advanced ways of colorings notes that you are probably not interested in (they are outside of verovio and more for post-processing of the SVG image on a webpage):

Screen Shot 2022-02-08 at 8.41.36 AM.png

For text labels, there are three possibilities:

(1) A staff or system label (staff labels have a single !, and system have two !!)   They can be attached to notes by immediately preceding the note (or rest), as well as time signatures by coming just before a time signature:
Screen Shot 2022-02-08 at 7.41.01 AM.png

(2) as lyrics:

Screen Shot 2022-02-08 at 7.42.24 AM.png

(2b) as "verse-like data" which is not much different (just officially marked as not being real lyrics):

Screen Shot 2022-02-08 at 7.43.59 AM.png

Text can  only be applied to note attacks (not rests).

(3) as chord-like data:

Screen Shot 2022-02-08 at 7.47.00 AM.png

cdata can occur independent of note attacks (the **recip spine allows placing at second 8th of quarter note in above example).  cdata can currently only be placed above the staff, I believe.


On Tue, 8 Feb 2022 at 06:58, Malcolm Sailor <> wrote:
PS I realize I wrote "vhv" which I believe refers to your online humdrum viewer? That is not necessarily important. What I'd really like to be able to do is produce annotated musical examples from a shell script.
Malcolm Sailor

On Tue, Feb 8, 2022 at 9:54 AM Malcolm Sailor <> wrote:
Hi Craig

Hope you are well. 

I had the following question and I was wondering if you could help me:

Is it possible with humdrum and vhv to color specific notes specific colors? (E.g., have some notes show up as green.) Or alternately/in addition, to annotate them? (I.e., have a text label show up below/above a given note.)

Many thanks!


Malcolm Sailor
Reply all
Reply to author
0 new messages