This is another attempt at creating an adaptive tuning that fit’s my preferences as a composer. This version starts by loading a set of acceptable ratios into an array. I chose to load those that I found when studying the Tonality Diamond to the 31 Limit. It’s a set of the 213 ratios that mathematics can come up with using the overtones and undertones of a note. I stick to those ratios, because they include the most consonant of intervals, along with the challenging but interesting ones.

I then wrote some code to transform a Bach chorale known in the Music21 corpus as ‘bwv244.3’, from the St. Matthew Passion. It’s one I’ve used a few times over the years.

Using some python code I wrote, it takes each chord in the chorale, and searches for the optimal based on using the lowest possible integer ratios in the tonality diamond that are closest to the 12 tone equal temperament cents of the notes in the chorale. I optimize based on the sum of three values:

- lowest integer ratio, expressed as the numerator and denominator of the ratio
- closeness to the 12 TET cent value of the note in the chorale as composed by Bach

I add them up and use that to score, with the lowest score winning a slot in the final chord. I do that for all the intervals in each four notes in each chord in the chorale. Given Soprano, Alto, Tenor, Bass, I optimize the intervals from S to A, S to T, S to B, A to T, A to B, and T to B. That’s six compares. The final chord tuning is the result of wining the lowest score for each interval.

At present, I’m not advanced enough in my exploration of adaptive tuning to consider the prior or future notes. I put that in the “horizontally adaptive tuning” category to be dealt with later.

This one sounds pretty neat. It only goes off into crazy land by around 4:30. I think the leading tones throw my code for a loop.