Sunday, June 03, 2007

of primes, powers, ratios, and representations

So what does all this have to do with music?

As was known to the ancient Greeks, there is a tangible relationship between a tone and other tones the frequencies of which are small integer multiples of the first. (The Greeks thought of it in terms of dividing a string into lengths which are integer fractions (1/2, 1/3, 1/4, ...) of the length of the string.)

There are also tangible relationships between the lower members of a harmonic series, for example between the 4th and 5th harmonics. These relationships begin to break down above the 7th harmonic (some would say above the 11th), except as their numerical expression is reducible to a ratio composed of low powers of small primes, in which case even a tiny interval, such as that between the 55th (5 x 11) and 56th (7 x 2^3) harmonics, can be musically significant. (Because there are no common prime factors between 55 and 56, the interval 56:55 is already expressed in least terms and is irreducible.)

Such ratios can be represented by a short list of small integers which are the powers of the first five primes (2, 3, 5, 7, and 11), the values of which may either be positive, if the prime and its positive exponent belong in the numerator, or negative, if the prime and its positive exponent belong in the denominator. Using this approach, the number 2 (2/1) would be {1, 0, 0, 0, 0} and the fraction 1/3 would be {0, -1, 0, 0, 0}. This might seem overly complex, except that it is a comprehensive representation which can easily accomodate any interval that might be considered musically significant by virtue of possessing a degree of consonance.

Moreover, the set of values which might reasonably be used in such a list of prime powers is quite small. The power of 11 would never be anything other than -1, 0, or 1. For the sake of flexibility, one might wish for the range of the power of 7 to be a little wider, say from -2 to 2. For 5 we might wish a choice of powers from -3 to 3, and for the prime 3 possibly even a range from -5 to 5. The lowest prime, 2, is a special case; how many octaves would you like to be able to span? If you want to be able to accomodate fundamentals as low as 1 Hz and at the same time accomodate tones at the very upper limit of human hearing, and to be able to reference either from the point of view of the other, you'll need a minimum range of -14 to 14. Let's call it -16 to 16 for good measure.

That's 33 x 11 x 7 x 5 x 3 or 38115 possible combinations of values, a number smaller than the range of an unsigned 16-bit integer, not that I'd really suggest using 16-bit values and a translation table just to save space, not with memory and storage as abundant and cheap as they've become, but it wouldn't be unreasonable to use an array of five single-byte values (signed char in C).

Note that what's being described by such lists of prime powers are intervals in an abstract sense, the value of the ratio between two tones, which can be applied to any tone where the resulting tone isn't so far outside human hearing as to be irrelevant.

Most compositions won't come close to making use of the full range of the set of prime powers {2^(-16..16), 3^(-5..5), 5^(-3..3), 7^(-2..2), 11^(-1..1)}, but what they may do is to make use of several harmonic series, the fundamentals of which are related by similar ratios. In such cases, it's always possible to reduce the system to a single harmonic series with a lower fundamental, but doing so is very likely to be less meaningful than using several harmonic series and low-numbered harmonics.

As a matter of pragmatism, in the programmatic context it would be preferable to define a collection of harmonic series by ratios relating all of their fundamentals to a single base tone, rather than to generate a string of ratio-related fundamentals as each section of a composition gives way to the next. That progression can easily be represented by reference.

But a harmonic series, even a set of them, is not a scale. To produce a scale it's necessary to specify which members of those series one intends to include, and again powers of primes can be useful, in this case only positive powers. Integers greater than one are either prime themselves or a product of primes, and harmonic numbers are simply integers. You can use limits on prime powers to constrain how many times each prime may appear as a factor, and thereby constrain the set of harmonic series members in use. An example would be {3, 2, 1, 0, 0}, which would generate a scale composed of members 1, 2, 3, 4, 5, 6, 8, 9, 10, 12, 15, 18, 20, 24, 30, 36, 40, 45, 60, 72, 90, 120, 180, and 360. This approach may prove adequate in some circumstances and not in others. It would be wise to maintain at least the ability to tweak the results manually.

So, to recap, ratios described in terms of powers of the first few primes relate the fundamentals of harmonic series to a base tone, as well as relating the members of those series to each other, and lists of limits to prime powers contrain the set of series members in use. With these tools one can define scales.

No comments:

Post a Comment