## Thursday, June 26, 2014

### Algebraically solving for musical canon features

To make a simple musical canon I had to decide first what features I wanted. I decided that I wanted an 8 note melody for voice 1, voice 2 to play offset of voice 1 by a measure, and voice 3 to play the same melody backwards. and I wanted all 3 playing together to form major or minor chords. So I made this schematic to see what notes would play at the same time, with m(n) n=1..8 the notes of the melody.

So at some point in the song the notes in any column will be playing at the same time. I decided to make the top voice be the middle note in any resultant chord, and for it to be major or minor means that voice 2 is either 4 half tones down or 4 up and and voice 3 is 3 up if voice 2 is 4 down and 3 down if voice 2 is 4 up. I can encode this information mathematically by saying the absolute value of the difference between voice 2 and voice 1 is 4 and the absolute value of the difference between voice 3 and voice 2 is 7. I also set the first note to C or 1. So I get a set of equations:
When I solve these equations for integer solutions with the isolve command and throw out any with negative values for a note it turns out there are 4 solutions all with a free variable that Maple writes as _Z1:
I decided I want my canon to be in C major which is the same as having integers 1,3,5,6,8,10,12 so that eliminates the solution with a 7 for a value. Then narrow it down by deciding I want the melody to be in one octave hence no value over 12. This gives only 3 possible melodies:

The middle one is the one I find the most interesting musically so I made the canon with that...