tonal-tools 5.1.2 → 5.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 83c904daf57681752be14329c6cd8630d700561d6184cb84705b908694b6f944
4
- data.tar.gz: d64f5204212366b729be2f30609031aa50e8046d16c671f883d4957b0d2a8ad8
3
+ metadata.gz: 6f6428a7770578a48111345ec79e8741fd778006eb9c66bfa2c9ff9d06df4f58
4
+ data.tar.gz: 91c2f7bee770fc580cdaf4de02c900fb695d54ae2caefd0349c513503332b2cf
5
5
  SHA512:
6
- metadata.gz: 1e8d2d083e168674ede2557213f36e722fced30e775d8ca4b52496005b7a317d8fa1ecb30ea4255e09049deb43b6c31b3b68a83b82ecbc19bd8d274cbdfc37bb
7
- data.tar.gz: 632412ee397215fd1ee8eae32e412374a6b91d9432ec51cb047caeafe135347116f670b4da377d2f0031a89557911e6b7a8b0a1e3e57acb231235068f684c3a8
6
+ metadata.gz: 890641d771c7c9ca7c83ba0a70ea584988acc76db3954563e7b924ee2ef861d6fed5da0ef2a0168a8ff36139e0896715d00392bd9cb2b1324a3cd32bf6ea1653
7
+ data.tar.gz: ba54c2cbf7073d3d6453e92107b63f4c530d8faeb77acb326f7cea18937c20966c56d2d8c4b1c73ede57f744b47fd88fbec88b335e92f9b6cea119f791393b22
@@ -41,28 +41,6 @@ class Tonal::Ratio
41
41
  end
42
42
  end
43
43
 
44
- # @return [Tonal::Ratio::Approximation::Set] of ratios within cent tolerance of self found using a quotient walk on the fraction tree
45
- # @example
46
- # Tonal::Ratio.ed(12,1).approximate.by_quotient_walk(max_prime: 89)
47
- # => (4771397596969315/4503599627370496): [(17/16), (18/17), (35/33), (53/50), (71/67), (89/84), (196/185)]
48
- # @param cents_tolerance the cents tolerance used to scope the collection
49
- # @param depth the maximum number of ratios in the collection
50
- # @param max_prime the maximum prime number to allow in the collection
51
- # @param conv_limit the number of convergents to limit the ContinuedFraction method
52
- #
53
- def by_quotient_walk(cents_tolerance: Tonal::Cents::TOLERANCE, depth: DEFAULT_FRACTION_TREE_DEPTH, max_prime: DEFAULT_MAX_PRIME, conv_limit: CONVERGENT_LIMIT)
54
- self_in_cents = to_cents
55
- within = cents_tolerance.kind_of?(Tonal::Cents) ? cents_tolerance : Tonal::Cents.new(cents: cents_tolerance)
56
-
57
- Set.new(ratio: ratio) do |ratios|
58
- FractionTree.quotient_walk(to_f, limit: conv_limit).each do |node|
59
- ratio2 = ratio.class.new(node.weight)
60
- ratios << ratio2 if ratio.class.within_cents?(self_in_cents, ratio2.to_cents, within) && ratio2.within_prime?(max_prime)
61
- break if ratios.length >= depth
62
- end
63
- end
64
- end
65
-
66
44
  # @return [Tonal::Ratio::Approximation::Set] of fraction tree ratios within cent tolerance of self
67
45
  # @example
68
46
  # Tonal::Ratio.ed(12,1).approximate.by_tree_path(max_prime: 17)
@@ -75,8 +53,8 @@ class Tonal::Ratio
75
53
  self_in_cents = to_cents
76
54
  within = cents_tolerance.kind_of?(Tonal::Cents) ? cents_tolerance : Tonal::Cents.new(cents: cents_tolerance)
77
55
  Set.new(ratio: ratio) do |ratios|
78
- FractionTree.path_to(to_f).each do |node|
79
- ratio2 = ratio.class.new(node.weight)
56
+ FractionTree.node(to_f).path.each do |node|
57
+ ratio2 = ratio.class.new(node.number)
80
58
  ratios << ratio2 if ratio.class.within_cents?(self_in_cents, ratio2.to_cents, within) && ratio2.within_prime?(max_prime)
81
59
  break if ratios.length >= depth
82
60
  end
@@ -1,4 +1,4 @@
1
1
  module Tonal
2
2
  TOOLS_PRODUCER = "mTonal"
3
- TOOLS_VERSION = "5.1.2"
3
+ TOOLS_VERSION = "5.1.4"
4
4
  end
@@ -32,7 +32,7 @@ class Numeric
32
32
  # @return [Array] a tuple of self divided and multiplied by factor
33
33
  # @example
34
34
  # Math::PI.div_times(3) => [1.0471975511965976, 9.42477796076938]
35
- # @param [Numeric]
35
+ # @param factor [Numeric]
36
36
  #
37
37
  def div_times(factor) = [self / factor, self * factor]
38
38
 
@@ -329,7 +329,7 @@ class Array
329
329
  # @return [Tonal::ReducedRatio] ratio reconstructed from the result of a prime factor decomposition
330
330
  # @example
331
331
  # [[[3, 1]], [[2, 1]]].ratio_from_prime_divisions => (3/2)
332
- # @reduced [Boolean] if a reduced or unreduced ratio is returned
332
+ # @param reduced [Boolean] if a reduced or unreduced ratio is returned
333
333
  #
334
334
  def ratio_from_prime_divisions(reduced: false) = reduced ? Tonal::ReducedRatio.new(Prime.int_from_prime_division(self.first), Prime.int_from_prime_division(self.last)) : Tonal::Ratio.new(Prime.int_from_prime_division(self.first), Prime.int_from_prime_division(self.last))
335
335
 
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: 5.1.2
4
+ version: 5.1.4
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: 2024-07-31 00:00:00.000000000 Z
11
+ date: 2024-09-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: yaml
@@ -100,14 +100,14 @@ dependencies:
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '1.1'
103
+ version: '2.1'
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '1.1'
110
+ version: '2.1'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: rspec
113
113
  requirement: !ruby/object:Gem::Requirement
@@ -192,7 +192,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
192
192
  - !ruby/object:Gem::Version
193
193
  version: '3.1'
194
194
  requirements: []
195
- rubygems_version: 3.5.9
195
+ rubygems_version: 3.5.20
196
196
  signing_key:
197
197
  specification_version: 4
198
198
  summary: Tonal tools