Fractal scale: Difference between revisions
Fixed second example |
added logarithmic example, added concept of truncated scale, added script to calculate fractal scales |
||
Line 107: | Line 107: | ||
The initial division may contain more than 2 intervals. Here is a simple example with 3 divisions. | The initial division may contain more than 2 intervals. Here is a simple example with 3 divisions. | ||
{{ | {| class="wikitable" | ||
|+ <math>1:2^{1/4}:2^{3/4}:2</math> logarithmic fractal scales, represented in 64edo | |||
! Order | |||
! Number of steps | |||
! Step visualization | |||
! [[Step pattern]] (55edo) | |||
! Scale [[degree]]s (55edo) | |||
|- | |||
| 0 | |||
| 1 | |||
| {{Step vis|64}}┤ | |||
| 64 | |||
| 64 | |||
|- | |||
| 1 | |||
| 3 | |||
| {{Step vis|16 32 16}} | |||
| 16 32 16 | |||
| 16 48 64 | |||
|- | |||
| 3 | |||
| 9 | |||
| {{Step vis|4 8 4 8 16 8 4 8 4}} | |||
| 4 8 4 8 16 8 4 8 4 | |||
| 4 12 16 24 40 48 52 60 64 | |||
|- | |||
| 9 | |||
| 27 | |||
| {{Step vis|1 2 1 2 4 2 1 2 1 2 4 2 4 8 4 2 4 2 1 2 1 2 4 2 1 2 1}} | |||
| 1 2 1 2 4 2 1 2 1 2 4 2 4 8 4 2 4 2 1 2 1 2 4 2 1 2 1 | |||
| 1 3 4 6 10 12 13 15 16 18 22 24 28 36 40 42 46 48 49 51 52 54 58 60 61 63 64 | |||
|} | |||
=== Inverse linear fractal scales === | === Inverse linear fractal scales === | ||
{{todo|add examples|inline=1|comment=Create table with a simple example.}} | |||
=== Truncated fractal scales === | |||
Since the division is applied to every interval in each step, some intervals will become very small compared to others. For example, if we divide the octave logarithmically by the ratio <math>1:2^a:2</math> with <math>1/2 < a < 1</math> (like the golden logarithmic fractal scale above), then after ''N'' steps, the largest scale step will have size <math>2^{aN}</math> and the smallest scale step will have size <math>2^{(1-a)N}</math>. The ratio between the two is <math>2^{(2a-1)N} > 2^N</math> which grows exponentially as ''N'' grows linearly, so the scale will have very uneven steps. | |||
If we wish to make the scale steps more even, then we can choose some smallest '''threshold interval''' ''ε'' in the linear case (or 1+''ε'' in the logarithmic case). Here we consider the linear case. On each step, we divide an interval if it is larger than ''ε'', otherwise we leave it untouched if it is smaller than ''ε''. Since the divided intervals get smaller and smaller, we will eventually reach a point where the intervals become smaller than ''ε'', so this process will terminate after a finite amount of steps (and hence the scale is also finite). Here is an example: | |||
{{todo|add examples|inline=1|comment=Create table with a simple example.}} | |||
Alternatively, we can do '''early stopping''' -- we stop dividing the interval if any of the ''divided parts'' of the interval would be smaller than the threshold. Here is another example: | |||
{{todo|add examples|inline=1|comment=Create table with a simple example.}} | {{todo|add examples|inline=1|comment=Create table with a simple example.}} | ||
== Formulas == | == Formulas == | ||
Here is a Python script to calculate the steps and degrees of a logarithmic fractal scale, provided the order and the ratio. | |||
<syntaxhighlight lang="python"> | |||
from functools import reduce | |||
order = 4 | |||
ratio = [1, 2] | |||
# the "shape" of the ratio, only input integers please. | |||
# [a, b] corresponds to the ratio 1:2^{a/(a+b)}:2, | |||
# [a, b, c] corresponds to the ratio 1:2^{a/(a+b+c)}:2^{(a+b)/(a+b+c)}:2, etc. | |||
c = ratio | |||
if order == 0: | |||
c = [] | |||
for i in range(0, order-1): | |||
b = [] | |||
for j in c: | |||
b.append([j * x for x in ratio]) | |||
c = [x for xs in b for x in xs] | |||
a = reduce((lambda m, n: m + [m[-1] + n]), c[1:], c[0:1]) | |||
print("scale steps in", a[len(a)-1], "edo:", c) | |||
print("scale degrees in", a[len(a)-1], "edo:", a) | |||
</syntaxhighlight> | |||
Sample output: | |||
<syntaxhighlight> | |||
scale steps in 81 edo: [1, 2, 2, 4, 2, 4, 4, 8, 2, 4, 4, 8, 4, 8, 8, 16] | |||
scale degrees in 81 edo: [1, 3, 5, 9, 11, 15, 19, 27, 29, 33, 37, 45, 49, 57, 65, 81] | |||
</syntaxhighlight> | |||
[[Category:Scale]] | [[Category:Scale]] |