tonal-tools 8.5.1 → 8.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/tonal/attributions.rb +1 -1
- data/lib/tonal/step.rb +15 -8
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d35ccfb34bc36393de62b66954048131b48eff9a9aa0c3af8c9f5d97d79d8406
|
|
4
|
+
data.tar.gz: 16b2e4235caeaf796ddd7ceec8e6b881eb2291b4ec0f7f6389ac2faaca1fe243
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6849510f855a326970cf7a7ad4ee619b05251b15331659192c4a7d1cf17a08eb64cdd55e70232300587f6f263cb906ddde329fba2d7923002b34f303f1ee4bd1
|
|
7
|
+
data.tar.gz: ab77a51fb2c82acf98fb1b65b1d33ace5baac0fbfc4c823140fb1a746995468f8cf3621824af17b07f0f099300dd7b4b244da4578711705e8a62f9d22c1976cd
|
data/lib/tonal/attributions.rb
CHANGED
data/lib/tonal/step.rb
CHANGED
|
@@ -48,7 +48,15 @@ class Tonal::Scale
|
|
|
48
48
|
def step_to_r
|
|
49
49
|
Rational(step, modulo)
|
|
50
50
|
end
|
|
51
|
-
|
|
51
|
+
|
|
52
|
+
# @return [Tonal::Ratio] of the step/modulo
|
|
53
|
+
# @example
|
|
54
|
+
# Tonal::Scale::Step.new(ratio: 3/2r, modulo: 31).step_to_ratio
|
|
55
|
+
# => 18/31
|
|
56
|
+
#
|
|
57
|
+
def step_to_ratio
|
|
58
|
+
Tonal::Ratio.new(step, modulo)
|
|
59
|
+
end
|
|
52
60
|
|
|
53
61
|
# @return [Rational] of the ratio
|
|
54
62
|
# @example
|
|
@@ -59,15 +67,14 @@ class Tonal::Scale
|
|
|
59
67
|
ratio.to_r
|
|
60
68
|
end
|
|
61
69
|
|
|
62
|
-
# @return [Tonal::Cents] measure of
|
|
70
|
+
# @return [Tonal::Cents] measure of tempered in cents
|
|
63
71
|
# @example
|
|
64
|
-
# Tonal::Scale::Step.new(ratio: 3/2r, modulo: 31).
|
|
72
|
+
# Tonal::Scale::Step.new(ratio: 3/2r, modulo: 31).tempered_to_cents
|
|
65
73
|
# => 696.77
|
|
66
74
|
#
|
|
67
|
-
def
|
|
75
|
+
def tempered_to_cents
|
|
68
76
|
tempered.to_cents
|
|
69
77
|
end
|
|
70
|
-
alias :to_cents :step_to_cents
|
|
71
78
|
|
|
72
79
|
# @return [Tonal::Cents] measure of ratio in cents
|
|
73
80
|
# @example
|
|
@@ -78,13 +85,13 @@ class Tonal::Scale
|
|
|
78
85
|
ratio.to_cents
|
|
79
86
|
end
|
|
80
87
|
|
|
81
|
-
# @return [Tonal::Cents] the difference between the
|
|
88
|
+
# @return [Tonal::Cents] the difference between the tempered number and the ratio
|
|
82
89
|
# @example
|
|
83
90
|
# Tonal::Scale::Step.new(ratio: 3/2r, modulo: 31).efficiency => 5.19 ¢
|
|
84
91
|
#
|
|
85
92
|
def efficiency
|
|
86
|
-
# We want the efficiency from the step (self). The
|
|
87
|
-
ratio_to_cents -
|
|
93
|
+
# We want the efficiency from the step (self). The tempered value is the tempered approximation of the ratio, so we want to know how far off the step is from the ratio. So we take the ratio and subtract the tempered value.
|
|
94
|
+
ratio_to_cents - tempered_to_cents
|
|
88
95
|
end
|
|
89
96
|
alias :cents_difference :efficiency
|
|
90
97
|
|