back to list

Minimal comma pump algorithm

🔗genewardsmith <genewardsmith@...>

4/13/2011 11:18:39 PM

Since this started here, I'm posting it here rather than tuning-math.

We want to find a minimal comma pump for any comma q. This is returned in a canonical form, of a list of rationals of increasing complexity in the temperament defined by tempering out q, which can also be thought of as a multiset. (The routine I have now doesn't work in the 3-limit, but that I can fix.)

(1) Compute the spectrum of q, as explained on the Xenwiki article on the spectrum:

http://xenharmonic.wikispaces.com/Spectrum+of+a+temperament

(2) If s is the spectrum list, start a new list with [2, s[1]].

(3) Call a routine which tests if an interval can be expressed in the group generated by a list of intervals. If q can be so expressed, pass the list to an output routine.

(4) If q cannot be so expressed, test whether the next element of s can be so expressed. If it can, keep checking. If it can't, add it to the list and go back to step 3.

The output routine now takes this list "t" and the comma, and expresses the comma in terms of t by taking the pseudoinverse of the matrix of monzos of t, and left multiplying this by the monzo for the comma. Then it creates a new list, appending n copies of t[i] if the ith exponent in this product is +n, n copies of 1/t[i] if the exponent is -n, and nothing if it is zero. The result is a canonical form for the comma pump, but not very elegant. However, factors of two can be merged in to any list element and moved around at will between them, and the whole list may be permuted. Finally, the inverse of the list can be used instead.

Finally, the test routine takes the interval to be tested and the list of basis intervals, expresses the interval in terms of the basis using the pseudoinverse as above, and then simply tests if the product of the basis elements with the computed exponents in fact gives the interval being tested.