Fractal scale: Difference between revisions

From Xenharmonic Wiki
Jump to navigation Jump to search
R-4981 (talk | contribs)
Fixed second example
Akselai (talk | contribs)
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.


{{todo|add examples|inline=1|comment=Create table with a simple example with a 3-step ratio.}}
{| 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 ==
{{todo|expand|inline=1|comment=Add formulas to calculate the steps and degrees of a given fractal scale, provided the order and the ratio.}}
 
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]]

Revision as of 22:41, 16 January 2024

English Wikipedia has an article on:

A fractal scale is a scale obtained by dividing a starting interval in two or more parts, and then by dividing these parts recursively using the same ratio. In practice, the starting interval is generally used as the period of the scale, allowing to use fractal scales as periodic scales. Fractal scales come in three main types, associated respectively with frequencies, pitch and length: linear fractal scales, defined using a ratio of frequency ratios; logarithmic fractal scales, defined using a ratio of logarithmic ratios (e.g. cents); and inverse linear fractal scales, defined using a ratio of length ratios.

The order of a fractal scale is the number of iterations of the division process used to obtain the scale. An order-0 fractal scale contains only the starting interval. An order-1 fractal scale contains the original ratio only once. An order-N scale with M steps in its division contains MN steps.

A fractal scale can be uniquely identified by its order, its ratio and its type. For example, the order-5 2:3:4 linear fractal scale is a 32-tone octave-repeating scale

Fractal scales provides a certain form of symmetry which is very different in nature than that of other scale families, such as MOS scales or regularly tempered scales.

Examples

Linear fractal scales

2:3:4 linear fractal scales
Order Number of steps Chord
0 1 1:2
1 2 2:3:4 (2afdo)
2 4 4:5:6:7:8 (4afdo)
3 8 8:9:10:11:12:13:14:15:16 (8afdo)
3:4:6 linear fractal scales
Order Number of steps Chord
0 1 1:2
1 2 3:4:6
2 4 9:10:12:14:18
3 8 27:28:30:32:36:38:42:46:54


Logarithmic fractal scales

A series of octave-repeating fractal scales can be created using the golden ratio (here treated as logarithmic phi) and the octave. Various edos approximate this series to a certain degree of precision. The example below uses the first nine terms of the Fibonacci sequence (1, 2, 3, 5, 8, 13, 21, 34, 55) to approximate golden fractal scales in 55edo.

Golden ([math]\displaystyle{ 1:2^{\phi-1}:2 }[/math]) logarithmic fractal scales, as approximated by 55edo
Order Number of steps Step visualization Step pattern (55edo) Scale degrees (55edo)
0 1 ├──────────────────────────────────────────────────────┤ 55 55
1 2 ├─────────────────────────────────┼────────────────────┤ 34 21 34 55
2 4 ├────────────────────┼────────────┼────────────┼───────┤ 21 13 13 8 21 34 47 55
3 8 ├────────────┼───────┼───────┼────┼───────┼────┼────┼──┤ 13 8 8 5 8 5 5 3 13 21 29 34 42 47 52 55
4 16 ├───────┼────┼────┼──┼────┼──┼──┼─┼────┼──┼──┼─┼──┼─┼─┼┤ 8 5 5 3 5 3 3 2 5 3 3 2 3 2 2 1 8 13 18 21 26 29 32 34 39 42 45 47 50 52 54 55

The fractal scale of [math]\displaystyle{ 1:\sqrt{2}:2 }[/math] is accurately consistent with edo to the power of 2 (e.g. 16edo).

R-4981 calls the order-4 [math]\displaystyle{ 1:2^{1/\sqrt{3}}:2 }[/math] fractal scale redbull.

The initial division may contain more than 2 intervals. Here is a simple example with 3 divisions.

[math]\displaystyle{ 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 degrees (55edo)
0 1 ├───────────────────────────────────────────────────────────────┤ 64 64
1 3 ├───────────────┼───────────────────────────────┼───────────────┤ 16 32 16 16 48 64
3 9 ├───┼───────┼───┼───────┼───────────────┼───────┼───┼───────┼───┤ 4 8 4 8 16 8 4 8 4 4 12 16 24 40 48 52 60 64
9 27 ├┼─┼┼─┼───┼─┼┼─┼┼─┼───┼─┼───┼───────┼───┼─┼───┼─┼┼─┼┼─┼───┼─┼┼─┼┤ 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

Todo: add examples

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]\displaystyle{ 1:2^a:2 }[/math] with [math]\displaystyle{ 1/2 \lt a \lt 1 }[/math] (like the golden logarithmic fractal scale above), then after N steps, the largest scale step will have size [math]\displaystyle{ 2^{aN} }[/math] and the smallest scale step will have size [math]\displaystyle{ 2^{(1-a)N} }[/math]. The ratio between the two is [math]\displaystyle{ 2^{(2a-1)N} \gt 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

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

Create table with a simple example.

Formulas

Here is a Python script to calculate the steps and degrees of a logarithmic fractal scale, provided the order and the ratio.

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)

Sample output:

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]