Using the input-tag property to create musical outlines

Here's an example using Scheme code and the input-tag property to provide a way to mark up music in the manner similar to the "outlining" rehearsal technique recommended by James Boyk and Abigail Whiteside.

The basic idea of outlining is to practice passages at tempo from the very start by omitting most of the notes and gradually add more and more of the notes. It's a good rehearsal technique, but it takes some time to get used to. Hence the thought that a convenient way to visually and aurally demonstrate the technique might be useful.

This snippet defines a music function, \oLevel, that can be nested around sequences of notes to indicate an outline level. Once the music has been marked up with the \oLevel function, it can be rendered at any desired level of outlining by calling \outlineMusic in the score block with a numerical value to indicate the desired level of detail. It's somewhat similar to the way programmers often provide a "debug-level" command-line option. The higher the level, the more detail in the output.

As implemented here, the notes that are beyond the desired level of detail are replaced by repeats of prior notes and are shown with grey noteheads. See the attached image and example .ly file for more detail. Other implementations are certainly possible, e.g. replacing the notes with rests instead of showing them as repeated notes in grey.

From a programming standpoint, the input-tag property seems like a nice tool anytime you need to encode some information in the notation for later use when the output is rendered in a way that can't be handled by the \keepWithTag and \removeWithTag functions. There's one pitfall that took me a while to figure out -- ly:music-deep-copy does NOT copy the contents of input-tag even though it's a documented property. You need to provide some logic to handle that if you are generating multiple versions of the music and need to alter tags in the process of doing so.

CAVEAT: As implemented, this works well in a single voice. Trying to use it multiple voices will almost certainly give confusing results.