Musical navigation

Sunday 2 January 2005

I was playing some piano music today, and saw that familiar notation “D.S. al Coda”. Although it was familiar, I didn’t actually know what it meant. I knew it had to do with going back and repeating some part of the music, but that detail of my piano education had withered long ago.

So I looked it up online, finding this great online music notation reference: Music Theory Online. Chapter 24 is Repeats, and told me what I needed to know. Acoustic Guitar also has a handy online lesson about notation. So: “D.S. al Coda” means go back to the percent-over-S sign, then play to the other plus-over-O sign, then play the coda (the end).

But when I looked at my sheet music with this new understanding, I saw some oddities: First, the percent-over-S sign was placed at the beginning of the piece, so why not use “D.C. al Coda”, which means go back to the beginning, and so on? And when I looked at the end of the piece, it seemed clear it could have been written more compactly without changing the music: the same measures were in the coda as in the normal repeat that was skipped.

I guess music can be refactored just as code can. What I saw in the music were duplicate lines of code that could have been eliminated by rewriting the loops with different termination conditions! Fascinating.

BTW: Back in March, I asked about MIDI-to-notation converters. I really appreciate the shorthands of music notation after looking at the output of these programs. All the loops have been unrolled, all the trills, grace notes, and arpeggios have been literalized, and so on. A simple three-page song becomes a twelve-page mess of mind-numbing repetitive scribbles.


Sheet music is not necessarily written to be the most efficient communication of the notes. It is written to help the player easily see the upcoming notes as they play. So the Coda mark at the beginning of the piece is probably easier to see than the difference between a 'C' and an 'S'. They also would have seen it when they first started, and have known to be looking for the Coda. That way, they are not suprised by it later and have to go searching for the mark.
Likewise, the repetition of notes at the end could have something to do with how a player of a specific instrument would be looking at that page.

Sheet music is not a computer program. You are trying to assist the player, and efficiency is not always the best way to do that. If you try to rewrite sheet music for perfect efficiency, you will likely make it much harder to sight-read that piece.
Well, think of it as a partial loop unrolling - it's an optimization so the computer, err, musician can perform more optimal.

Dave: Your argument can be reversed, too: There are ways to make a program shorter which also render it unreadable. Consider perl golf or lisp macros.

Add a comment:

Ignore this:
Leave this empty:
Name is required. Either email or web are required. Email won't be displayed and I won't spam you. Your web site won't be indexed by search engines.
Don't put anything here:
Leave this empty:
Comment text is Markdown.