User:Ganaram inukshuk/Code: Difference between revisions
→Update (Nov 2022): Added wikitable-formatted example |
Added code link for JIRAF (short for JI ratio finder) |
||
| (2 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
This page is for xen-related programming projects that I've made but don't have an exact place on the wiki (yet). | This page is for xen-related programming projects that I've made but don't have an exact place on the wiki (yet). | ||
== Mosfinder | == Mosfinder (C++) == | ||
I wrote a crude C++ program for finding all of the mosses for a given edo. | I wrote a crude C++ program for finding all of the mosses for a given edo. | ||
| Line 582: | Line 582: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
== Mosfinder | == Mosfinder (VBA) == | ||
Based on the C++ mosfinder and further experiments with copy-pasting tables from Excel and into the wiki editor, I ended up writing an Excel macro that's basically a port of the C++ mosfinder, with basic formatting for a table. The latest version has two versions of the same macro where one skips step visualization and lists the steps as a list of numbers. This version was created due to concerns of larger edos' step visualizations being harder to copy and paste. | Based on the C++ mosfinder and further experiments with copy-pasting tables from Excel and into the wiki editor, I ended up writing an Excel macro that's basically a port of the C++ mosfinder, with basic formatting for a table. The latest version has two versions of the same macro where one skips step visualization and lists the steps as a list of numbers. This version was created due to concerns of larger edos' step visualizations being harder to copy and paste. | ||
| Line 2,042: | Line 2,042: | ||
|} | |} | ||
== Moscalc | == Moscalc == | ||
This is a program that finds a string representing a mos xL ys in its brightest mode, given only x and y. | This is a program that finds a string representing a mos xL ys in its brightest mode, given only x and y. | ||
| Line 2,143: | Line 2,143: | ||
LLLLLLLLLLLLs - 12L 1s | LLLLLLLLLLLLs - 12L 1s | ||
== Moscalc and | == Moscalc and modecalc (Python) == | ||
This is a Python port of the aforementioned Moscalc program written in C++. This is accompanied by a Modecalc program that finds a scale's modes, the intervals for those modes, and the scale degrees for those modes. | This is a Python port of the aforementioned Moscalc program written in C++. This is accompanied by a Modecalc program that finds a scale's modes, the intervals for those modes, and the scale degrees for those modes. | ||
| Line 2,204: | Line 2,204: | ||
=== Update (Nov 2022) === | === Update (Nov 2022) === | ||
There is now an option to output a mos table as one consolidated table using the MosModecalcOnetable() function. Example output below (may be too wide on some screens).<syntaxhighlight> | There is now an option to output a mos table as one consolidated table using the MosModecalcOnetable() function. Note that MosModecalc() can output this as two separate tables (one for mossteps and one for mosdegrees). Example output below (may be too wide on some screens).<syntaxhighlight> | ||
Mode UDP Mode name Rotational order smiunison (0-smidegree) 1-smistep (1-smidegree) 2-smistep (2-smidegree) 3-smistep (3-smidegree) 4-smistep (4-smidegree) 5-smistep (5-smidegree) 6-smistep (6-smidegree) smioctave (7-smidegree) | Mode UDP Mode name Rotational order smiunison (0-smidegree) 1-smistep (1-smidegree) 2-smistep (2-smidegree) 3-smistep (3-smidegree) 4-smistep (4-smidegree) 5-smistep (5-smidegree) 6-smistep (6-smidegree) smioctave (7-smidegree) | ||
------- ----- ----------- ------------------ ------------------------- ------------------------- ------------------------- ------------------------- ------------------------- ------------------------- ------------------------- ------------------------- | ------- ----- ----------- ------------------ ------------------------- ------------------------- ------------------------- ------------------------- ------------------------- ------------------------- ------------------------- ------------------------- | ||
| Line 2,215: | Line 2,215: | ||
sLsLsLL 0|6 Mode 7 2 0 (perfect) s (minor) L+s (perfect) L+2s (minor) 2L+2s (minor) 2L+3s (diminished) 3L+3s (minor) 4L+3s (perfect) | sLsLsLL 0|6 Mode 7 2 0 (perfect) s (minor) L+s (perfect) L+2s (minor) 2L+2s (minor) 2L+3s (diminished) 3L+3s (minor) 4L+3s (perfect) | ||
</syntaxhighlight>The same output can be formatted as a wikitable. Other table features (such as sorting) may require additional edits. | </syntaxhighlight>The same output can be formatted as a wikitable. Other table features (such as sorting) may require additional edits. | ||
{| class="wikitable" style="text-align: left;" | {| class="wikitable sortable" style="text-align: left;" | ||
|+ | |+Modes of 4L 3s (smitonic) | ||
|- | |- | ||
! Mode !! UDP !! Mode name !! align="right"| Rotational order !! smiunison (0-smidegree) !! 1-smistep (1-smidegree) !! 2-smistep (2-smidegree) !! 3-smistep (3-smidegree) !! 4-smistep (4-smidegree) !! 5-smistep (5-smidegree) !! 6-smistep (6-smidegree) !! smioctave (7-smidegree) | ! Mode !! UDP !! Mode name !! align="right"| Rotational order !! smiunison (0-smidegree) !! 1-smistep (1-smidegree) !! 2-smistep (2-smidegree) !! 3-smistep (3-smidegree) !! 4-smistep (4-smidegree) !! 5-smistep (5-smidegree) !! 6-smistep (6-smidegree) !! smioctave (7-smidegree) | ||
| Line 2,234: | Line 2,234: | ||
| sLsLsLL || 0<nowiki>|</nowiki>6 || dagothic || align="right"| 2 || 0 (perfect) || s (minor) || L+s (perfect) || L+2s (minor) || 2L+2s (minor) || 2L+3s (diminished) || 3L+3s (minor) || 4L+3s (perfect) | | sLsLsLL || 0<nowiki>|</nowiki>6 || dagothic || align="right"| 2 || 0 (perfect) || s (minor) || L+s (perfect) || L+2s (minor) || 2L+2s (minor) || 2L+3s (diminished) || 3L+3s (minor) || 4L+3s (perfect) | ||
|} | |} | ||
== JIRAF (C++) == | |||
JI ratio finder, possibly reverse-engineered from other already-existing algorithms. | |||
Source code: https://gist.github.com/GanaramInukshuk/b010ff8c29cd03c13b84f1b504efce62<syntaxhighlight line="1"> | |||
Approximated ratios for 1\16 (75c): | |||
19/18 = 93.6031 | |||
20/19 = 88.8008 | |||
Approximated ratios for 2\16 (150c): | |||
11/10 = 165.004 | |||
12/11 = 150.637 | |||
13/12 = 138.573 | |||
Approximated ratios for 3\16 (225c): | |||
8/7 = 231.174 | |||
17/15 = 216.687 | |||
Approximated ratios for 4\16 (300c): | |||
6/5 = 315.641 | |||
13/11 = 289.21 | |||
19/16 = 297.513 | |||
20/17 = 281.358 | |||
Approximated ratios for 5\16 (375c): | |||
5/4 = 386.314 | |||
16/13 = 359.472 | |||
Approximated ratios for 6\16 (450c): | |||
9/7 = 435.084 | |||
13/10 = 454.214 | |||
17/13 = 464.428 | |||
Approximated ratios for 7\16 (525c): | |||
15/11 = 536.951 | |||
19/14 = 528.687 | |||
Approximated ratios for 8\16 (600c): | |||
7/5 = 582.512 | |||
10/7 = 617.488 | |||
17/12 = 603 | |||
Approximated ratios for 9\16 (675c): | |||
19/13 = 656.985 | |||
Approximated ratios for 10\16 (750c): | |||
14/9 = 764.916 | |||
17/11 = 753.637 | |||
20/13 = 745.786 | |||
Approximated ratios for 11\16 (825c): | |||
8/5 = 813.686 | |||
13/8 = 840.528 | |||
Approximated ratios for 12\16 (900c): | |||
5/3 = 884.359 | |||
17/10 = 918.642 | |||
Approximated ratios for 13\16 (975c): | |||
7/4 = 968.826 | |||
Approximated ratios for 14\16 (1050c): | |||
11/6 = 1049.36 | |||
20/11 = 1035 | |||
Approximated ratios for 15\16 (1125c): | |||
19/10 = 1111.2 | |||
End of program reached. | |||
</syntaxhighlight> | |||