MOS substitution: Difference between revisions

Inthar (talk | contribs)
Inthar (talk | contribs)
 
(391 intermediate revisions by 3 users not shown)
Line 1: Line 1:
'''MOS substitution''' is a procedure for obtaining a ternary scale with arbitrary scale signature aLbmcs. Originally developed by Inthar for the purpose of adding aberrisma steps in an orderly manner to a MOS pattern aLbm (which we write in place of aLbs for convenience's sake, since s denotes the new steps added to the MOS) in the context of groundfault's aberrismic theory, MOS substitution is intended to take advantage of extra symmetry when a, c or b, c is not a coprime pair and generalize the congruence substitution procedure for building balanced words to obtain non-balanced but still more "even" scales.
'''MOS substitution''' is a procedure for obtaining a ternary (3 step sizes) scale from two [[MOS]] patterns. It consists of substituting the step pattern of one MOS pattern (called the ''filling MOS''), scale step for scale step, for all occurrences of a chosen step size of another MOS pattern (called the ''template MOS''). Unlike MV3 scales, a MOS substitution scale may have any combination of step sizes.


Take for example d = (a, c) (:= gcd(a, c)), let a' = a/d and c' = c/d. Consider the MOS word (a + c)Xbm, which we call the ''template MOS''. The most even arrangement of a'-many L steps and c'-many s steps is the MOS a'Lc's, so this method prescribes following the latter MOS, called the ''filling MOS'', to fill in the X's. Fixing a choice of which X in (a + c)Xbm you start from, you have to choose a mode of a'Lc's. (Todo: count the distinct choices.) If a' = c' = 1 (equivalently if a = c), we obtain a balanced (thus MV3) ternary scale; when in addition b is odd, the scale is also SV3 and chiral, and we recover the two chiralities from the two modes of a'Lc's. Of course, one may do this using template MOS aL(b + c)X and filling MOS (b/(b, c))m (c/(b, c))s instead.  
[[Aberrismic theory]] uses MOS substitution. In fact, groundfault reports having come up with a similar concept but not following up on it.
== Convention ==
MOS substitution scales are denoted using the notation "subst ax(bycz)" or just "aX(bYcZ)". Any particular scale of a given MOS substitution type is said to be "a subst ax(bycz)" or "a scale of type ax(bycz)". A specific MOS substitution scale may be denoted {{nowrap|template_MOS_with_slot_letter_X(filling_MOS)}}; to make this notation unique for a particular given MOS-substitution scale, the brightest mode for the template MOS is conventionally used, treating the slot letter X as the smaller step.


We tentatively denote the resulting scale <math>\mathsf{mos\_subst\_aberrize}(a, b, x, c, k),</math> where <math>x \in \{L, m\}</math> is the step size identified with s by the template MOS and <math>k \in \{0, 1, ..., (b + c)/(b,c)-1\}</math> is the brightness of the mode of the filling MOS used (0 corresponds to the darkest mode).
{| class="wikitable"
== Facts ==
|+ style="font-size: 105%;" | The three subst 2'''L'''(1'''m'''2'''s''') scales
Let <math>M_{a,b}(x,y;k)</math> be the mode of axby that would have brightness k if x were L and y were s. For example, <math>M_{a,b}(5,2;5)(x,y) = xxyxxxy.</math> Let <math> n = a+b+c</math> and <math>q = a + c</math> (resp. <math>b + c</math>).
|-
! rowspan="2" | [[Simplified UDP]] for filling MOS
! rowspan="2" | Filling MOS
! colspan="2" | Step pattern
! rowspan="2" | Denoted as
|-
! Template MOS:
| <code>LXLXX</code>
|-
| 2{{pipe}}0
| style="text-align: right;" | <code>mss</code>
| colspan="2" style="text-align: right;" | <code>LmLss</code>
| LXLXX(mss)
|-
| 1{{pipe}}1
| style="text-align: right;" | <code>sms</code>
| colspan="2" style="text-align: right;" | <code>LsLms</code>
| LXLXX(sms)
|-
| 0{{pipe}}2
| style="text-align: right;" | <code>ssm</code>
| colspan="2" style="text-align: right;" | <code>LsLsm</code>
| LXLXX(ssm)
|}


The following holds for <math>S = \mathsf{mos\_subst\_aberrize}(a, b, L, c, k)</math> (resp. <math>\mathsf{mos\_subst\_aberrize}(a, b, m, c, k)</math>):
== Math notation ==
{{User:Inthar/Template:Notation}}
* Boldface Latin variables are step sizes, and <math>\mathbf{L} >  \mathbf{m} > \mathbf{s} > \mathbf{0}.</math> <math>\mathbf{0}</math> denotes the zero step (0 cents).
* Italic lowercase Latin variables are integers.
* Italic uppercase Latin variables are scale words.
* Function names in sans serif font are scale constructions.
* For integers <math>m, n, \ (m, n) := \gcd(m, n).</math>
* If ''w'' is a word (in a specific rotation) in '''X''' and possibly other letters, and ''u'' is a circular word in a specific modal rotation, then <math>\mathsf{subst}(w, \mathbf{X}, u)</math> denotes the word ''w'' but with the ''i''th occurrence of '''X''' replaced with ''u''[''i''] (for {{nowrap|''i'' &ge; 0}}).
* ''a'''''X'''''b'''''Y'''(''k'') denotes the mode of ''a'''''X'''''b'''''Y''' which would have [[simplified UDP]] notation <math>k|a+b-1-k</math> under the assumption '''X''' > '''Y''' > '''0'''.


# If the template MOS <math>T = T(m,X) = M_{b,n}(m,X;n-1)</math> (resp. <math>T(L,X)=M_{a, b+c}(L,X;n-1)</math>) is primitive, let <math>r</math> the count of X steps in a chosen (reduced) generator of <math>T.</math> Since <math>r</math> must be coprime to <math>n</math>, <math>r</math>-steps in the filling MOS <math>F = M_{a,c}(L,s;k)</math> (resp. <math>M_{b,c}(m,s;k)</math>) come in exactly 2 sizes, <math>iL+js</math> and <math>(i-1)L+(j+1)s</math> (resp. <math>im+js</math> and <math>(i-1)m+(j+1)s</math>), and taking this generator of <math>T</math> results in a [[generator sequence]] of length <math>q</math>. Letting <math>\mathsf{GS}(g_1, ..., g_{q})</math> be this generator sequence, <math>g_j</math> is either <math>pm + iL + js</math> or <math>pm + (i-1)L + (j+1)s,</math> (resp. <math>pL + im + js</math> or <math>pL + (i-1)m + (j+1)s,</math>) according as the ''j''-th ''r''-step in the sequence of stacked <math>r</math>-steps in the chosen mode of <math>F</math> is <math>iL + js</math> or <math>(i-1)L + (j+1)s</math> (resp. <math>im + js</math> or <math>(i-1)m + (j+1)s</math>). (We could have chosen to use the "darkest" mode of <math>T</math> instead, which corresponds to taking the circle of (''n &minus; r'')-steps in ''F'' and is thus also valid.)
== Formal definition ==
# Suppose that the perfect generator of ''T'' that we use subtends r < |T|/2 steps. Assume without loss of generality that the template MOS identifies L and s steps. Suppose the perfect generator is tL + us and the imperfect generator is (t - 1)L + (u + 1)s. Then the interval class of (r + 1)-steps has either (a) tL + (u + 1)s and (t - 1)L + (u + 2)s, or (b) tL + (u + 1)s and (t + 1)L + us.
A ternary scale word ''w''('''x'''<sub>1</sub>, '''x'''<sub>2</sub>, '''x'''<sub>3</sub>) is a ''MOS substitution'' scale word if there exists a permutation <math>\pi \in S_3</math> such that the following holds:
#* In case (a), S becomes a mos after deleting s steps for any k in {0, ..., q-1}.
* identifying '''x'''<sub>π(1)</sub> and '''x'''<sub>π(2)</sub> results in a MOS (called the ''template MOS'') and
#* In case (b), S becomes a mos after deleting s steps for k = 0, ..., v, where v is the number of generators stacked to obtain (t + 1)L + us in the filling MOS F.
* deleting all instances of '''x'''<sub>π(3)</sub> (called the ''slot letter'') results in a MOS (called the ''filling MOS'').


== Example ==
== Original derivation ==
For 5L2m4s, we exploit gcd(b, c) = 2 and substitute 2m4s into the template MOS 5L6X (LXLXLXLXLXX). Since 2m4s has three distinct modes (ssmssm, smssms, and mssmss) and 5L6X is primitive, we obtain three distinct scales: LsLsLmLsLsm, LsLmLsLsLms, and LmLsLsLmLss. The first two are a chiral pair of billiard scales, and the last is achiral but not deletion-MOS. All three scales admit short generator sequences of 2-steps, respectively GS(L+s, L+s, L+m), GS(L+s, L+m, L+s), and GS(L+m, L+s, L+s), notably representing all 3 possible rotations of (L+s, L+m, L+s).
MOS substitution was developed by [[Inthar]] for the purpose of adding [[aberrisma]] steps in an orderly manner to a MOS pattern <math>a\mathbf{L}b\mathbf{m}</math> (which we write in place of <math>a\mathbf{L}b\mathbf{s}</math> for convenience's sake, since <math>\mathbf{s}</math> denotes the new aberrisma steps added to the MOS) in the context of groundfault's [[aberrismic theory]]. MOS substitution is intended to take advantage of extra potential symmetry when <math>a, c</math> or <math>b, c</math> is not a coprime pair and mildly generalize the congruence substitution procedure for building [[balanced]] words to obtain non-balanced but still more "even" scales with simple [[generator sequence]] expressions (in the sense of being binary, i.e. using only two distinct generators).
 
The idea is that modifying the input scales in a sufficiently controlled fashion from the nicest case of MOS template scales and MOS filling scales whose period divides the count of unknown letters in the template will result in a scale that retains some degree of elegance in its lattice structure. However, this condition is not necessary for MOS substitution to result in a binary generator sequence (with two distinct generators), though the generator sequence necessary to generate the scale will be longer.
 
In the original aberrismic-informed context, say that <math>d = (a, c) > 1.</math> Consider the MOS word <math>(a + c)\mathbf{X}b\mathbf{m}</math>, which we call the ''template MOS''. Since the "most even" arrangement (in the sense of [[distributional evenness]]) of <math>a</math>-many <math>\mathbf{L}</math> steps and <math>c</math>-many <math>\mathbf{s}</math> steps is the MOS <math>a\mathbf{L}b\mathbf{s}</math> (which will in general be a non-[[primitive]] MOS), this method prescribes following the latter MOS, called the ''filling MOS'', to fill in the <math>\mathbf{X}</math> steps. Fixing a choice of which <math>\mathbf{X}</math> in the MOS <math>(a + c)\mathbf{X}b\mathbf{m}</math> you start from, we can choose one of <math>(a+c)/d</math> modes of <math>a \mathbf{L} c \mathbf{s}.</math> If <math>a = c</math>, we obtain a balanced (thus MV3) ternary scale; when in addition <math>b</math> is odd, the scale is also SV3 and chiral, and we recover the two chiralities from the two modes of <math>a\mathbf{L}a\mathbf{s}</math>. Of course, one may do this using template MOS <math>a\mathbf{L}(b + c)\mathbf{X}</math> and the <math>(b, c)</math>-multiperiod filling MOS <math>b\mathbf{m} c\mathbf{s}</math> instead. This article denotes the resulting scale <math>\mathsf{MOS\_subst}(a, b, c; \mathbf{y}, \mathbf{z}; k):</math>
 
<math>\displaystyle{\mathsf{subst}\left( a\mathbf{w}(b + c)\mathbf{X}(0) , \mathbf{X}, b\mathbf{y}c\mathbf{z}(k) \right) }</math>
 
Here <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>).
 
== 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 [[diaslen]] 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"
|+ style="font-size: 105%;" | Diaslen as {{nowrap|subst 5'''L'''(2'''m'''4'''s''')}}
|-
! rowspan="2" | <math>k</math>
! rowspan="2" | Filling MOS
! rowspan="2" | [[Simplified 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>
! Interval class of gen.:
| 2-steps
|-
| 2 || <code>mssmss</code> || 2{{pipe}}0
| colspan="2" style="text-align: right;" | <code>LmLsLsLmLss</code>
| colspan="2" | GS({{nowrap| '''L''' + '''m''' | '''L''' + '''s''' | '''L''' + '''s''' }}) || yes
|-
| 1 || <code>smssms</code> || 1{{pipe}}1
| colspan="2" style="text-align: right;" | <code>LsLmLsLsLms</code>
| colspan="2" | GS({{nowrap| '''L''' + '''s''' | '''L''' + '''m''' | '''L''' + '''s''' }}) || yes
|-
| 0 || <code>ssmssm</code> || 0{{pipe}}2
| colspan="2" style="text-align: right;" | <code>LsLsLmLsLsm</code>
| colspan="2" | GS({{nowrap| '''L''' + '''s''' | '''L''' + '''s''' | '''L''' + '''m''' }}) || yes
|}
 
=== 5L2m6s ===
{| class="wikitable"
|+ style="font-size: 105%;" | subst 5L(2m6s)
|-
! rowspan="2" | <math>k</math>
! rowspan="2" | Filling MOS
! rowspan="2" | [[Simplified 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>
! Interval class of gen.:
| 5-steps
|-
| 3 || <code>msss</code> || 3{{pipe}}0
| colspan="2" style="text-align: right;" | <code>LmLssLsLmsLss</code>
| colspan="2" | GS({{nowrap| (2'''L''' + '''m''' + 2'''s''')<sup>3</sup> | 2'''L''' + 3'''s''' }}) || yes
|-
| 2 || <code>smss</code> || 2{{pipe}}1
| colspan="2" style="text-align: right;" | <code>LsLmsLsLsmLss</code>
| colspan="2" | GS({{nowrap| (2'''L''' + '''m''' + 2'''s''')<sup>2</sup> | 2'''L''' + 3'''s''' | 2'''L''' + '''m''' + 2'''s''' }}) || yes
|-
| 1 || <code>ssms</code> || 1{{pipe}}2
| colspan="2" style="text-align: right;" | <code>LsLsmLsLssLms</code>
| colspan="2" | GS({{nowrap| 2'''L''' + '''m''' + 2'''s''' | 2'''L''' + 3'''s''' | (2'''L''' + '''m''' + 2'''s''')<sup>2</sup> }}) || yes
|-
| 0 || <code>sssm</code> || 0{{pipe}}3
| colspan="2" style="text-align: right;" | <code>LsLssLmLssLsm</code>
| colspan="2" | GS({{nowrap| 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 {{nowrap|2'''L''' + '''m''' + 2'''s''' {{=}} 486.5 (~4/3)}} and {{nowrap|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"
|+ style="font-size: 105%;" | subst 7m(6L9s)
|-
! rowspan="2" | <math>k</math>
! rowspan="2" | Filling MOS
! rowspan="2" | [[Simplified 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>
! Interval class of gen.:
| 3-steps
|-
| 4 || <code>LsLss</code> || 4{{pipe}}0
| colspan="2" style="text-align: right;" | <code>mLsmLsmsLmsLmssmLsmLss</code>
| colspan="2" | GS({{nowrap| '''L''' + '''m''' + '''s''' | '''L''' + '''m''' + '''s''' | '''L''' + '''m''' + '''s''' | '''L''' + '''m''' + '''s''' | '''m''' + 2'''s''' }}) || yes
|-
| 3 || <code>LssLs</code> || 3{{pipe}}1
| colspan="2" style="text-align: right;" | <code>mLsmsLmsLmssmLsmLsmsLs</code>
| colspan="2" | GS({{nowrap| '''L''' + '''m''' + '''s''' | '''L''' + '''m''' + '''s''' | '''L''' + '''m''' + '''s''' | '''m''' + 2'''s''' | '''L''' + '''m''' + '''s''' }}) || yes
|-
| 2 || <code>sLsLs</code> || 2{{pipe}}2
| colspan="2" style="text-align: right;" | <code>msLmsLmssmLsmLsmsLmsLs</code>
| colspan="2" | GS({{nowrap| '''L''' + '''m''' + '''s''' | '''L''' + '''m''' + '''s''' | '''m''' + 2'''s''' | '''L''' + '''m''' + '''s''' | '''L''' + '''m''' + '''s''' }}) || yes
|-
| 1 || <code>sLssL</code> || 1{{pipe}}3
| colspan="2" style="text-align: right;" | <code>msLmssmLsmLsmsLmsLmssL</code>
| colspan="2" | GS({{nowrap| '''L''' + '''m''' + '''s''' | '''m''' + 2'''s''' | '''L''' + '''m''' + '''s''' | '''L''' + '''m''' + '''s''' | '''L''' + '''m''' + '''s''' }}) || yes
|-
| 0 || <code>ssLsL</code> || 0{{pipe}}4
| colspan="2" style="text-align: right;" | <code>mssmLsmLsmsLmsLmssmLsL</code>
| colspan="2" | GS({{nowrap| '''m''' + 2'''s''' | '''L''' + '''m''' + '''s''' | '''L''' + '''m''' + '''s''' | '''L''' + '''m''' + '''s''' | '''L''' + '''m''' + '''s''' }})  || no
|}
 
== Mathematical facts ==
=== A ternary scale whose {{nowrap|L {{=}} m}} and {{nowrap|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(({{nowrap|''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 {{nowrap|'''L''' {{=}} '''m''' | '''m''' {{=}} '''s'''}}, and {{nowrap|'''s''' {{=}} '''0'''}} temperings are MOSes) arise from MOS substitution in this way.
=== If a ternary scale satisfies all three possible MOS-substitution types, then it is pairwise-MOS and deletion-MOS ===
This fact is immediate. (See [[pairwise-MOS]] and [[deletion-MOS]].)
 
Corollary (by [[Ternary scale theorems]]): Such a scale is [[Fraenkel word|Fraenkel]], [[odd-regular]], or [[even-regular]].
 
=== 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 = \frac{a+c}{\gcd(a,c)},</math> the period of the filling MOS. The generator sequence corresponds 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, \ r := \left|p_T\right|_\mathbf{X} = \left|p_F\right|,</math> then MOS substitution yields a parallelogram substring in the lattice ===
With the additional assumption that the number of '''X''' letters 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 sum of the generators in the GS. 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>''q''</sup>, '''X''', ''G''<sup>''r''</sup>), where ''G'' is the period of 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 ''[[parallelogram substring scale|parallelogram substring]]''. An '''e'''-equivalent scale is a ''parallelogram substring'' if there exist integers ''m'' > 0, ''n'' > 0, 0 &le; ''a'' < ''n'', 0 &le; ''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}. % prefix of last row
</math>
 
Here the scale is thought as traversing a series of rows one step of the row at a time, and
* <math>\{\mathbf{a} + i\mathbf{v}\}_{i=a}^{n-1}</math> is a (nonempty) suffix of the first row
* <math>\{\mathbf{a} + i\mathbf{v} + j\mathbf{w}\}_{(i,j) \in [n]_0 \times [m-2]_1}</math> is a (possibly empty) parallelogram where rows are traversed fully
* <math>\{\mathbf{a} + i\mathbf{v} + (m-1)\mathbf{w}\}_{i=0}^{b}</math> is a (nonempty) prefix of the last row
* '''v''' and '''w''' are the generator and offset
 
In the above case, {{nowrap| ''n'' {{=}} ''q'' | '''v''' {{=}} subst(''p''<sub>''T''</sub>, '''X''', ''p''<sub>''F''</sub>) | and '''w''' {{=}} subst((''p''<sub>''T''</sub>)<sup>''q''</sup>, '''X''', ''G''<sup>''r''</sup>) (the aggregate generator)}}.
 
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 a parallelogram substring.
 
=== MOS substitution scales have block balance at most 2 ===
Consider a MOS substitution scale {{nowrap|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''' ({{nowrap|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 {{nowrap|''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 {{nowrap|''k'' + 1}} equals ({{nowrap|''b'' + ''c''}}) and '''Y''' occurs exactly ''b'' times or ''b'' plus or minus 1 in this case.
 
Case 2: Neither of ''k'' and {{nowrap|''k'' + 1}} equals ({{nowrap|''b'' + ''c''}}). Here, if '''Y''' occurs ''j'' or {{nowrap|''j'' + 1}} times in a window of size ''k'', then '''Y''' occurs {{nowrap|''j'' + 1}} or {{nowrap|''j'' + 2}} times in a window of size {{nowrap|''k'' + 2}}.
 
=== Ternary parallelogram scales are MOS substitution scales ===
:''Main article: [[Ternary parallelogram scales are MOS substitution]]''
 
== MOS substitution scales and RTT ==
Given a ternary scale with step signature ''a''L''b''m''c''s with gcd(''a'', ''b'', ''c'') = 1 and a [[JI subgroup]], there exist linearly independent (possibly [[patent val|non-patent]]) [[val]]s ''a'', ''a'' + ''b'', and ''a'' + ''b'' + ''c'' that interpret the scale. Assuming the join is not contorted, a [[rank-3 temperament]] can now be defined as the join of these three vals.
 
== Pseudocode ==
<syntaxhighlight lang="py">
def letterwise_subst(template_word, slot_letter, filling_word):
    result = ""
    i = 0
    for letter in template_word:
        if letter == slot_letter:
            result += filling_word[i]
            i += 1
        else:
            result += letter
    return result
# In UDP, brightness = number of generators up * gcd of the step counts
# Function returns subst nX X (nY Y nZ Z (brightness_of_filling_mos) | (nY + nZ - gcd(nY, nZ) - brightness_of_filling_mos))
def mos_subst(nX, nY, nZ, sizeX, sizeY, sizeZ, brightness_of_filling_mos):
    template_mos = mos_word(nX, nY + nZ, "X", "W", brightness=nX + nY + nZ - gcd(nX, nY + nZ)) # MOS word with nX X's and nY + nZ W's; X is treated as L and W as s for purposes of brightness
    filling_mos = mos_word(nY, nZ, "Y", "Z", brightness=brightness_of_filling_mos)
    word = letterwise_subst(template_mos, "W", filling_mos)
    scale = subst_step_sizes(word, {"X": sizeX, "Y": sizeY, "Z": sizeZ})
    return scale
</syntaxhighlight>
 
[[Category:Math]]
[[Category:Combinatorics on words]]
[[Category:Scale]]
[[Category:Rank-3 scales| ]]
[[Category:Pages with open problems]]
[[Category:Aberrismic theory]]