Monday, January 11, 2010

Leading tone analysis

I just discovered that I missed the main point of Christopher Ariza's program (posted earlier) to find all the C#s in a Bach chorale. His code demonstrates that in this chorale Bach uses raised leading tones only on beats one and three, the two strongest beats in the measure. As music21's key detection algorithms and context objects come online, you'll soon be able to substitute the explicit coding of "C#" for:

   if note.pitch == note.getContextByClass(Key).scaleDegree("#7"):

We're almost there... just hang tight a few more months.

(update: we did get there…it took a little longer, but it’s there!)