Syntax highlighting for sheet music

by Taylor Fausak on

A couple weeks ago, I read Kyle Isom’s :syntax off blog post about disabling syntax highlighting. It was interesting to hear his opinion because every developer I’ve ever known took syntax highlighting as a given.

However, I’m more interested about this statement he makes: “When I read a book, I don’t want parts of speech highlighted in different colours.” I thought it would be interesting to read a color-coded book, but his remark reminded me of a story I heard in high school.

I played saxophone in the band. In the band hall one day, a private lesson teacher was talking about a student they had that could only read color-coded music. I forget the exact scheme, but I think it was red for sharps and blue for flats. Since almost all printed music is strictly black and white, the student had to be weaned of her habit.

But music doesn’t have to be black and white! We have powerful engraving software like LilyPond available to us. I spent a little while playing around with it and came up with this simple color scheme:

Musical scales

The scaffolding, like bar lines and key signatures, are subtly muted while sharps and flats are highlighted in red and blue, respectively.

Scales aren’t very interesting as far as accidentals go, so let’s try something a little more complex. Here’s an excerpt from Wilhelm Ferling’s Famous Studies (#13):

Ferling's Famous Studies #13

I haven’t actually played any music in a few years, so I don’t know if this is an improvement or not. I think it looks better, though. (Check out the source to see how I did it.)