Detempering

Tempering means applying a tuning system (to a set of intervals) which maps some intervals to a frequency ratio of 1/1. This hides the effect of those intervals. For example, if Ac1 is tempered out, then you'll hear the same frequency ratio for any tuned intervals expressible as

    P1 + n * Ac1

for integers {n}. So in tuning, we've lost information.

Given a piece in a tempered tuning, what can we do to try reconstructing plausible intervallic muisc?

We could off course just associate every tempered frequency ratio with a single interval in our detempering reconstruction, e.g. assume every 1/1 was a P1 before we threw out the information. This is roughly the state of the art in the microtonal community.

That's weaksauce, but it's an okay baseline. We know that we can do at least as well as mapping, e.g. steps of 12 edo to a chromatic scale,

    [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] ->

    [P1, m2, M2, m3, M3, P4, d5, P5, m6, M6, m7, M7, P8]

What can we do that's better than that?

Suppose for a toy example that every step of 12-EDO can map to a small finite set of intervals, like the chromatic values above plus or minus an Ac1 and plus or minus a d2. It's up to you if you want to allow both commas to be applied at once, or to apply them multiple times. But we want something finite.

We're free to associate those altered chromatic intervals with the same 12-EDO step because 12-EDO tempers out Ac1 and d2. If you're working with a different temperament, you'll similarly continue to want to used its tempered commas to generate intervallic detempering options for every tuned frequency ratio in your song, but it might not be Ac1 and d2, and they might not be altering a chromatic scale. But let's keep working with 12-TET for simplicity and concreteness and applicability to the canon of modern western music.

For a given song, we'd like to choose among these intervallic detempering options for every note so as to get 

    1) melodic intervals that are fluid

    2) harmonic intervals that are consonant

and if those two criteria leave some decisions un-made, then we'd like to also have

    3) low complexity just tunings of individual notes

Those are currently three vague optimization criteria. Let's make them a little more concrete.

For a first approximation, we'll suppose that melodic fluidity and harmonic consonance are the same - some intervals are better at both functions and some intervals are worse at both functions.

Suppose we bless a set of intervals as perfectly consonant+fluid, perhaps

[P1, P4, P5]

[Grm2, m2, M2, AcM2]

[Grm3, m3, M3, AcM3]

[Grm6, m6, M6, AcM6]

[Grm7, m7, M7, AcM7]

And maybe also the octave displacements of those shall be blessed.

Next we judge all other intervals as being less consonant+fluid based on how many commas we have to traverse to reach a blessed one. We'll need to define a set of traversing commas for this - which steps are we making and counting to get from A to B. Let's work in rank-3 interval space / 5-limit just intonation and use (Ac1, A1, d2) as our traversing commas.

For a given interval B, you

    0) find the octave reduction of B, 

    1) take the difference of reduced-B with each blessed interval, 

    2) express the differences in the (Ac1, A1, d2) basis, 

    3) take the sum of the absolute values of the components of each difference interval

    4) take the minimum value of those sums as the score of dissonance. A larger score means the original interval was separated from the nearest blessed interval by more commas, and therefore was itself more dissonant.

For our measure of frequency ratio simplicity, I'm a little torn: it's dirt simple to only use numerator magnitude, but this neglects factor structure: a 3-limit Pythagorean Major Third justly tuned to 81/64 is a much more harmonically basic ratio than, e.g. a 13-limit justly tuned Recessed Major Third at 16/13. We could simply ignore the contribution of factors 2 and 3, but then all Pythagorean ratios would be equally consonant, which isn't right.

The first frequency ratio norm I've found that I like somewhat is this:

    norm = sum([abs(coordinate) * (primes[index] ** 3) for index, coordinate in enumerate(harmonic_coordinates)])

Here's how the function works: for a given ratio, find its prime factorization, and represent all the exponents for primes up to some limit as a vector. Here we have a 9 component vector representing exponents of prime factors up to 23, since 23 is the 9th prime: 

    81/80 :: [-4, 4, -1, 0, 0, 0, 0, 0, 0]

The norm for this ratio takes the absolute value of each vector component and multiplies it by the cube of the corresponding prime, then sums all those products:

    (4 * 2^3) + (4 * 3^3) + (1 * 5^3) = 265

Here are a few frequency ratios sorted by increasing norm value to give you an idea of how this norm behaves:

    [1/1, 2/1, 3/2, 4/3, 9/8, 81/64, 16/15, 10/9, 256/243, 81/80, 7/4, 11/4, 11/8, 11/10, 16/13, 13/12, 14/13, 17/16, 57/56]

I said we were working in 5-limit just intonation, so most of these ratios wouldn't show up, but I want to the norm to be well behaved at higher prime limits.

This does a good job of penalizing higher primes and letting Pythagorean ratios play first, or at least letting them play fairly soon. I like septimal ratios almost as much as Pythagorean ones, and would prefer it if 7/4 wasn't deemed less consonant than 81/80, but this is a good start. I guess I could just put some intervals with septimal just tuning into the blessed set if I wanted them to show up more.

We now have concrete notions of consonance+fluidity and frequency ratio simplicity.

For a melody in 12-TET, we have oh, 5 or 9 or however many interval options per tempered frequency ratio, and we want to make interval selections for all of our notes to minimize melodic disfluidity/dissonance, and if multiple choices of intervals would leave us with same amount of disfluidity, then we want to minimize the frequency ratio complexity of the just tunings of individual notes.

This is almost solvable, but still a little ill-posed. Having a finite search space helps a lot. But how the dissonance interacts with the frequency ratio comlexity needs to be fleshed out more. And it will need even more specification when we have polyphonic muisc.

How about this: given two interval sequences with equal melodic disfluidity, sum the frequency ratio complexities for the just tunings of all the intervals in each detempering / melodic interval reconstruction. I think this probably won't work well: 2/1 has a normed value of 8, while 16/13 has a norm of 2229. These are really different magnitudes, so the sum of ratio complexities for a detempered melodic line is going to be dominanted by single notes. Maybe it would work, but it seems unlikely. I guess I could take a logarithm of the norm to make things more similarly sized. I'll try it both ways and see what gives better results.

That's a partial solution to detempering, yeah? You could code this up and it would find you an intervallic melody from a 12-TET melody (or 19-TET or 53-TET or meantone or whatever, with a litle tweaking).

That's very exciting to me! It's a big conceptual improvement over mapping 1 ratio to 1 interval. Maybe it won't work that well, but it's got moving parts that can be adjusted until it does.

Let's think about polyphonic music next.

Suppose you have a sequence of chords.

...

No comments:

Post a Comment