editing disabled

Mathematical Definition of MOS | Mathematical Properties of MOS | Visualizing MOS: Generator Chains, Pitch Space, and Hierarchies | Classification of MOS | Algorithms

Mathematical Definition of MOS

An MOS specifically consists of:

1. A period "P" (of any size but most commonly the octave or a 1/N fraction of an octave)
2. A generator "g" (of any size, for example 700 cents in 12 equal temperament) which is added repeatedly to make a chain of scale steps, starting from the unison or 0 cents scale step, and then reducing to within the period
3. No more than two sizes of scale steps (Large and small, often written "L" and "s")
4. Where each number of scale steps, or generic interval, within the scale occurs in no more than two different sizes, and in exactly two if the interval is not a multiple of the period except in such cases as an ET.
5. The unison or starting point of the scale is then allowed to be transferred to any scale degree--all the modes of an MOS are legal.

Condition Four is Myhill's property where, as a periodic scale, the scale has every generic interval aside from the initial unison interval and intervals some number of periods from it having exactly two specific intervals. Another characterization of when a generated scale is a MOS is that the number of scale steps is the denominator of a convergent or semiconvergent of the ratio g/P of the generator and the period.

These conditions entail that the generated scale has exactly two sizes of steps when sorted into ascending order of size, and usually that latter condition suffices to define a MOS. However, when the generator is a rational fraction of the period and the number of steps is more than half of the total possible, a generated scale can have only two sizes of steps and the pseudo-Myhill property, meaning that not all non-unison classes have only two specific intervals.

Mathematical Properties of MOS

Let us represent the period as 1. This would be the logarithm base 2 of 2 if the period is an octave, or in general we can measure intervals by the log base P when P is the period. Suppose the fractions a/b and c/d are a Farey pair, meaning that a/b < c/d and bc - ad = 1. If g = (1-t)(a/b) + t(c/d) for 0 ≤ t ≤ 1, then when t = 0, the scale generated by g will consist of an equal division of 1 (representing P) into steps of size 1/b, and when t = 1 into steps of size 1/d. In between, when t = b/(b + d), we obtain a generator equal to the mediant (a + c)/(b + d) and which will divide the period into b+d equal steps. For all other values a/b < g < c/d we obtain two different sizes of steps, the small steps s, and the large steps L, with the total number of steps b+d, and these scales are the MOS associated to the Farey pair. When g is between a/b and (a + c)/(b + d) there will be b large steps and d small steps, and when it is between (a + c)/(b + d) and c/d, d large steps and b small ones.

While all the scales constructed by generators g with a/b < g < c/d with the exception of the mediant which gives an equal temperament are MOS, not all the scales are proper in the sense of Rothenberg. The range of propriety for MOS is (2a + c)/(2b + d) ≤ g ≤ (a + 2c)/(b + 2d), where MOS coming from a Farey pair (a/b, c/d) are proper when in this range, and improper (unless the MOS has only one small step) when out of it. If (2a + c)/(2b + d) < g < (a + 2c)/(b + 2d), then the scales are strictly proper. Hence the diatonic scale in 12et, with generator 7/12, is proper but not strictly proper since starting from the pair (1/2, 3/5) we find the range of propriety for these seven-note MOS to be [5/9, 7/12].

Given a generator g, we can find MOS for g with period 1 by means of the semiconvergents to g. A pair of successive semiconvergents have the property that they define a Farey pair, and when g is contained in the pair, that is, a/b < g < c/d, we have defined a MOS for g with b+d as the number of notes in the MOS, with b notes of one size and d of the other.

For example, suppose we want MOS for 1/4-comma meantone. The generator will then be log2(5)/4, which has semiconvergents 1/2, 2/3, 3/5, 4/7, 7/12, 11/19, 18/31, 29/50, 47/81, 65/112... If we settle on 31 as a good size for our MOS, we see 18/31 is the mediant between the Farey pair 11/19 and 7/12, for which the range of strict propriety is 29/50 < x < 25/43. Since g is in that range and not equal to 18/31, we will get a strictly proper MOS.

Visualizing MOS: Generator Chains, Pitch Space, and Hierarchies

As MOS Scales are generated by repeated iterations of a single interval, the generator, it is useful to visualize a contiguous "generator chain" that organizes the scale. For example, if the generator is some kind of perfect fifth, then the generator chain is a chain of fifths: FCGDAEB. We know that adjacent tones in the chain are a perfect fifth apart (possibly with octave-displacement), eg. F to C, and that tones two spaces away are some kind of second or ninth apart, eg. F to G. It is clear from the chain that B to F is *not* a perfect fifth, but must be something else (unless the chain closes to form a circle, as would be the case in 7edo). The generator chain shows us that every interval of the MOS scale represents a move on the generator chain some number of generators up or down.

Another common way to view the tones of an MOS scale is as points in logarithmic pitch space, with larger gaps between points representing larger intervals and smaller gaps between points representing smaller intervals. Then we see that our scale has large steps and small steps and intervals that are composed of some stackings of large and small steps. It is not obvious, looking at the generator chain or looking at the tones in pitch space, what the relationship is. Indeed, it is different for different MOS scales -- an "L" will not always represent the same number of generators up or down when we move to a different scale.

Since the generator chain and logarithmic pitch space are both 1-dimensional, it may be helpful to graph them together in 2 dimensions. Here is a diagram for sensi[8], an octatonic 3L 5s MOS scale with a generator of about 444¢. The x-axis shows the generator chain and the y-axis shows the nine tones (eight plus octave) in logarithmic pitch space. You can see that the vertical lines are evenly-spaced (since every generator is the same), while the horizontal lines have large and small gaps, representing the large and small steps of sensi[8].


And another way to visualize MOS scales is hierarchically. Every MOS scale with 3 or more tones:
  1. contains at least one MOS scale with fewer tones (and in fact, more than one instance of it), and
  2. is contained (more than once) in either
    1. an MOS scale with more tones, or
    2. an equal scale (when L:s = 2:1).

Below is a diagram showing four MOS scales in logarithmic pitch space generated by 7\37edo (approx. 227¢). Each contains the ones above it and is contained by the ones below it. There are additional MOS scales that would appear above the first line with 1, 2, 3, 4, and 5 tones, but they have been omitted. The bottom line is a case where L:s=2:1, which means that there are no more MOS scales to be had -- the next stopping point is at a complete chromatic scale of 37edo.
For more images showing the hierarchical arrangement of MOS scales, see MOS scales of 17edo, 31edo MOS scales, MOS Scales of 37edo, and MOS Scales of 127edo.

Classification of MOS

Since MOS scales always consist of some number of large steps and some number of small steps, they can be classified simply by the number of large steps and the number of small steps, in the form #L#s--e.g., the diatonic scale can be described as 5L2s (5 large steps and 2 small steps) or simply [5, 2]. It is typical to ignore the period when specifying MOS scales and instead use the number of large and small steps that make up the interval of equivalence (typically assumed to be the octave--a frequency ratio of 2/1--unless otherwise specified). For instance, the diminished scale in 12-TET is typically classified as 4L4s rather than 1L1s, since there are 4 large and 4 small steps that make up an octave.

Alternatively, we could give a mediant for a Farey pair associated to the MOS, where this mediant is less than any generator for the MOS. In other words, we use the right hand part of the Farey pair interval, which means we must replace g with 1-g and use the complementary pair if g is in the left hand side. This method is rarely used in discussions, however.

The two systems are equivalent; in the Algorithms section you will find code for routines starting from the mediant and going to the Ls pair (the "Ls" routine) and for starting from an Ls pair and going to the mediant (the "medi" routine.) The Ls routine uses modular inverses, whereas the medi routine uses continued fractions.

If the period is assumed to be 2^(1/n) for some integer n, we can give instead the total number of large and small steps in the octave, instead of just the period, and this is commonly done. In this case, GCD(L, s) gives the number of periods in an octave.

Classification via the ? function

Yet another way of classifying MOS is via Minkowski's ? function. Here ?(x) is a continuous increasing function from the real numbers to the real numbers which has some peculiar properties, one being that it sends rational numbers to dyadic rationals. Hence if q is a rational number 0 < q < 1 in use in the mediant system of classifying MOS, r = ?(q) = A/2^n will be a dyadic rational number which can also be used. Note that the ? function is invertible, and it and its inverse function, the Box function, have code given for them in the algorithms section at the bottom of the article.

The integer n in the denominator of r (with A assumed to be odd) is the order (or n+1 is, according to some sources) of q in the Stern-Brocot tree. The two neighboring numbers of order n+1, which define the range of propriety, can also be expressed in terms of the ? and Box functions as Box(r - 2^(-n-1) and Box(r + 2^(-n-1)). If r represents a MOS, the range of possible values for a generator of the MOS will be Box(r) < g < Box(r + 2^(-n)), and the proper generators will be Box(r) < g < Box(r + 2^(-n-1)). So, for example, the MOS denoted by 3/2048 will be between Box(3/2048) and Box(4/2048), which means that 2/21 < g < 1/10, and will be proper if 2/21 < g < 3/31. Hence 7/72, a generator for miracle temperament, will define a MOS but it will not be proper since 7/72 > 3/31 = Box(3/2048 + 1/4096)).

MOS in equal temperaments

In an equal temperament, all intervals are integer multiples of a smallest unit. If the equal temperament is N-EDO and the period is an octave, the sizes of the large and small steps will be p/N and q/N, with p > q. We then have L(p/N) + s(q/N) = 1, which on multiplying through by N gives us

Lp + sq = N.

which is a linear diophantine equation. Solving this by standard methods, and requiring L and s to be positive, gives us the [L, s] pair for the MOS. If some other quantity of equal steps gives the period, we may make the appropriate adjustment.

Blackwood R constant

In the context of the "recognizable diatonic" scales deriving from the Farey pair [1/2, 3/5] Easley Blackwood Jr. defined a characterizing constant R which we may generalize to any MOS as follows. If a/b < g < c/d is a generator with the given Farey pair, take the ratio of relative errors R = (bg - a)/(c - dg). Since this is a ratio of positive numbers, it is positive. As g tends towards a/b it tends to zero, and as g goes to c/d R goes to infinity. When g equals (a + c)/(b + d) it takes the value 1, and the range of propriety is 1/2 <= R <= 2.

When R is less than 1, it represents the ratio in (logarithmic) size between the smaller and the larger step. When it is greater than 1, it is larger/smaller. By replacing g with 1 - g if necessary, we can reduce always to the case where R>1 (or R<1 if we prefer.)


Below is some Maple code for various mathematical routines having to do with MOS. If you have access to Maple, you can of course copy and run these programs. Even if you do not, since Maple code makes better pseudocode than most languages or computer algebra packages afford, it can be used as pseudocode. For that purpose, it will be helpful to know that "modp(x, n)" means reducing x mod the integer n to 0, 1, ..., n-1 not only when x is an integer, but also when it is a rational number with denominator prime to n. In that case, p/q mod n = r means p = qr mod n.

log2 := proc(x)
  1. logarithm base 2
evalf(ln(x)/ln(2)) end:

nextfarey := proc(q, n)
  1. next in row n of Farey sequence from q, 0 <= q <= 1
local a, b, r, s;
if q >= (n-1)/n then RETURN(1) fi;
a := numer(q);
b := denom(q);
s := n - modp(n + 1/a, b);
r := modp(1/b, s);
r/s end:

prevfarey := proc(q, n)
  1. previous in row n of Farey sequence from q, 0 <= q <= 1
local a, b, r, s;
if q=0 then RETURN(0) fi;
if n=0 then RETURN(0) fi;
a := numer(q);
b := denom(q);
s := n - modp(n - 1/a, b);
r := modp(-1/b, s);
r/s end:

fareypair := proc(q)
  1. Farey pair with q as its mediant
local n;
n := denom(q);
[prevfarey(q, n), nextfarey(q, n)] end:

mediant := proc(u, v)
  1. mediant of two rational numbers u and v
(numer(u) + numer(v))/(denom(u) + denom(v)) end:

convergents := proc(z)
  1. convergent list for z
local q;
q end:

exlist := proc(l)
  1. expansion of a convergent list to semiconvergents
local i, j, s, d;
if nops(l)<3 then RETURN(l) fi;
d[1] := l[1];
d[2] := l[2];
s := 3;
for i from 3 to nops(l)-1 do
for j from 1 to (numer(l[i])-numer(l[i-2]))/numer(l[i-1]) do
d[s] :=
s := s+1 od od;
convert(convert(d, array), list) end:

semiconvergents := proc(z)
  1. semiconvergent list for z
exlist(convergents(z)) end:

penult := proc(q)
  1. penultimate convergent to q
local i, u;
u := convergents(q);
if nops(u)=1 then RETURN(u[1]) fi;
for i from 1 to nops(u) do
if u[i]=q then RETURN(u[i-1]) fi od;

Ls := proc(q)
  1. large-small steps from mediant q
local u;
u := fareypair(q);
[denom(u[2]), denom(u[1])] end:

medi := proc(u)
  1. mediant from Large-small steps
local q, r;
if u[2]=1 then RETURN(1/(u[1]+1)) fi;
r := igcd(u[1], u[2]);
if r>1 then RETURN(medi([u[1]/r, u[2]/r])) fi;
q := penult(u[1]/u[2]);
if q > u[1]/u[2] then RETURN((numer(q)+denom(q))/(u[1]+u[2])) fi;
(u[1]+u[2]-numer(q)-denom(q))/(u[1]+u[2]) end:

Lsgen := proc(g, n)
  1. given generator g and scale size n determines large-small steps
local q, u, w;
q := round(n*g)/n;
w := n/denom(q);
u := fareypair(q);
if g<u[1] or g>u[2] or g=q then RETURN('false') fi;
if g<q then RETURN([w*denom(u[1]), w*denom(u[2])]) fi;
[w*denom(u[2]), w*denom(u[1])] end:

revlist := proc(l)
  1. reverse of list
local i, v, e;
e := nops(l);
for i from 1 to e do
v[i] := l[e-i+1] od;
convert(convert(v,array),list) end:

invcon := proc(l)
  1. inverse continued fraction
local d, i, h, k;
h[-2] := 0;
h[-1] := 1;
k[-2] := 1;
k[-1] := 0;
for i from 0 to nops(l)-1 do
h[i] := l[i+1]*h[i-1] + h[i-2];
k[i] := l[i+1]*k[i-1] + k[i-2];
d[i+1] := h[i]/k[i] od;
convert(convert(d, array), list) end:

quest := proc(x)
  1. Minkowski ? function
local i, j, d, l, s, t;
l := convert(x, confrac);
d := nops(l);
s := l[1];
for i from 2 to d do
t := 1;
for j from 2 to i do
t := t - l[j] od;
s := s + (-1)^i * 2^t od;
if type(x, float) then s := evalf(s) fi;
s end:

Box := proc(x)
  1. inverse ? function
local d, e, i, n, w, y;
if type(x, integer) then RETURN(x) fi;
y := x-floor(x);
if y = 1/8 then RETURN(floor(x)+1/4) fi;
w := round(log2(10)*Digits)-5;
n := round(2^w * y);
i :=0;
while n>0 do
i := i+1;
if modp(n,2)=0 then
d[i] := padic[ordp](n, 2);
n := n/2^d[i];
d[i] := padic[ordp](n+1, 2);
n := (n-2^d[i]+1)/2^d[i] fi od;
e := convert(convert(d, array), list);
e := subsop(1=NULL,e);
w := ceil(-log2(y));
e := [op(e), w];
e := [op(e), floor(x)];
e := revlist(e);
n := invcon(e);
w := n[nops(n)];
if type(x, rational) and modp(denom(x), 2)=0 then RETURN(w) fi;
evalf(w) end: