received from carter scholz in july 1995 copyright 2191w

Notes on Lattice: one approach to dynamic tuning

Carter Scholz

Lattice, for computer-controlled electronics, is based on the just tuning theories of Tenney, Johnston, and others, which represent pitch as an n-dimensional discrete space, or lattice. Justly-tuned pitch ratios are represented as points on this lattice. The number of the lattice's dimensions corresponds to the just intonation "limit" of the tuning. Each axis represents a prime factor of the ratio. That is, a two-dimensional lattice is a 3-limit tuning, with prime factors 2 and 3. A three-dimensional lattice a 5-limit tuning (prime factors 2, 3, and 5), a four-dimensional lattice a 7-limit tuning, and so on.

The origin (0, 0, 0 ... ) of any lattice is the ratio 1/1. Other ratios are located in the space by their prime exponents. For example, the ratio 7/6 can be written as 2^-1 . 3^-1 . 5^0 . 7^1 and thus is found at lattice point (-1, -1, 0, 1). The ratio 135/116 = 2^-4 . 3^3 . 5^1 . 7^-1 is found at (-4, 3, 1, -1). Another way to put it is that any rational number R is the product of n prime factors: R = IPRFC(i=1,n, pi^xi) where pi is the ith prime and xi is a natural number.

That is, xi is the coordinate of R on the n-dimensional lattice's ith axis.

As a concise method of representing and manipulating musical ratios, discrete-space lattices have been used since Ellis described harmonic "duodenes" in his translation of Helmholtz. There are several practical advantages to this representation. Ratio math, which usually requires multiplication, division, and the reduction of fractions to lowest terms, can be done by simple addition and subtraction of exponents. Because the representation is exponential, extremely large numbers can be computed as integers without arithmetic overflows. More pertinently, formalizing pitches as points in space permits a variety of "distance" measures to be easily computed.

ob.lattice and its methods

Lattice is written in HMSL (Hierarchical Music Specification Language), an object-oriented music composition language. The discrete frequency space is implemented as an HMSL class, ob.lattice, a two-dimensional array of m . n elements. m determines the maximum number of points (pitches) in the lattice, while n determines the highest prime factor in the lattice. m and n are presently defined as constants, though in practice they are simply maxima.

Among the methods defined for ob.lattice is calc.metric:, for calculating distances within a set of pitches. Though it is tempting to call these methods measures of "consonance" or "harmonic complexity," the more neutral term "distance" avoids issues of historical and cognitive implications. The methods are simply a set of formulae that measure some quality of relationship among pitches. The measures have been chosen or designed so that a unison (i.e., all pitches at the same point in the discrete space) produces a small or zero measure, while chords whose pitches are more broadly dispersed on the lattice produce larger measures. Other contexts might require different methods of normalizing the various functions.

Distance functions

The ob.lattice method calc.metric: is vectored to one of a variety of measures or "distance functions." The first five functions are taken from chapter five of John Chalmers's Divisions of the Tetrachord.

Functions that measure the distance between two points in the lattice are notated in the form D(x,y); functions that measure the lattice's pitch relationships as a whole are notated D(L). A lattice has m members and n dimensions. xi refers to the coordinate of point x on the i axis, that is, the exponent of the ith prime factor.

The first four measures are true metrics, while the last three are various ways of measuring the dispersion of pitches in the space. There are two ways of arriving at a group measure from the point-to-point metrics: linear or combinatorial. The linear measure sums the distances from each individual point to a reference point. The reference is either absolute _ the origin of the lattice _ or relative _ the geometric center (xc,yc) of the points. The combinatorial measure sums the distances between every possible pair of points. The origin of the lattice may be included (absolute) or excluded (relative).

Thus, for any of the metrics:

D(L) = ISUFC(j=0,m, D(xj,yj)) (absolute linear), D(L) = ISUFC(j=0,m, D(xj_xc,yj_yc)) (relative linear), or D(L) = ISUFC(i=0,m, ISUFC( j=i+1,m, D(xi,yj))) (combinatorial)

Euclid measures the Euclidean distance between points x and y in n dimensions:

D(x,y) = sqr-rt(ISUFC(i=0,n, wi . (xi _ yi)^2))

where w is an optional weighting factor, wi = [2, 3, 5, 7, 11, 13, 17...] (i.e. the ith prime), for i = [0, 1, 2, 3...]. (An alternative weighting function is wi = i.)

Block measures the Minkowski city-block distance between points x and y in n dimensions:

D(x,y) = ISU(i=0,n, wi . |xi _ yi|)

Tenney is a logarithmic measure. Tenney expresses it for a single ratio, a/b, as log a + log b. Put another way, D(1/1, a/b) = log a + log b, or D(a/b, c/d) = log (bc/ad) = log. Thus, the distance between two points x and y is:

D(x,y) = ISUFC(i=0,n, log|xi _ yi|)

Barlow is a measure defined by Clarence Barlow. A given prime p has "indigestibility" ind(p) = (2 . (p _ 1)^2)/p. ind is roughly equivalent to the Euler degree of a prime, though Barlow's function yields finer and somewhat different discriminations. Indigestibilities, like logarithms, combine by addition: ind(x,y) = ind(x)+ind(y).

The distance (or specific harmonicity) between two ratios x and y is thus: D(x,y) = 2 . ISUFC(i=1,n, |xi _ yi| . F((pi _ 1)^2,pi)) The specific harmonicity of a set of m ratios is the square of the number of members (m^2) divided by the sum of the inverse harmonicities of all the intervals in the set: D(L) = F(1,m2) . ISUFC(i=0,m, ISUFC(j=i+1,m, F( 1, D(xi,yj)))) Euler is the gradus suavitatus function of Leonhard Euler. When p is a prime, the degree of consonance is p. The degree for a product of two prime factors (a . b) is (a+b _ 1). For a chord of ratios, one assigns all ratios a common denominator, then finds the least common multiple of their numerators, and the number of its degree is that of the chord. E.g., the major triad [1/1, 5/4, 3/2] can be expressed as 4:5:6 (common denominator of 4). The degree is lcm(4,5,6)=60, and the GS=9. D(L) = 1 + ISUFC(i=0,n, (wi _ 1) . |max(xi) _ min(xi)|) where max(xi) is the maximum value of all points in dimension i and min(xi) the minimum, and wi is the ith prime (this weighting function is not optional).

Compactness is an original measure, similar to Euler's GS, that sums the range of each dimension:

D(L) = ISUFC(i=0,n, wi . |max(xi) _ min(xi)|)

where max(xi) is the maximum value of all points in dimension i and min(xi) the minimum, and wi is an optional weighting function. (Weighted compactness, where wi is the ith prime, and omitting the 2s dimension, is equivalent to Ervin Wilson's harmonic complexity measure as defined in Chalmers.)

LCM is the least common multiple of all numerators and denominators. D(L) = IPRFC(i=0,n, wiSUP5(|max(xi) _ min(xi)|))

where max(xi) is the maximum value of all points in dimension i and min(xi) the minimum, and wi is the ith prime (this weighting function is not optional).

Harmonic is an original function that attempts to find the closeness of one pitch in the lattice to a presumed harmonic series. The fundamental of the series is presumed to be the ratio expressed by the minima of all dimensions.

D(x) = ISUFC(i=0,n, wi . |xi _ min(xi)|)

D(L) = ISUFC(j=0,m, D(xj))

Mutation Functions

The ob.lattice method mutate: is vectored to one of a variety of mutation functions. A mutation alters one pitch (point) in the lattice. After mutation, the altered lattice is evaluated using the selected metric function. If it passes the evaluation, the new pitch is accepted and sounded; if not, the original lattice is restored and a different mutation tried until the evaluation is passed or all possible mutations are exhausted. At present there are three mutation functions:

Prob (for probability) moves a point one unit along one axis. The axis of movement is selected according to a user-controlled probability distribution.

Mult (for multiple) moves a point one or two units along one or two axes.

Superp (for superparticular) generates a superparticular ratio of the form n/(n _ 1) where both n and n _ 1 are within the dimensionality of the lattice, and multiplies a point's frequency by this ratio, moving it the necessary distance along the necessary axes.

Evaluation Functions

The evaluate: method simply compares two lattices _ the sounding lattice, and the mutated lattice under trial _ and returns true or false. It may be vectored to two simple functions: greater? and less? (More interesting functions could certainly be devised, as could a return mechanism more complicated than pass/fail.)


The piece currently exists in a solo realization for MIDI-controlled instrument (including a homebuilt MIDI-controlled digital signal processor). A chord of six tones, starting at a unison, evolves in a seven-dimensional (17-limit) space according to the mutation, distance, and evaluation functions described above. The six tones diverge away from a unison until a maximum metric threshold is passed, then converge back toward a unison. A custom HMSL screen gives the performer interactive control over maximum and minimum metric thresholds, register, tempo, mutation and metric functions, mutation probabilities by dimension, etc. A recording of the piece is available on the CD Hallways (Frog Peak Music, Box 1052, Lebanon NH 03766).

In the recording, octave transposition is freely permitted, which is to say that metric calculations omit the 2s dimension.. There are six evolutions from unison to maxima and back, each in a lattice with a different set of dimensions. The timing, tessitura, and dimensionality of sections is closely composed, but pitch choice within these constraints is left to the software. Pitch durations are derived from their frequencies. A simple sustained timbre is used to foreground the intonation.

The software provides an absolute/relative switch. When set to relative, a distance function measures relations among all pitches in the lattice. When absolute, it refers all pitches to the lattice's origin, the 1/1. In practice, the absolute setting provides an anchor around which the pitches wander and to which they return. The relative setting permits the pitches to wander unmoored, in what Lou Harrison calls free style. In the recorded performance, the setting is absolute throughout.


The points that exist in the continuous space between the discrete axes are also meaningful frequency representations. For instance, in a two-dimensional lattice, where the point (0,0) represents 1/1 (2^0 . 3^0) and the point (-1,1) represents 3/2 (2^-1 . 3^1), the intermediate point (-.5, .5) is the geometric mean of the two ratios, that is, 2^-.5 . 3^.5 = 1.2247...

In the discrete space, any frequency can be represented uniquely as a point, so long as the frequency is some rational interval from the origin, and the lattice's dimensionality is high enough to include the highest prime factor of the ratio. In the continuous space, any frequency at all can be represented, whether or not it is a rational interval from the origin. However, no representation in a multi-dimensional continuous space is unique. In a two-dimensional continuous space, a frequency f is represented by the line f=2^x . 3^y. In a three-dimensional continuous space, the plane f=2^x . 3^y . 5^z represents the frequency f. For instance, a tempered major third with frequency 1.189207 (relative to 1/1) may be represented in a two-dimensional continuous space as (.25, 0) or as (0, .15773244), or as any other point on the line 1.189207 = 2^x . 3^y.

The various distance functions return meaningful values in continuous space although, since frequencies are not uniquely represented, the concept of a metric that uniquely measures "harmonic distance" is violated. However, there may be value in a formalism that encompasses both rational and non-rational intervals. For instance, the values along any line in any such n-dimensional continuous space are monotonic; hence a glissando between any two discrete points may be accomplished by a continuous linear interpolation between the points.


In addition to the theoretical work of Tenney and Johnston, the concepts of this piece owe much to the work of Larry Polansky with morphological metrics, and to the work of John Chalmers with tuning theory.


Barlow, Clarence. 1987. Two essays on theory. Computer Music Journal 11(1): 44-60. Chalmers, John. 1993. Divisions of the tetrachord. Hanover NH: Frog Peak Music. Doty, David B. 1993. Just intonation primer. San Francisco: Just Intonation Network. Harrison, Lou. 1971. Lou Harrison's music primer. New York: C F Peters. Helmholtz, H. [1877] 1954. On the sensations of tone. 4th ed. A. J. Ellis, trans. 1885. Reprint. New York: Dover Publications. Johnston, Ben. 1978. Rational structure in music. Proceedings of the American Society of University Composers 11-12: 102-118. Karp, C. 1984. A matrix technique for analyzing musical tuning systems. Acustica 54: 209-216. Polansky, Larry. 1987. Paratactical tuning. Computer Music Journal 11(1): 61-68. Polansky, Larry & Rosenboom, D. & Burk, P. 1987. HMSL: overview (version 3.1) and notes on intelligent instrument design. Proceedings of the International Computer Music Conference. Tenney, James. John Cage and the theory of harmony. Soundings 13: 55-83.