tonal-tools 5.0.1 → 5.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 71f085a27fce9f25e0dab185ae58880802186931c3946a39d41e9e975d2fb138
4
- data.tar.gz: f4bb5d1c1778aa14b8dd35080be434f409f711a6bd515893276209c338cb4c60
3
+ metadata.gz: 83c904daf57681752be14329c6cd8630d700561d6184cb84705b908694b6f944
4
+ data.tar.gz: d64f5204212366b729be2f30609031aa50e8046d16c671f883d4957b0d2a8ad8
5
5
  SHA512:
6
- metadata.gz: 28328c475862c7a51e34d6ea9cfeabe3ede92f7716515bf7ca514c4cff2a1e07fba240fd76a0ad98fc96c0c07b2fc15c047df31b957b032956805da3cbf862d0
7
- data.tar.gz: 25b3b997fd617897c43f1d543424581a36f4d26f06c05fbc28ae7b7a6d1b1d53e13c97761380da36f9e8a9160b1124edf85d81aeb4a2aec527646c096ecb1b46
6
+ metadata.gz: 1e8d2d083e168674ede2557213f36e722fced30e775d8ca4b52496005b7a317d8fa1ecb30ea4255e09049deb43b6c31b3b68a83b82ecbc19bd8d274cbdfc37bb
7
+ data.tar.gz: 632412ee397215fd1ee8eae32e412374a6b91d9432ec51cb047caeafe135347116f670b4da377d2f0031a89557911e6b7a8b0a1e3e57acb231235068f684c3a8
data/data/commas.yml CHANGED
@@ -1,11 +1,13 @@
1
1
  commas:
2
- # Interval between two enharmonically equivalent notes, as B# and C, in the Pythogorean tuning. ~23 cents
3
- ditonic: 531441/524288
4
- # The interval between a just major third (5:4) and a Pythogorean third (81:64). ~22 cents
5
- syntonic: 81/80
6
- # Difference between the syntonic and ditonic commas. ~2 cents
7
- schisma: 32805/32768
8
2
  diaschisma: 2048/2025
3
+ # Interval between 16/15 and 10/9, 27/25 and 9/8, 6/5 and 5/4, 8/5 and 5/3, 16/9 and 50/27, 9/5 and 15/8. ~71¢
4
+ dicot: 25/24
9
5
  dieses1: 648/625
10
6
  dieses2: 128/125
11
- septimal: 64/63
7
+ # Interval between two enharmonically equivalent notes, as B# and C, in the Pythogorean tuning. ~23¢
8
+ ditonic: 531441/524288
9
+ # Difference between the syntonic and ditonic commas. ~2¢
10
+ schisma: 32805/32768
11
+ septimal: 64/63
12
+ # The interval between a just major third (5:4) and a Pythogorean third (81:64). ~22¢
13
+ syntonic: 81/80
@@ -4,6 +4,9 @@ class Tonal::Ratio
4
4
  DEFAULT_MAX_GRID_SCALE = 100
5
5
  DEFAULT_MAX_GRID_BOUNDARY = 5
6
6
  DEFAULT_DEPTH = Float::INFINITY
7
+ DEFAULT_FRACTION_TREE_DEPTH = 10
8
+ DEFAULT_SUPERPART_DEPTH = 20
9
+ DEFAULT_NEIGHBORHOOD_DEPTH = 10
7
10
  DEFAULT_COMPLEXITY_AMOUNT = 50.0
8
11
  CONVERGENT_LIMIT = 10
9
12
 
@@ -47,7 +50,7 @@ class Tonal::Ratio
47
50
  # @param max_prime the maximum prime number to allow in the collection
48
51
  # @param conv_limit the number of convergents to limit the ContinuedFraction method
49
52
  #
50
- def by_quotient_walk(cents_tolerance: Tonal::Cents::TOLERANCE, depth: DEFAULT_DEPTH, max_prime: DEFAULT_MAX_PRIME, conv_limit: CONVERGENT_LIMIT)
53
+ def by_quotient_walk(cents_tolerance: Tonal::Cents::TOLERANCE, depth: DEFAULT_FRACTION_TREE_DEPTH, max_prime: DEFAULT_MAX_PRIME, conv_limit: CONVERGENT_LIMIT)
51
54
  self_in_cents = to_cents
52
55
  within = cents_tolerance.kind_of?(Tonal::Cents) ? cents_tolerance : Tonal::Cents.new(cents: cents_tolerance)
53
56
 
@@ -68,7 +71,7 @@ class Tonal::Ratio
68
71
  # @param depth the maximum number of ratios in the collection
69
72
  # @param max_prime the maximum prime number to allow in the collection
70
73
  #
71
- def by_tree_path(cents_tolerance: Tonal::Cents::TOLERANCE, depth: DEFAULT_DEPTH, max_prime: DEFAULT_MAX_PRIME)
74
+ def by_tree_path(cents_tolerance: Tonal::Cents::TOLERANCE, depth: DEFAULT_FRACTION_TREE_DEPTH, max_prime: DEFAULT_MAX_PRIME)
72
75
  self_in_cents = to_cents
73
76
  within = cents_tolerance.kind_of?(Tonal::Cents) ? cents_tolerance : Tonal::Cents.new(cents: cents_tolerance)
74
77
  Set.new(ratio: ratio) do |ratios|
@@ -89,7 +92,7 @@ class Tonal::Ratio
89
92
  # @param max_prime the maximum prime number to allow in the collection
90
93
  # @param superpart if the superior part is the numerator or denominator
91
94
  #
92
- def by_superparticular(cents_tolerance: Tonal::Cents::TOLERANCE, depth: 20, max_prime: DEFAULT_MAX_PRIME, superpart: :upper)
95
+ def by_superparticular(cents_tolerance: Tonal::Cents::TOLERANCE, depth: DEFAULT_SUPERPART_DEPTH, max_prime: DEFAULT_MAX_PRIME, superpart: :upper)
93
96
  self_in_cents = to_cents
94
97
  within = cents_tolerance.kind_of?(Tonal::Cents) ? cents_tolerance : Tonal::Cents.new(cents: cents_tolerance)
95
98
  Set.new(ratio: ratio) do |ratios|
@@ -113,7 +116,7 @@ class Tonal::Ratio
113
116
  # @param max_boundary the maximum distance grid ratios will be from the scaled ratio
114
117
  # @param max_scale the maximum self will be scaled
115
118
  #
116
- def by_neighborhood(cents_tolerance: Tonal::Cents::TOLERANCE, depth: DEFAULT_DEPTH, max_prime: DEFAULT_MAX_PRIME, max_boundary: DEFAULT_MAX_GRID_BOUNDARY, max_scale: DEFAULT_MAX_GRID_SCALE)
119
+ def by_neighborhood(cents_tolerance: Tonal::Cents::TOLERANCE, depth: DEFAULT_NEIGHBORHOOD_DEPTH, max_prime: DEFAULT_MAX_PRIME, max_boundary: DEFAULT_MAX_GRID_BOUNDARY, max_scale: DEFAULT_MAX_GRID_SCALE)
117
120
  self_in_cents = to_cents
118
121
  within = cents_tolerance.kind_of?(Tonal::Cents) ? cents_tolerance : Tonal::Cents.new(cents: cents_tolerance)
119
122
  Set.new(ratio: ratio) do |ratios|
@@ -1,4 +1,4 @@
1
1
  module Tonal
2
2
  TOOLS_PRODUCER = "mTonal"
3
- TOOLS_VERSION = "5.0.1"
3
+ TOOLS_VERSION = "5.1.2"
4
4
  end
data/lib/tonal/cents.rb CHANGED
@@ -56,6 +56,7 @@ class Tonal::Cents
56
56
  @value.round(precision)
57
57
  end
58
58
  alias :cents :value
59
+ alias :to_f :value
59
60
 
60
61
  # @return
61
62
  # [Tonal::Cents] nearest hundredth cent value
@@ -92,6 +93,7 @@ class Tonal::Cents
92
93
  def inspect
93
94
  "#{value.round(@precision)}"
94
95
  end
96
+ alias :to_s :inspect
95
97
 
96
98
  #
97
99
  # Challenges to comparing floats
data/lib/tonal/comma.rb CHANGED
@@ -2,9 +2,9 @@ class Tonal::Comma
2
2
  # @return [Hash] of comma key/value pairs
3
3
  # @example
4
4
  # Tonal::Comma.commas
5
- # => {"ditonic"=>"531441/524288",
6
- # "syntonic"=>"81/80",
7
- # "schisma"=>"32805/32768",
5
+ # => {"diaschisma"=>"2048/2025",
6
+ # "dicot"=>"25/24",
7
+ # "dieses1"=>"648/625",
8
8
  # ...}
9
9
  #
10
10
  def self.commas
@@ -14,10 +14,7 @@ class Tonal::Comma
14
14
  # @return [Array] of comma values
15
15
  # @example
16
16
  # Tonal::Comma.values
17
- # => [(531441/524288),
18
- # (81/80),
19
- # (32805/32768),
20
- # ...]
17
+ # => [(2048/2025), (25/24), (648/625), ...]
21
18
  #
22
19
  def self.values
23
20
  @values ||= commas.values.map(&:to_r)
@@ -26,10 +23,7 @@ class Tonal::Comma
26
23
  # @return [Array] of comma keys
27
24
  # @example
28
25
  # Tonal::Comma.keys
29
- # => ["ditonic",
30
- # "syntonic",
31
- # "schisma",
32
- # ...]
26
+ # => ["diaschisma", "dicot", "dieses1", ...]
33
27
  #
34
28
  def self.keys
35
29
  @keys ||= commas.keys
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.0.1
4
+ version: 5.1.2
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-03-23 00:00:00.000000000 Z
11
+ date: 2024-07-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: yaml
@@ -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.6
195
+ rubygems_version: 3.5.9
196
196
  signing_key:
197
197
  specification_version: 4
198
198
  summary: Tonal tools