MOS substitution: Difference between revisions

Inthar (talk | contribs)
Algorithm: Make code runnable
Inthar (talk | contribs)
No edit summary
Line 37: Line 37:
where <math>\mathbf{z}</math> is the new step size inserted, <math>\mathbf{y}</math> is the step size in the starting MOS identified with <math>\mathbf{z}</math> by the template MOS, and <math>k</math> is the brightness of the mode of the filling MOS used (<math>k = 0</math> corresponds to the darkest mode; the conventional understanding of "brightness" makes sense as <math>\mathbf{L}</math> (resp. <math>\mathbf{m}</math>) > <math>\mathbf{s}</math>).
where <math>\mathbf{z}</math> is the new step size inserted, <math>\mathbf{y}</math> is the step size in the starting MOS identified with <math>\mathbf{z}</math> by the template MOS, and <math>k</math> is the brightness of the mode of the filling MOS used (<math>k = 0</math> corresponds to the darkest mode; the conventional understanding of "brightness" makes sense as <math>\mathbf{L}</math> (resp. <math>\mathbf{m}</math>) > <math>\mathbf{s}</math>).


== Algorithm ==
==Examples==
In the following tables, the interval class of the generators stacked in the generator sequence is such that the perfect generator has fewer <math>\mathbf{X}</math> steps than the imperfect counterpart.
=== 5L2m4s ===
To derive groundfault's [[diamech]] scale which has step pattern <math>5\mathbf{L}2\mathbf{m}4\mathbf{s}</math> as <math>\mathsf{MOS\_subst}(5, 2, 4; \mathbf{m}, \mathbf{s}; k)</math>, we exploit <math>(b, c) = 2</math> and substitute <math>2\mathbf{m}4\mathbf{s}</math> into the template MOS <math>5\mathbf{L}6\mathbf{X}</math> (<math>\mathbf{LXLXLXLXLXX}</math>). Since <math>2\mathbf{m}4\mathbf{s}</math> has three distinct modes (<math>\mathbf{ssmssm}, \mathbf{smssms}, \mathbf{mssmss}</math>) and <math>5\mathbf{L}6\mathbf{X}</math> is primitive, we obtain three distinct scales, all of which admit length-3 generator sequences of 2-steps, representing all 3 possible rotations of <math>(\mathbf{L}+\mathbf{m}, \mathbf{L}+\mathbf{s}, \mathbf{L}+\mathbf{s})</math> as displayed in the following table:
{| class="wikitable"
|+ Diamech as subst 5'''L'''(2'''m'''4'''s''')
|-
!rowspan=2| <math>k</math>
!rowspan=2| filling MOS
!rowspan=2| [[UDP]] for filling MOS
!colspan=2| step pattern
!colspan=2| generator sequence
!rowspan=2| MOS for <math>\mathbf{s} = \mathbf{0}</math>
|-
!| template MOS:
|| <code>LXLXLXLXLXX</code>
!| intvl. class of gen.:
|| 2-steps
|-
| 2 || <code>mssmss</code> || 4&#124;0(2)
|colspan=2 style="text-align:right;"| <code>LmLsLsLmLss</code>
|colspan=2| GS('''L'''+'''m''', '''L'''+'''s''', '''L'''+'''s''') || yes
|-
| 1 || <code>smssms</code> || 2&#124;2(2)
|colspan=2 style="text-align:right;"| <code>LsLmLsLsLms</code>
|colspan=2| GS('''L'''+'''s''', '''L'''+'''m''', '''L'''+'''s''') || yes
|-
| 0 || <code>ssmssm</code> || 0&#124;4(2)
|colspan=2 style="text-align:right;"| <code>LsLsLmLsLsm</code>
|colspan=2| GS('''L'''+'''s''', '''L'''+'''s''', '''L'''+'''m''') || yes
|}
 
=== 5L2m6s ===
{| class="wikitable"
|+ subst 5L(2m6s)
|-
!rowspan=2| <math>k</math>
!rowspan=2| filling MOS (1 period)
!rowspan=2| [[UDP]] for filling MOS
!colspan=2| step pattern
!colspan=2| generator sequence
!rowspan=2| MOS for <math>\mathbf{s} = \mathbf{0}</math>
|-
!| template MOS:
|| <code>LXLXXLXLXXLXX</code>
!| intvl. class of gen.:
|| 5-steps
|-
| 3 || <code>msss</code> || 6&#124;0(2)
|colspan=2 style="text-align:right;"| <code>LmLssLsLmsLss</code>
|colspan=2| GS((2'''L'''+'''m'''+2'''s''')<sup>3</sup>, 2'''L'''+3'''s''') || yes
|-
| 2 || <code>smss</code> || 4&#124;2(2)
|colspan=2 style="text-align:right;"| <code>LsLmsLsLsmLss</code>
|colspan=2| GS((2'''L'''+'''m'''+2'''s''')<sup>2</sup>, 2'''L'''+3'''s''', 2'''L'''+'''m'''+2'''s''') || yes
|-
| 1 || <code>ssms</code> || 2&#124;4(2)
|colspan=2 style="text-align:right;"| <code>LsLsmLsLssLms</code>
|colspan=2| GS(2'''L'''+'''m'''+2'''s''', 2'''L'''+3'''s''', (2'''L'''+'''m'''+2'''s''')<sup>2</sup>) || yes
|-
| 0 || <code>sssm</code> || 0&#124;6(2)
|colspan=2 style="text-align:right;"| <code>LsLssLmLssLsm</code>
|colspan=2| GS(2'''L'''+3'''s''', (2'''L'''+'''m'''+2'''s''')<sup>3</sup>) || yes
|}
Here the notation ''G''<sup>''k''</sup> denotes repeating the generator ''G'' ''k'' times in the generator sequence.
 
These are four of the 8 [[billiard scale]]s that have pattern 5'''L'''2'''m'''6'''s'''. The other four billiard words have length-3 subwords of non-'''X''' letters, unlike the MOS substitution scales.
 
This scale pattern is available in [[37edo]] with step ratio 5:3:1; the generator sequence in the tuning has 2'''L'''+'''m'''+2'''s''' = 486.5 (~4/3) and 2'''L'''+3'''s''' = 421.6 (~14/11), and notably this tuning represents all primes from 3 to 13 with only 3 being inaccurate. 65edo's 9:7:1 is an optimum for 2.3.5.11, and is given by a GS using three 4/3's and one 5/4.
 
=== 6L7m9s ===
{| class="wikitable"
|+ subst 7m(6L9s)
|-
!rowspan=2| <math>k</math>
!rowspan=2| filling MOS (1 period)
!rowspan=2| [[UDP]] for filling MOS
!colspan=2| step pattern
!colspan=2| generator sequence
!rowspan=2| MOS for <math>\mathbf{s} = \mathbf{0}</math>
|-
!| template MOS:
|| <code>mXXmXXmXXmXXmXXmXXmXXX</code>
!| intvl. class of gen.:
|| 3-steps
|-
| 4 || <code>LsLss</code> || 12&#124;0(3)
|colspan=2 style="text-align:right;"| <code>mLsmLsmsLmsLmssmLsmLss</code>
|colspan=2| GS('''L'''+'''m'''+'''s''', '''L'''+'''m'''+'''s''', '''L'''+'''m'''+'''s''', '''L'''+'''m'''+'''s''', '''m'''+2'''s''') || yes
|-
| 3 || <code>LssLs</code> || 9&#124;3(3)
|colspan=2 style="text-align:right;"| <code>mLsmsLmsLmssmLsmLsmsLs</code>
|colspan=2| GS('''L'''+'''m'''+'''s''', '''L'''+'''m'''+'''s''', '''L'''+'''m'''+'''s''', '''m'''+2'''s''', '''L'''+'''m'''+'''s''') || yes
|-
| 2 || <code>sLsLs</code> || 6&#124;6(3)
|colspan=2 style="text-align:right;"| <code>msLmsLmssmLsmLsmsLmsLs</code>
|colspan=2| GS('''L'''+'''m'''+'''s''', '''L'''+'''m'''+'''s''', '''m'''+2'''s''', '''L'''+'''m'''+'''s''', '''L'''+'''m'''+'''s''') || yes
|-
| 1 || <code>sLssL</code> || 3&#124;9(3)
|colspan=2 style="text-align:right;"| <code>msLmssmLsmLsmsLmsLmssL</code>
|colspan=2| GS('''L'''+'''m'''+'''s''', '''m'''+2'''s''', '''L'''+'''m'''+'''s''', '''L'''+'''m'''+'''s''', '''L'''+'''m'''+'''s''') || yes
|-
| 0 || <code>ssLsL</code> || 0&#124;12(3)
|colspan=2 style="text-align:right;"| <code>mssmLsmLsmsLmsLmssmLsL</code>
|colspan=2| GS('''m'''+2'''s''', '''L'''+'''m'''+'''s''', '''L'''+'''m'''+'''s''', '''L'''+'''m'''+'''s''', '''L'''+'''m'''+'''s''')  || no
|}
 
== Mathematical facts ==
=== A ternary scale whose L = m and s = 0 temperings are MOS comes from MOS substitution ===
If a ternary scale with [[step signature]] ''a'''''L'''''b'''''m'''''c'''''s''' satisfies:
# the result of identifying '''L''' steps with '''m''' steps is a MOS;
# the result of deleting all '''s''' steps is a MOS,
then it is a MOS substitution scale, namely subst((''a''+''b'')'''X'''''c'''''s'''(''i''), '''X''', ''a'''''L'''''b'''''m'''(''j'')) for some brightnesses ''i'' and ''j''.
 
In particular, all [[monotone-MOS scale]]s (i.e. such that the results of '''L''' = '''m''', '''m''' = '''s''', and '''s''' = '''0''' temperings are MOSes) arise from MOS substitution in this way.
 
=== If the template MOS is primitive, MOS substitution yields binary well-formed generator sequences ===
The following holds for <math>S = \mathsf{MOS\_subst}(a, b, c; \mathbf{L}, \mathbf{s}; k)</math> (and after switching <math>\mathbf{L}</math> with <math>\mathbf{m}</math> and <math>a</math> with <math>b,</math> for <math>\mathsf{MOS\_subst}(a, b, c; \mathbf{m}, \mathbf{s}; k)</math> as well):
 
Consider the mode of the template MOS <math>T = T(\mathbf{m},\mathbf{X}) = (a+c)\mathbf{X}b\mathbf{m}(0).</math> This is the mode of <math>T</math> that has the most <math>\mathbf{X}</math> steps near the end. If <math>T</math> is [[primitive]], let <math>r</math> be the count of <math>\mathbf{X}</math> steps in a chosen (reduced) generator of <math>T.</math> Since <math>r</math> must be coprime to <math>a+c,</math> <math>r</math>-steps in the filling MOS <math>F = a\mathbf{L}c\mathbf{s}(k)</math> come in exactly 2 sizes, <math>i\mathbf{L}+j\mathbf{s}</math> and <math>(i-1)\mathbf{L}+(j+1)\mathbf{s}.</math> Since the detempering of the imperfect generator of <math>T</math> occurs only once in <math>S</math>, <math>S</math> admits a particularly elegant well-formed binary (using two distinct generators) [[generator sequence]] of length <math>q,</math> corresponding to the circle of <math>r</math>-steps in the filling MOS. Letting <math>\mathsf{GS}(g_1, ..., g_{q})</math> be this generator sequence, <math>g_j</math> is either <math>p\mathbf{m} + i\mathbf{L} + j\mathbf{s}</math> or <math>p\mathbf{m} + (i-1)\mathbf{L} + (j+1)\mathbf{s},</math> according as the <math>j</math>-th <math>r</math>-step in the sequence of stacked <math>r</math>-steps on the chosen mode of <math>F</math> is <math>i\mathbf{L} + j\mathbf{s}</math> or <math>(i-1)\mathbf{L} + (j+1)\mathbf{s}.</math> (We could have chosen to use the mode of <math>T</math> on the other extreme of its generator arc instead, which corresponds to taking the circle of <math>(a+c - r)</math>-steps in <math>F</math> and is thus also valid.) The generator of the template MOS serves as the "guide generator" for this generator sequence.
 
=== If the template is a primitive MOS, and for some perfect generators <math>p_T, p_F, \ |p_T|_\mathbf{X} = |p_F|,</math> then MOS substitution yields almost parallelograms in the lattice ===
With the additional assumption that the number of X's in a perfect generator ''p''<sub>''T''</sub> of the template MOS be a generator class of the filling MOS, the generator sequence yields ''q'' parallel chains ''C''<sub>1</sub>,
..., ''C''<sub>''q''</sub> of the aggregate generator. The offset between ''C''<sub>''i''</sub> and ''C''<sub>''i''+1</sub> is equal to subst(''p''<sub>''T''</sub>, '''X''', ''p''<sub>''F''</sub>), where ''p''<sub>''T''</sub> and ''p''<sub>''F''</sub> are perfect generators (of appropriate lengths) of the template and filling MOSes, respectively. The aggregate generator is  subst((''p''<sub>''T''</sub>)<sup>''r''</sup>, '''X''', ''F''<sup>''r''</sup>), where ''F'' is the filling MOS.
 
Hence in the GS,
* the perfect generator of the filling MOS corresponds to advancing from ''C''<sub>''i''</sub> to ''C''<sub>''i''+1</sub>;
* the imperfect generator of the filling MOS corresponds to looping back to ''C''<sub>1</sub> but on the next note of ''C''<sub>1</sub>, so it and the ''q'' &minus; 1 notes thereafter are advanced by 1 note from any predecessor notes in the chains.
 
Hence these particular MOS substitution scales satisfy a property that we call ''almost parallelogram''{{User:Inthar/Template:adhoc}}. An '''e'''-equivalent scale is ''almost a parallelogram'' if there exist non-negative integers ''m'', ''n'', 0 < ''a'' < ''n'', 0 < ''b'' < ''n'', a vector '''a''', and two linearly independent vectors '''v''' and '''w''' such that the set of notes in the scale as a subset of the lattice of '''e'''-equivalent pitches is
 
<math>\{\mathbf{a} + i\mathbf{v}\}_{i=a}^{n-1} \cup \{\mathbf{a}  + i\mathbf{v} + j\mathbf{w}\}_{(i,j) \in [n]_0 \times [m-2]_1} \cup \{\mathbf{a} + i\mathbf{v} + (m-1)\mathbf{w}\}_{i=0}^{b}.</math>
 
In the above case, ''n'' = ''q'', '''v''' = subst(''p''<sub>''T''</sub>, '''X''', ''p''<sub>''F''</sub>), and '''w''' = subst((''p''<sub>''T''</sub>)<sup>''r''</sup>, '''X''', ''F''<sup>''r''</sup>).
 
The converse is false, as the scale in 5 letters [9/8 28/27 9/8 64/63 9/8 28/27 243/224 28/27 64/63 567/512 64/63] is almost a parallelogram.
 
=== MOS substitution scales have block balance at most 2 ===
Consider a MOS substitution scale a'''X''' (b'''Y''' c'''Z'''). It is obvious that '''X''' has [[block balance]] 1, since we can replace the MOS substitution scale with the MOS scale a'''X''' (b + c)'''W''' to make this argument. '''Y''' and '''Z''' have block balance at most 2, since we can consider windows of the MOS scale of size ''k'' or ''k'' + 1, and the number of times '''Y''' (and also '''Z''') differs by at most 2. This is proved below for '''Y''', but it's exactly the same argument for '''Z''':
 
Case 1: one of ''k'' and ''k'' + 1 equals (''b'' + ''c'') and '''Y''' occurs exactly ''b'' times or ''b'' plus or minus 1 in this case.
 
Case 2: neither of ''k'' and ''k'' + 1 equals (''b'' + ''c''). Here, if '''Y''' occurs ''j'' or ''j'' + 1 times in a window of size ''k'', then ''Y'' occurs ''j'' + 1 or ''j'' + 2 times in a window of size ''k'' + 2.
 
== Open questions ==
# Is there a simple answer for when a MOS substitution scale becomes a MOS after deleting the "added" steps?
# For an arbitrary ternary scale that results from MOS substitution, when are the GSes obtained via the procedure the shortest possible GSes?
# Call an almost parallelogram scale with ''a'' = 1 and ''b'' = ''n'' &minus; 2 ''transposable''{{User:Inthar/Template:adhoc}}. Classify transposable MOS substitution scales.
 
 
== Code ==
Rust code for generating MOS substitution scales:
Rust code for generating MOS substitution scales:
<syntaxhighlight lang="rs>pub type Letter = usize;
<syntaxhighlight lang="rs>pub type Letter = usize;
Line 270: Line 420:


</syntaxhighlight>
</syntaxhighlight>
==Examples==
In the following tables, the interval class of the generators stacked in the generator sequence is such that the perfect generator has fewer <math>\mathbf{X}</math> steps than the imperfect counterpart.
=== 5L2m4s ===
To derive groundfault's [[diamech]] scale which has step pattern <math>5\mathbf{L}2\mathbf{m}4\mathbf{s}</math> as <math>\mathsf{MOS\_subst}(5, 2, 4; \mathbf{m}, \mathbf{s}; k)</math>, we exploit <math>(b, c) = 2</math> and substitute <math>2\mathbf{m}4\mathbf{s}</math> into the template MOS <math>5\mathbf{L}6\mathbf{X}</math> (<math>\mathbf{LXLXLXLXLXX}</math>). Since <math>2\mathbf{m}4\mathbf{s}</math> has three distinct modes (<math>\mathbf{ssmssm}, \mathbf{smssms}, \mathbf{mssmss}</math>) and <math>5\mathbf{L}6\mathbf{X}</math> is primitive, we obtain three distinct scales, all of which admit length-3 generator sequences of 2-steps, representing all 3 possible rotations of <math>(\mathbf{L}+\mathbf{m}, \mathbf{L}+\mathbf{s}, \mathbf{L}+\mathbf{s})</math> as displayed in the following table:
{| class="wikitable"
|+ Diamech as subst 5'''L'''(2'''m'''4'''s''')
|-
!rowspan=2| <math>k</math>
!rowspan=2| filling MOS
!rowspan=2| [[UDP]] for filling MOS
!colspan=2| step pattern
!colspan=2| generator sequence
!rowspan=2| MOS for <math>\mathbf{s} = \mathbf{0}</math>
|-
!| template MOS:
|| <code>LXLXLXLXLXX</code>
!| intvl. class of gen.:
|| 2-steps
|-
| 2 || <code>mssmss</code> || 4&#124;0(2)
|colspan=2 style="text-align:right;"| <code>LmLsLsLmLss</code>
|colspan=2| GS('''L'''+'''m''', '''L'''+'''s''', '''L'''+'''s''') || yes
|-
| 1 || <code>smssms</code> || 2&#124;2(2)
|colspan=2 style="text-align:right;"| <code>LsLmLsLsLms</code>
|colspan=2| GS('''L'''+'''s''', '''L'''+'''m''', '''L'''+'''s''') || yes
|-
| 0 || <code>ssmssm</code> || 0&#124;4(2)
|colspan=2 style="text-align:right;"| <code>LsLsLmLsLsm</code>
|colspan=2| GS('''L'''+'''s''', '''L'''+'''s''', '''L'''+'''m''') || yes
|}
=== 5L2m6s ===
{| class="wikitable"
|+ subst 5L(2m6s)
|-
!rowspan=2| <math>k</math>
!rowspan=2| filling MOS (1 period)
!rowspan=2| [[UDP]] for filling MOS
!colspan=2| step pattern
!colspan=2| generator sequence
!rowspan=2| MOS for <math>\mathbf{s} = \mathbf{0}</math>
|-
!| template MOS:
|| <code>LXLXXLXLXXLXX</code>
!| intvl. class of gen.:
|| 5-steps
|-
| 3 || <code>msss</code> || 6&#124;0(2)
|colspan=2 style="text-align:right;"| <code>LmLssLsLmsLss</code>
|colspan=2| GS((2'''L'''+'''m'''+2'''s''')<sup>3</sup>, 2'''L'''+3'''s''') || yes
|-
| 2 || <code>smss</code> || 4&#124;2(2)
|colspan=2 style="text-align:right;"| <code>LsLmsLsLsmLss</code>
|colspan=2| GS((2'''L'''+'''m'''+2'''s''')<sup>2</sup>, 2'''L'''+3'''s''', 2'''L'''+'''m'''+2'''s''') || yes
|-
| 1 || <code>ssms</code> || 2&#124;4(2)
|colspan=2 style="text-align:right;"| <code>LsLsmLsLssLms</code>
|colspan=2| GS(2'''L'''+'''m'''+2'''s''', 2'''L'''+3'''s''', (2'''L'''+'''m'''+2'''s''')<sup>2</sup>) || yes
|-
| 0 || <code>sssm</code> || 0&#124;6(2)
|colspan=2 style="text-align:right;"| <code>LsLssLmLssLsm</code>
|colspan=2| GS(2'''L'''+3'''s''', (2'''L'''+'''m'''+2'''s''')<sup>3</sup>) || yes
|}
Here the notation ''G''<sup>''k''</sup> denotes repeating the generator ''G'' ''k'' times in the generator sequence.
These are four of the 8 [[billiard scale]]s that have pattern 5'''L'''2'''m'''6'''s'''. The other four billiard words have length-3 subwords of non-'''X''' letters, unlike the MOS substitution scales.
This scale pattern is available in [[37edo]] with step ratio 5:3:1; the generator sequence in the tuning has 2'''L'''+'''m'''+2'''s''' = 486.5 (~4/3) and 2'''L'''+3'''s''' = 421.6 (~14/11), and notably this tuning represents all primes from 3 to 13 with only 3 being inaccurate. 65edo's 9:7:1 is an optimum for 2.3.5.11, and is given by a GS using three 4/3's and one 5/4.
=== 6L7m9s ===
{| class="wikitable"
|+ subst 7m(6L9s)
|-
!rowspan=2| <math>k</math>
!rowspan=2| filling MOS (1 period)
!rowspan=2| [[UDP]] for filling MOS
!colspan=2| step pattern
!colspan=2| generator sequence
!rowspan=2| MOS for <math>\mathbf{s} = \mathbf{0}</math>
|-
!| template MOS:
|| <code>mXXmXXmXXmXXmXXmXXmXXX</code>
!| intvl. class of gen.:
|| 3-steps
|-
| 4 || <code>LsLss</code> || 12&#124;0(3)
|colspan=2 style="text-align:right;"| <code>mLsmLsmsLmsLmssmLsmLss</code>
|colspan=2| GS('''L'''+'''m'''+'''s''', '''L'''+'''m'''+'''s''', '''L'''+'''m'''+'''s''', '''L'''+'''m'''+'''s''', '''m'''+2'''s''') || yes
|-
| 3 || <code>LssLs</code> || 9&#124;3(3)
|colspan=2 style="text-align:right;"| <code>mLsmsLmsLmssmLsmLsmsLs</code>
|colspan=2| GS('''L'''+'''m'''+'''s''', '''L'''+'''m'''+'''s''', '''L'''+'''m'''+'''s''', '''m'''+2'''s''', '''L'''+'''m'''+'''s''') || yes
|-
| 2 || <code>sLsLs</code> || 6&#124;6(3)
|colspan=2 style="text-align:right;"| <code>msLmsLmssmLsmLsmsLmsLs</code>
|colspan=2| GS('''L'''+'''m'''+'''s''', '''L'''+'''m'''+'''s''', '''m'''+2'''s''', '''L'''+'''m'''+'''s''', '''L'''+'''m'''+'''s''') || yes
|-
| 1 || <code>sLssL</code> || 3&#124;9(3)
|colspan=2 style="text-align:right;"| <code>msLmssmLsmLsmsLmsLmssL</code>
|colspan=2| GS('''L'''+'''m'''+'''s''', '''m'''+2'''s''', '''L'''+'''m'''+'''s''', '''L'''+'''m'''+'''s''', '''L'''+'''m'''+'''s''') || yes
|-
| 0 || <code>ssLsL</code> || 0&#124;12(3)
|colspan=2 style="text-align:right;"| <code>mssmLsmLsmsLmsLmssmLsL</code>
|colspan=2| GS('''m'''+2'''s''', '''L'''+'''m'''+'''s''', '''L'''+'''m'''+'''s''', '''L'''+'''m'''+'''s''', '''L'''+'''m'''+'''s''')  || no
|}
== Mathematical facts ==
=== A ternary scale whose L = m and s = 0 temperings are MOS comes from MOS substitution ===
If a ternary scale with [[step signature]] ''a'''''L'''''b'''''m'''''c'''''s''' satisfies:
# the result of identifying '''L''' steps with '''m''' steps is a MOS;
# the result of deleting all '''s''' steps is a MOS,
then it is a MOS substitution scale, namely subst((''a''+''b'')'''X'''''c'''''s'''(''i''), '''X''', ''a'''''L'''''b'''''m'''(''j'')) for some brightnesses ''i'' and ''j''.
In particular, all [[monotone-MOS scale]]s (i.e. such that the results of '''L''' = '''m''', '''m''' = '''s''', and '''s''' = '''0''' temperings are MOSes) arise from MOS substitution in this way.
=== If the template MOS is primitive, MOS substitution yields binary well-formed generator sequences ===
The following holds for <math>S = \mathsf{MOS\_subst}(a, b, c; \mathbf{L}, \mathbf{s}; k)</math> (and after switching <math>\mathbf{L}</math> with <math>\mathbf{m}</math> and <math>a</math> with <math>b,</math> for <math>\mathsf{MOS\_subst}(a, b, c; \mathbf{m}, \mathbf{s}; k)</math> as well):
Consider the mode of the template MOS <math>T = T(\mathbf{m},\mathbf{X}) = (a+c)\mathbf{X}b\mathbf{m}(0).</math> This is the mode of <math>T</math> that has the most <math>\mathbf{X}</math> steps near the end. If <math>T</math> is [[primitive]], let <math>r</math> be the count of <math>\mathbf{X}</math> steps in a chosen (reduced) generator of <math>T.</math> Since <math>r</math> must be coprime to <math>a+c,</math> <math>r</math>-steps in the filling MOS <math>F = a\mathbf{L}c\mathbf{s}(k)</math> come in exactly 2 sizes, <math>i\mathbf{L}+j\mathbf{s}</math> and <math>(i-1)\mathbf{L}+(j+1)\mathbf{s}.</math> Since the detempering of the imperfect generator of <math>T</math> occurs only once in <math>S</math>, <math>S</math> admits a particularly elegant well-formed binary (using two distinct generators) [[generator sequence]] of length <math>q,</math> corresponding to the circle of <math>r</math>-steps in the filling MOS. Letting <math>\mathsf{GS}(g_1, ..., g_{q})</math> be this generator sequence, <math>g_j</math> is either <math>p\mathbf{m} + i\mathbf{L} + j\mathbf{s}</math> or <math>p\mathbf{m} + (i-1)\mathbf{L} + (j+1)\mathbf{s},</math> according as the <math>j</math>-th <math>r</math>-step in the sequence of stacked <math>r</math>-steps on the chosen mode of <math>F</math> is <math>i\mathbf{L} + j\mathbf{s}</math> or <math>(i-1)\mathbf{L} + (j+1)\mathbf{s}.</math> (We could have chosen to use the mode of <math>T</math> on the other extreme of its generator arc instead, which corresponds to taking the circle of <math>(a+c - r)</math>-steps in <math>F</math> and is thus also valid.) The generator of the template MOS serves as the "guide generator" for this generator sequence.
=== If the template is a primitive MOS, and for some perfect generators <math>p_T, p_F, \ |p_T|_\mathbf{X} = |p_F|,</math> then MOS substitution yields almost parallelograms in the lattice ===
With the additional assumption that the number of X's in a perfect generator ''p''<sub>''T''</sub> of the template MOS be a generator class of the filling MOS, the generator sequence yields ''q'' parallel chains ''C''<sub>1</sub>,
..., ''C''<sub>''q''</sub> of the aggregate generator. The offset between ''C''<sub>''i''</sub> and ''C''<sub>''i''+1</sub> is equal to subst(''p''<sub>''T''</sub>, '''X''', ''p''<sub>''F''</sub>), where ''p''<sub>''T''</sub> and ''p''<sub>''F''</sub> are perfect generators (of appropriate lengths) of the template and filling MOSes, respectively. The aggregate generator is  subst((''p''<sub>''T''</sub>)<sup>''r''</sup>, '''X''', ''F''<sup>''r''</sup>), where ''F'' is the filling MOS.
Hence in the GS,
* the perfect generator of the filling MOS corresponds to advancing from ''C''<sub>''i''</sub> to ''C''<sub>''i''+1</sub>;
* the imperfect generator of the filling MOS corresponds to looping back to ''C''<sub>1</sub> but on the next note of ''C''<sub>1</sub>, so it and the ''q'' &minus; 1 notes thereafter are advanced by 1 note from any predecessor notes in the chains.
Hence these particular MOS substitution scales satisfy a property that we call ''almost parallelogram''{{User:Inthar/Template:adhoc}}. An '''e'''-equivalent scale is ''almost a parallelogram'' if there exist non-negative integers ''m'', ''n'', 0 < ''a'' < ''n'', 0 < ''b'' < ''n'', a vector '''a''', and two linearly independent vectors '''v''' and '''w''' such that the set of notes in the scale as a subset of the lattice of '''e'''-equivalent pitches is
<math>\{\mathbf{a} + i\mathbf{v}\}_{i=a}^{n-1} \cup \{\mathbf{a}  + i\mathbf{v} + j\mathbf{w}\}_{(i,j) \in [n]_0 \times [m-2]_1} \cup \{\mathbf{a} + i\mathbf{v} + (m-1)\mathbf{w}\}_{i=0}^{b}.</math>
In the above case, ''n'' = ''q'', '''v''' = subst(''p''<sub>''T''</sub>, '''X''', ''p''<sub>''F''</sub>), and '''w''' = subst((''p''<sub>''T''</sub>)<sup>''r''</sup>, '''X''', ''F''<sup>''r''</sup>).
The converse is false, as the scale in 5 letters [9/8 28/27 9/8 64/63 9/8 28/27 243/224 28/27 64/63 567/512 64/63] is almost a parallelogram.
=== MOS substitution scales have block balance at most 2 ===
Consider a MOS substitution scale a'''X''' (b'''Y''' c'''Z'''). It is obvious that '''X''' has [[block balance]] 1, since we can replace the MOS substitution scale with the MOS scale a'''X''' (b + c)'''W''' to make this argument. '''Y''' and '''Z''' have block balance at most 2, since we can consider windows of the MOS scale of size ''k'' or ''k'' + 1, and the number of times '''Y''' (and also '''Z''') differs by at most 2. This is proved below for '''Y''', but it's exactly the same argument for '''Z''':
Case 1: one of ''k'' and ''k'' + 1 equals (''b'' + ''c'') and '''Y''' occurs exactly ''b'' times or ''b'' plus or minus 1 in this case.
Case 2: neither of ''k'' and ''k'' + 1 equals (''b'' + ''c''). Here, if '''Y''' occurs ''j'' or ''j'' + 1 times in a window of size ''k'', then ''Y'' occurs ''j'' + 1 or ''j'' + 2 times in a window of size ''k'' + 2.
== Open questions ==
# Is there a simple answer for when a MOS substitution scale becomes a MOS after deleting the "added" steps?
# For an arbitrary ternary scale that results from MOS substitution, when are the GSes obtained via the procedure the shortest possible GSes?
# Call an almost parallelogram scale with ''a'' = 1 and ''b'' = ''n'' &minus; 2 ''transposable''{{User:Inthar/Template:adhoc}}. Classify transposable MOS substitution scales.


[[Category:Math]]
[[Category:Math]]