tonal-tools 6.1.0 → 6.1.1
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/irb_helpers.rb +1 -1
- data/lib/tonal/log.rb +3 -1
- data/lib/tonal/ratio.rb +7 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 50cbd332f2e7aeb3da776868cd3bd27cd3fd4f25146de194781fa1f8032a3e93
|
4
|
+
data.tar.gz: 3cddb6f9f59e814afface6e739597653442b13f402bf5839784decff633b4662
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 425f07aa55d053031df5bb092495ab88a82741964b3f56295868873b4a96e773ca0af9005352bdb289331d090331c8cb75c05aada7573db858b453002153a1fc
|
7
|
+
data.tar.gz: bb7871f1f9dcdcef36de328f9f839d50c9e9ceba6918b0d6bbd335a85803760461fb4a37a203149a3f7e629d53fcb3f80c56b1bd97d6249a781a0c433fd1ef23
|
data/lib/tonal/attributions.rb
CHANGED
data/lib/tonal/irb_helpers.rb
CHANGED
@@ -12,7 +12,7 @@ module Tonal
|
|
12
12
|
|
13
13
|
# @return [Tonal::ReducedRatio] a reduced ratio
|
14
14
|
# @example
|
15
|
-
#
|
15
|
+
# rr(3,3) => (1/1)
|
16
16
|
# @param arg1 the ratio if only argument provided, or the numerator if two argments are provided
|
17
17
|
# @param arg2 the denominator when two arguments are provided
|
18
18
|
#
|
data/lib/tonal/log.rb
CHANGED
@@ -4,6 +4,8 @@ class Tonal::Log
|
|
4
4
|
|
5
5
|
def_delegators :@logarithmand, :ratio, :to_ratio
|
6
6
|
|
7
|
+
PRECISION = 2
|
8
|
+
|
7
9
|
attr_reader :logarithmand, :logarithm, :base
|
8
10
|
|
9
11
|
# @return [Tonal::Log]
|
@@ -72,7 +74,7 @@ class Tonal::Log
|
|
72
74
|
# Tonal::Log.new(logarithmand: 3/2r, base: 2).inspect => "0.58"
|
73
75
|
#
|
74
76
|
def inspect
|
75
|
-
"#{logarithm.round(
|
77
|
+
"#{logarithm.round(PRECISION)}"
|
76
78
|
end
|
77
79
|
|
78
80
|
def <=>(rhs)
|
data/lib/tonal/ratio.rb
CHANGED
@@ -4,6 +4,8 @@ class Tonal::Ratio
|
|
4
4
|
|
5
5
|
def_delegators :@approximation, :neighborhood
|
6
6
|
|
7
|
+
PRECISION = 2
|
8
|
+
|
7
9
|
attr_reader :antecedent, :consequent, :equave, :reduced_antecedent, :reduced_consequent
|
8
10
|
|
9
11
|
# @return [Tonal::Ratio]
|
@@ -180,7 +182,7 @@ class Tonal::Ratio
|
|
180
182
|
# Tonal::Ratio.new(3,2).period_degrees => 210.59
|
181
183
|
# @param round
|
182
184
|
#
|
183
|
-
def period_degrees(round:
|
185
|
+
def period_degrees(round: PRECISION)
|
184
186
|
(360.0 * Math.log(to_f, equave)).round(round)
|
185
187
|
end
|
186
188
|
|
@@ -189,7 +191,7 @@ class Tonal::Ratio
|
|
189
191
|
# Tonal::Ratio.new(3,2).period_radians => 3.68
|
190
192
|
# @param round
|
191
193
|
#
|
192
|
-
def period_radians(round:
|
194
|
+
def period_radians(round: PRECISION)
|
193
195
|
(2 * Math::PI * Math.log(to_f, equave)).round(round)
|
194
196
|
end
|
195
197
|
|
@@ -313,7 +315,7 @@ class Tonal::Ratio
|
|
313
315
|
# Tonal::Ratio.new(3,2).planar_degrees => 33.69
|
314
316
|
# @param round
|
315
317
|
#
|
316
|
-
def planar_degrees(round:
|
318
|
+
def planar_degrees(round: PRECISION)
|
317
319
|
(Math.atan2(consequent, antecedent) * 180/Math::PI).round(round)
|
318
320
|
end
|
319
321
|
|
@@ -322,7 +324,7 @@ class Tonal::Ratio
|
|
322
324
|
# Tonal::Ratio.new(3,2).planar_radians => 0.59
|
323
325
|
# @param round
|
324
326
|
#
|
325
|
-
def planar_radians(round:
|
327
|
+
def planar_radians(round: PRECISION)
|
326
328
|
Math.atan2(consequent, antecedent).round(round)
|
327
329
|
end
|
328
330
|
|
@@ -468,7 +470,7 @@ class Tonal::Ratio
|
|
468
470
|
# Return label, if defined; or,
|
469
471
|
# Return the "antecedent/consequent", if antecedent is less than 7 digits long; or
|
470
472
|
# Return the floating point representation rounded to 2 digits of precision
|
471
|
-
(@label || ((Math.log10(antecedent).to_i + 1) <= 6 ? "#{antecedent}/#{consequent}" : to_f.round(
|
473
|
+
(@label || ((Math.log10(antecedent).to_i + 1) <= 6 ? "#{antecedent}/#{consequent}" : to_f.round(PRECISION))).to_s
|
472
474
|
end
|
473
475
|
|
474
476
|
# @return [String] the string representation of Tonal::Ratio
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tonal-tools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.1.
|
4
|
+
version: 6.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jose Hales-Garcia
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-01-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: yaml
|