Template:Harmonics in equal/doc: Difference between revisions

From Xenharmonic Wiki
Jump to navigation Jump to search
m Fredg999 moved page Template:Primes in equal/doc to Template:Harmonics in equal/doc: Not just for primes
Sintel (talk | contribs)
No edit summary
Line 25: Line 25:


<syntaxhighlight lang="text">
<syntaxhighlight lang="text">
{{primes in equal
{{harmonics in equal
| steps = <number of steps>
| steps = <number of steps>
| num = <numerator>
| num = <numerator>
Line 58: Line 58:


<syntaxhighlight lang="text">
<syntaxhighlight lang="text">
{{primes in equal|31}}
{{harmonics in equal|31}}
</syntaxhighlight>
</syntaxhighlight>
{{primes in equal|31}}
{{harmonics in equal|31}}


For tritave or other prime divisions, two arguments is enough:
For tritave or other prime divisions, two arguments is enough:
<syntaxhighlight lang="text">
<syntaxhighlight lang="text">
{{primes in equal|13|3}}
{{harmonics in equal|13|3}}
</syntaxhighlight>
</syntaxhighlight>
{{primes in equal|13|3}}
{{harmonics  in equal|13|3}}




Line 72: Line 72:


<syntaxhighlight lang="text">
<syntaxhighlight lang="text">
{{primes in equal|15|7|3}}
{{harmonics in equal|15|7|3}}
</syntaxhighlight>
</syntaxhighlight>
{{primes in equal|15|7|3}}
{{harmonics in equal|15|7|3}}


==== Advanced ====
==== Advanced ====
Line 81: Line 81:


<syntaxhighlight lang="text">
<syntaxhighlight lang="text">
{{primes in equal|13|3|columns=11|start=2|title=Primes in [[13edt]]}}
{{harmonics in equal|13|3|columns=11|start=2|title=Primes in [[13edt]]}}
</syntaxhighlight>
</syntaxhighlight>
{{primes in equal|13|3|columns=11|start=2|title=Primes in [[13edt]]}}
{{harmonics in equal|13|3|columns=11|start=2|title=Primes in [[13edt]]}}


For large divisions ([[313edo]] in this example) the absolute error gets very small. The default precision gets calculated automatically, but if we want to increase it even further, we can set <code>prec</code> to a higher value. This is not recommended generally.
For large divisions ([[313edo]] in this example) the absolute error gets very small. The default precision gets calculated automatically, but if we want to increase it even further, we can set <code>prec</code> to a higher value. This is not recommended generally.


<syntaxhighlight lang="text">
<syntaxhighlight lang="text">
{{primes in equal|313|columns=9|start=2}}
{{harmonics in equal|313|columns=9|start=2}}
{{primes in equal|313|columns=9|start=2|prec=5|title=Same with prec=5}}
{{harmonics in equal|313|columns=9|start=2|prec=5|title=Same with prec=5}}
</syntaxhighlight>
</syntaxhighlight>
{{primes in equal|313|columns=9|start=2}}
{{harmonics in equal|313|columns=9|start=2}}
{{primes in equal|313|columns=9|start=2|prec=5|title=Same with prec=5}}
{{harmonics in equal|313|columns=9|start=2|prec=5|title=Same with prec=5}}

Revision as of 19:59, 15 January 2022

This template generates a table for prime approximations in equal-step tunings.

Usage

Simple

For divisions of the octave (edo), you can use one unnamed argument:

{{primes in equal|<EDO number>}}

For other divisions, you can use two or three unnamed arguments:

{{primes in equal|<steps>|<numerator>|<denominator>}}

By default, the titles for divisions of 2/1, 3/1 and 3/2 will be displayed as 'edo', 'edt' and 'edf' respectively. When the denominator is 1, it will not be displayed.

Advanced

The template takes up to 7 arguments:

{{harmonics in equal
| steps = <number of steps>
| num = <numerator>
| denom = <denominator>
| columns = <column count>
| start = <start column>
| prec = <decimals of abs error>
| title = <your title>
}}
steps
Number of steps. This parameter can also be given without the parameter name.
num
Numerator of the interval that is divided equally. Can be used without parameter name. Default: 2.
denom
Denominator of the interval that is divided equally. Can be used without parameter name. Default: 1.
columns
number of primes to include, the default (8) means 2, 3, 5, 7, 11, 13, 17, 19
start
Default is 1 (which means the prime 2), set to 2 to skip the octave.
prec
Precision of absolute error (digits after the decimal point), default is estimated according to the step size.
title
Default is: "Approximations of prime intervals in name". By default, the names for divisions of 2/1, 3/1 and 3/2 will be displayed as 'edo', 'edt' and 'edf' respectively. When the denominator is 1, it will not be displayed.

Examples

Basic

For edos it is sufficient to only input the number of steps:

{{harmonics in equal|31}}
Approximation of prime harmonics in 31edo
Harmonic 2 3 5 7 11 13 17 19 23 29 31
Error Absolute (¢) +0.0 -5.2 +0.8 -1.1 -9.4 +11.1 +11.2 +12.2 -8.9 +15.6 +16.3
Relative (%) +0.0 -13.4 +2.0 -2.8 -24.2 +28.6 +28.9 +31.4 -23.0 +40.3 +42.0
Steps
(reduced)
31
(0)
49
(18)
72
(10)
87
(25)
107
(14)
115
(22)
127
(3)
132
(8)
140
(16)
151
(27)
154
(30)

For tritave or other prime divisions, two arguments is enough:

{{harmonics in equal|13|3}}
Approximation of harmonics in 13edt
Harmonic 2 3 4 5 6 7 8 9 10 11 12
Error Absolute (¢) -29.6 +0.0 -59.1 -6.5 -29.6 -3.8 +57.6 +0.0 -36.1 -54.8 -59.1
Relative (%) -20.2 +0.0 -40.4 -4.5 -20.2 -2.6 +39.4 +0.0 -24.7 -37.5 -40.4
Steps
(reduced)
8
(8)
13
(0)
16
(3)
19
(6)
21
(8)
23
(10)
25
(12)
26
(0)
27
(1)
28
(2)
29
(3)


In the most general case, we can input the number of steps, numerator and denominator.

{{harmonics in equal|15|7|3}}
Approximation of harmonics in 15ed7/3
Harmonic 2 3 4 5 6 7 8 9 10 11 12
Error Absolute (¢) -26.5 -43.9 +44.8 -48.2 +27.4 -43.9 +18.3 +10.0 +23.1 -44.1 +0.9
Relative (%) -27.1 -44.9 +45.8 -49.2 +28.0 -44.9 +18.7 +10.2 +23.7 -45.1 +0.9
Steps
(reduced)
12
(12)
19
(4)
25
(10)
28
(13)
32
(2)
34
(4)
37
(7)
39
(9)
41
(11)
42
(12)
44
(14)

Advanced

Sometimes you want to see more or skip some lower columns and have to adjust the title:

{{harmonics in equal|13|3|columns=11|start=2|title=Primes in [[13edt]]}}
Primes in 13edt
Harmonic 3 4 5 6 7 8 9 10 11 12 13
Error Absolute (¢) +0.0 -59.1 -6.5 -29.6 -3.8 +57.6 +0.0 -36.1 -54.8 -59.1 -51.4
Relative (%) +0.0 -40.4 -4.5 -20.2 -2.6 +39.4 +0.0 -24.7 -37.5 -40.4 -35.1
Steps
(reduced)
13
(0)
16
(3)
19
(6)
21
(8)
23
(10)
25
(12)
26
(0)
27
(1)
28
(2)
29
(3)
30
(4)

For large divisions (313edo in this example) the absolute error gets very small. The default precision gets calculated automatically, but if we want to increase it even further, we can set prec to a higher value. This is not recommended generally.

{{harmonics in equal|313|columns=9|start=2}}
{{harmonics in equal|313|columns=9|start=2|prec=5|title=Same with prec=5}}
Approximation of prime harmonics in 313edo
Harmonic 3 5 7 11 13 17 19 23 29
Error Absolute (¢) -0.36 +0.91 +1.14 +0.76 -0.91 -1.44 +1.53 +0.48 +1.73
Relative (%) -9.3 +23.7 +29.8 +19.8 -23.8 -37.6 +39.9 +12.5 +45.2
Steps
(reduced)
496
(183)
727
(101)
879
(253)
1083
(144)
1158
(219)
1279
(27)
1330
(78)
1416
(164)
1521
(269)
Same with prec=5
Harmonic 3 5 7 11 13 17 19 23 29
Error Absolute (¢) -0.35756 +0.90673 +1.14214 +0.75873 -0.91105 -1.44103 +1.52852 +0.47965 +1.73271
Relative (%) -9.3 +23.7 +29.8 +19.8 -23.8 -37.6 +39.9 +12.5 +45.2
Steps
(reduced)
496
(183)
727
(101)
879
(253)
1083
(144)
1158
(219)
1279
(27)
1330
(78)
1416
(164)
1521
(269)