Using Scala to transform just intonation

From Xenharmonic Wiki
Revision as of 20:08, 5 September 2011 by Wikispaces>genewardsmith (**Imported revision 250987280 - Original comment: **)
Jump to navigation Jump to search

IMPORTED REVISION FROM WIKISPACES

This is an imported revision from Wikispaces. The revision metadata is included below for reference:

This revision was by author genewardsmith and made on 2011-09-05 20:08:08 UTC.
The original revision id was 250987280.
The revision comment was:

The revision contents are below, presented both in the original Wikispaces Wikitext format, and in HTML exactly as Wikispaces rendered it.

Original Wikitext content:

[[toc|flat]]

=Scala seq files=
Suppose we have a piece in [[Just intonation]] which we want to put into the [[http://www.huygens-fokker.org/scala/seq_format.html|Scala seq file]] format, which is Scala's musical score format. We can enclose the pitch values in parenthesis, so that they have the form (5/4) for a major third or (7/6) for a subminor third. Another form is monzo format, where (|-2 0 1>) can be used in place of (5/4), and (|-1 -1 0 1>) in place of (7/6). An alternative is to use Scala degree numbers. This involves using lines like "4564 note 61 47" in the seq file, where the number right after "note" is the degree or note number. Scala needs additional information in the form of a scale or a declaration of what equal division is being used to interpret the note number, but one of the advantages is that by changing the scale, you can change the music Scala outputs in the form of a midi file.

=5-limit transformations=
Suppose we have a scale in 5-limit JI. One of the most basic transformations we can apply to such a scale is the major-minor involution. This changes major triads such as 1-5/4-3/2 to minor triads such as 1-6/5-3/2, and vice-versa. Suppose, for example, our scale is the Ellis duodene: 16/15 9/8 6/5 5/4 4/3 45/32 3/2 8/5 5/3 9/5 15/8 2. Going to "Project" under the "Modify" pull-down menu, and putting "5 24/5" into the box called "Factor pair(s)", the resulting scale will be 10/9 9/8 5/4 6/5 4/3 27/20 3/2 5/3 8/5 15/8 9/5 2. If we use this scale in place of the duodene (be sure **not** to change the ordering!) using the "Tools" pull-down menu at "Transform sequence to midi file", we will get our original 5-limit duodene piece, only with major and minor switched about. If we put "5 24/5" in the Project command again, we get the duodene back again, which is why this transformation is called an involution.

An alternative method of accomplishing basically the same thing is to use monzo notation for the notes, only //without// parenthesis. That is, a major third is represented, not by (|-2 0 1>), but by |-2 0 1> with no parentheses. To get this seq file to produce a midi, you need to put both a val command and a corresponding equal command at the top of the file, such as "0 val <612 970 1421|" together with "0 equal 612". This has the advantage of not requiring a scale file. To produce a midi file with the major-minor involution, replace the mapping for 5 with one for 24/5 in [[612edo]] or whatever equal division you choose to use; in this case "0 val <612 970 1385|".

A more exotic transformation is obtained by putting "3 16/5 5 24/5" into the Project box. If we put 3 5 in as our scale using New Scale under the File pull-down menu, then applying this once gives 16/5 24/5 of course, but applying it twice gives 10/3 16/3, which is a new transformation we can obtain directly by "3 10/3 5 16/3". Applying it three times brings us back to 3 5 again. The transformation is of order three, not order two like the major-minor involution. If we apply it first and then major-minor, we obtain 10/3 5, which gives us yet another transformation; on the other hand, applying major-minor first, we end up at 16/5 16/3. This means that the [[http://en.wikipedia.org/wiki/Symmetry_group|group of transformations]] is [[http://en.wikipedia.org/wiki/Nonabelian_group|nonabelian]]. In fact, it is the smallest of all nonabelian groups, the [[http://en.wikipedia.org/wiki/Dihedral_group_of_order_6|group of the triangle]] or dihedral group of order six. In total, counting the identity transformation, we get these six transformations:

3->3 5->5
3->16/5 5->24/5
3->10/3 5->16/3
3->3 5->24/5
3->16/5 5->16/3
3->10/3 5->5

If we apply the Quantize command under the Modify pull-down menu, putting 3 in the box for resolution, we get the [[3edo]] versions of all of these, which turn out to be the same: the 3edo "skeleton", as we might call it, of 5-limit just intonation is left invariant by these transformations. 

[[http://clones.soonlabel.com/public/micro/gene_ward_smith/transformers/dowah0.mp3|Do Wah Diddy Diddy]] [[http://clones.soonlabel.com/public/micro/gene_ward_smith/transformers/dowah1.mp3|3 16/5 5 24/5]] [[http://clones.soonlabel.com/public/micro/gene_ward_smith/transformers/dowah2.mp3|3 10/3 5 16/3]]

=7-limit transformations=
The native 7-limit transformations work very much the same as the 5-limit transformations. Instead of triads we have tetrads, instead of invariance under 3edo we have invariance under [[4edo]], and instead of the group of the triangle we have the [[http://groupprops.subwiki.org/wiki/Dihedral_group:D8|group of the square]].

We first note that the major-minor involution extends to the 7-limit, with the projection being "5 24/5 7 48/7". Instead of a transformation of order three, we get one of order four, by "3 14/5 5 24/5 7 32/5". Applying this twice leads to "3 8/3 5 14/3 7 20/3" and three times to "3 20/7 5 32/7 7 48/7", and applying it once again leads back to 3 5 7. Since "3 14/5 5 24/5 7 32/5" is of order four, "3 8/3 5 14/3 7 20/3" is another involution. We end up with a total of eight transformations:

3->3 5->5 7->7
3->14/5 5->24/5 7->32/5
3->8/3 5->14/3 7->20/3
3->20/7 5->32/7 7->48/7
3->3 5->24/5 7->48/5
3->14/5 5->14/3 7->7
3->8/3 5->32/7 7->32/5
3->20/7 5->5 7->20/3

Just as the 5-limit transformations are left invariant by <3 5 7|, these native 7-limit transformations are left invariant by <4 6 9 11|. However, we can increase the number of 7-limit transformations by no longer requiring that <4 6 9 11| be left invariant, and extending the 5-limit transformations to the 7-limit. If we extend "3 16/5 5 24/5" to the 7-limit as "3 16/5 5 24/5 7 28/5", then applying it twice leads to "3 10/3 5 16/3 7 14/3" and three times to "7 7/2"; the transformation is of finite order modulo octave equivalence, but not absolutely. We can cure this by using it together with its inverse transformation, "3 10/3 5 16/3 7 28/3". If we do this, we get a cycle of order two from major-minor, of order three from transformations lifted from the 5-limit, and of order four from "3 14/5 5 24/5 7 32/5", for a group of order 24, the [[http://mathworld.wolfram.com/TetrahedralGroup.html|group of the tetrahedron]]. If we add to our transformations the inversion, "2 1/2 3 1/3 5 1/5 7 1/7", we end up with a group of order 48, the [[http://mathworld.wolfram.com/OctahedralGroup.html|group of the octahedron]], the full set of symmetries of a hexany. This is illustrated by the piece [[http://robertinventor.tripod.com/tunes/tunes.htm#hexany_phrase_transformations|hexany phrase]].

Original HTML content:

<html><head><title>Using Scala to transform just intonation</title></head><body><!-- ws:start:WikiTextTocRule:6:&lt;img id=&quot;wikitext@@toc@@flat&quot; class=&quot;WikiMedia WikiMediaTocFlat&quot; title=&quot;Table of Contents&quot; src=&quot;/site/embedthumbnail/toc/flat?w=100&amp;h=16&quot;/&gt; --><!-- ws:end:WikiTextTocRule:6 --><!-- ws:start:WikiTextTocRule:7: --><a href="#Scala seq files">Scala seq files</a><!-- ws:end:WikiTextTocRule:7 --><!-- ws:start:WikiTextTocRule:8: --> | <a href="#x5-limit transformations">5-limit transformations</a><!-- ws:end:WikiTextTocRule:8 --><!-- ws:start:WikiTextTocRule:9: --> | <a href="#x7-limit transformations">7-limit transformations</a><!-- ws:end:WikiTextTocRule:9 --><!-- ws:start:WikiTextTocRule:10: -->
<!-- ws:end:WikiTextTocRule:10 --><br />
<!-- ws:start:WikiTextHeadingRule:0:&lt;h1&gt; --><h1 id="toc0"><a name="Scala seq files"></a><!-- ws:end:WikiTextHeadingRule:0 -->Scala seq files</h1>
Suppose we have a piece in <a class="wiki_link" href="/Just%20intonation">Just intonation</a> which we want to put into the <a class="wiki_link_ext" href="http://www.huygens-fokker.org/scala/seq_format.html" rel="nofollow">Scala seq file</a> format, which is Scala's musical score format. We can enclose the pitch values in parenthesis, so that they have the form (5/4) for a major third or (7/6) for a subminor third. Another form is monzo format, where (|-2 0 1&gt;) can be used in place of (5/4), and (|-1 -1 0 1&gt;) in place of (7/6). An alternative is to use Scala degree numbers. This involves using lines like &quot;4564 note 61 47&quot; in the seq file, where the number right after &quot;note&quot; is the degree or note number. Scala needs additional information in the form of a scale or a declaration of what equal division is being used to interpret the note number, but one of the advantages is that by changing the scale, you can change the music Scala outputs in the form of a midi file.<br />
<br />
<!-- ws:start:WikiTextHeadingRule:2:&lt;h1&gt; --><h1 id="toc1"><a name="x5-limit transformations"></a><!-- ws:end:WikiTextHeadingRule:2 -->5-limit transformations</h1>
Suppose we have a scale in 5-limit JI. One of the most basic transformations we can apply to such a scale is the major-minor involution. This changes major triads such as 1-5/4-3/2 to minor triads such as 1-6/5-3/2, and vice-versa. Suppose, for example, our scale is the Ellis duodene: 16/15 9/8 6/5 5/4 4/3 45/32 3/2 8/5 5/3 9/5 15/8 2. Going to &quot;Project&quot; under the &quot;Modify&quot; pull-down menu, and putting &quot;5 24/5&quot; into the box called &quot;Factor pair(s)&quot;, the resulting scale will be 10/9 9/8 5/4 6/5 4/3 27/20 3/2 5/3 8/5 15/8 9/5 2. If we use this scale in place of the duodene (be sure <strong>not</strong> to change the ordering!) using the &quot;Tools&quot; pull-down menu at &quot;Transform sequence to midi file&quot;, we will get our original 5-limit duodene piece, only with major and minor switched about. If we put &quot;5 24/5&quot; in the Project command again, we get the duodene back again, which is why this transformation is called an involution.<br />
<br />
An alternative method of accomplishing basically the same thing is to use monzo notation for the notes, only <em>without</em> parenthesis. That is, a major third is represented, not by (|-2 0 1&gt;), but by |-2 0 1&gt; with no parentheses. To get this seq file to produce a midi, you need to put both a val command and a corresponding equal command at the top of the file, such as &quot;0 val &lt;612 970 1421|&quot; together with &quot;0 equal 612&quot;. This has the advantage of not requiring a scale file. To produce a midi file with the major-minor involution, replace the mapping for 5 with one for 24/5 in <a class="wiki_link" href="/612edo">612edo</a> or whatever equal division you choose to use; in this case &quot;0 val &lt;612 970 1385|&quot;.<br />
<br />
A more exotic transformation is obtained by putting &quot;3 16/5 5 24/5&quot; into the Project box. If we put 3 5 in as our scale using New Scale under the File pull-down menu, then applying this once gives 16/5 24/5 of course, but applying it twice gives 10/3 16/3, which is a new transformation we can obtain directly by &quot;3 10/3 5 16/3&quot;. Applying it three times brings us back to 3 5 again. The transformation is of order three, not order two like the major-minor involution. If we apply it first and then major-minor, we obtain 10/3 5, which gives us yet another transformation; on the other hand, applying major-minor first, we end up at 16/5 16/3. This means that the <a class="wiki_link_ext" href="http://en.wikipedia.org/wiki/Symmetry_group" rel="nofollow">group of transformations</a> is <a class="wiki_link_ext" href="http://en.wikipedia.org/wiki/Nonabelian_group" rel="nofollow">nonabelian</a>. In fact, it is the smallest of all nonabelian groups, the <a class="wiki_link_ext" href="http://en.wikipedia.org/wiki/Dihedral_group_of_order_6" rel="nofollow">group of the triangle</a> or dihedral group of order six. In total, counting the identity transformation, we get these six transformations:<br />
<br />
3-&gt;3 5-&gt;5<br />
3-&gt;16/5 5-&gt;24/5<br />
3-&gt;10/3 5-&gt;16/3<br />
3-&gt;3 5-&gt;24/5<br />
3-&gt;16/5 5-&gt;16/3<br />
3-&gt;10/3 5-&gt;5<br />
<br />
If we apply the Quantize command under the Modify pull-down menu, putting 3 in the box for resolution, we get the <a class="wiki_link" href="/3edo">3edo</a> versions of all of these, which turn out to be the same: the 3edo &quot;skeleton&quot;, as we might call it, of 5-limit just intonation is left invariant by these transformations. <br />
<br />
<a class="wiki_link_ext" href="http://clones.soonlabel.com/public/micro/gene_ward_smith/transformers/dowah0.mp3" rel="nofollow">Do Wah Diddy Diddy</a> <a class="wiki_link_ext" href="http://clones.soonlabel.com/public/micro/gene_ward_smith/transformers/dowah1.mp3" rel="nofollow">3 16/5 5 24/5</a> <a class="wiki_link_ext" href="http://clones.soonlabel.com/public/micro/gene_ward_smith/transformers/dowah2.mp3" rel="nofollow">3 10/3 5 16/3</a><br />
<br />
<!-- ws:start:WikiTextHeadingRule:4:&lt;h1&gt; --><h1 id="toc2"><a name="x7-limit transformations"></a><!-- ws:end:WikiTextHeadingRule:4 -->7-limit transformations</h1>
The native 7-limit transformations work very much the same as the 5-limit transformations. Instead of triads we have tetrads, instead of invariance under 3edo we have invariance under <a class="wiki_link" href="/4edo">4edo</a>, and instead of the group of the triangle we have the <a class="wiki_link_ext" href="http://groupprops.subwiki.org/wiki/Dihedral_group:D8" rel="nofollow">group of the square</a>.<br />
<br />
We first note that the major-minor involution extends to the 7-limit, with the projection being &quot;5 24/5 7 48/7&quot;. Instead of a transformation of order three, we get one of order four, by &quot;3 14/5 5 24/5 7 32/5&quot;. Applying this twice leads to &quot;3 8/3 5 14/3 7 20/3&quot; and three times to &quot;3 20/7 5 32/7 7 48/7&quot;, and applying it once again leads back to 3 5 7. Since &quot;3 14/5 5 24/5 7 32/5&quot; is of order four, &quot;3 8/3 5 14/3 7 20/3&quot; is another involution. We end up with a total of eight transformations:<br />
<br />
3-&gt;3 5-&gt;5 7-&gt;7<br />
3-&gt;14/5 5-&gt;24/5 7-&gt;32/5<br />
3-&gt;8/3 5-&gt;14/3 7-&gt;20/3<br />
3-&gt;20/7 5-&gt;32/7 7-&gt;48/7<br />
3-&gt;3 5-&gt;24/5 7-&gt;48/5<br />
3-&gt;14/5 5-&gt;14/3 7-&gt;7<br />
3-&gt;8/3 5-&gt;32/7 7-&gt;32/5<br />
3-&gt;20/7 5-&gt;5 7-&gt;20/3<br />
<br />
Just as the 5-limit transformations are left invariant by &lt;3 5 7|, these native 7-limit transformations are left invariant by &lt;4 6 9 11|. However, we can increase the number of 7-limit transformations by no longer requiring that &lt;4 6 9 11| be left invariant, and extending the 5-limit transformations to the 7-limit. If we extend &quot;3 16/5 5 24/5&quot; to the 7-limit as &quot;3 16/5 5 24/5 7 28/5&quot;, then applying it twice leads to &quot;3 10/3 5 16/3 7 14/3&quot; and three times to &quot;7 7/2&quot;; the transformation is of finite order modulo octave equivalence, but not absolutely. We can cure this by using it together with its inverse transformation, &quot;3 10/3 5 16/3 7 28/3&quot;. If we do this, we get a cycle of order two from major-minor, of order three from transformations lifted from the 5-limit, and of order four from &quot;3 14/5 5 24/5 7 32/5&quot;, for a group of order 24, the <a class="wiki_link_ext" href="http://mathworld.wolfram.com/TetrahedralGroup.html" rel="nofollow">group of the tetrahedron</a>. If we add to our transformations the inversion, &quot;2 1/2 3 1/3 5 1/5 7 1/7&quot;, we end up with a group of order 48, the <a class="wiki_link_ext" href="http://mathworld.wolfram.com/OctahedralGroup.html" rel="nofollow">group of the octahedron</a>, the full set of symmetries of a hexany. This is illustrated by the piece <a class="wiki_link_ext" href="http://robertinventor.tripod.com/tunes/tunes.htm#hexany_phrase_transformations" rel="nofollow">hexany phrase</a>.</body></html>