tonal-tools 8.4.0 → 8.5.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f338aaedc8ca555cdd827f87d963b1d49c631ca1bcdc72b9679a3845f547ec1a
4
- data.tar.gz: 2792b60dc17116d627160be56b325c6301be6b62c5918b3e3a0461a2b909a7b2
3
+ metadata.gz: b2692d9bde2f36dbc28cae1f8e0a892af38e901939ad2e93561442c5d12df67d
4
+ data.tar.gz: 5b10622098df90d28d52c99037cc0eda5e834eeba1e200d63bb75dcf70ed811f
5
5
  SHA512:
6
- metadata.gz: 3eb756d61d8cd3e98cce4ecc2dfe9545120702d3bf782225c7f9ed83843d210c12588d6694467464d6d9ef1f1bade97b65dffc1d174fb054387a7f32df2d13e2
7
- data.tar.gz: 2a32319de368a22657d8d141c645f148715b74272b6be442ca36c7174b9a276b40e5450773bd4dfc45a61dd76e3b5d1b53121f5ef36f2b36829e3d2382f8b9df
6
+ metadata.gz: 18eff7addd0dcc1cba4d9a59a7272853e1bba9a22c13cb727989214542e5705d69134dfb27e61f31d975e0b344226abc9758c5b1d3074285baf68854fc2c07d7
7
+ data.tar.gz: 74c467d127fbcbb1c56f43530a3b1d6cbd9b7b7d9fa1f52ad44a443d5a2aef28c43f90b8e187039c4d79a31d32284cc4056c4d766dc1216c6d8db686918e4406
@@ -1,4 +1,4 @@
1
1
  module Tonal
2
2
  TOOLS_PRODUCER = "mTonal"
3
- TOOLS_VERSION = "8.4.0"
3
+ TOOLS_VERSION = "8.5.1"
4
4
  end
data/lib/tonal/cents.rb CHANGED
@@ -15,7 +15,7 @@ class Tonal::Cents
15
15
 
16
16
  # @return [Tonal::Cents]
17
17
  # @example
18
- # Tonal::Cents.new(ratio: 2**(2.0/12)) => 200.0
18
+ # Tonal::Cents.new(ratio: 2**(2.0/12)) => 200.0 ¢
19
19
  # @param cents [Numeric, Tonal::Log2]
20
20
  # @param log [Numeric, Tonal::Log2]
21
21
  # @param ratio [Numeric, Tonal::Log2]
@@ -45,7 +45,7 @@ class Tonal::Cents
45
45
 
46
46
  # @return [Tonal::Cents] the default cents tolerance
47
47
  # @example
48
- # Tonal::Cents.default_tolerance => 5
48
+ # Tonal::Cents.default_tolerance => 5 ¢
49
49
  #
50
50
  def self.default_tolerance
51
51
  self.new(cents: TOLERANCE)
@@ -53,7 +53,7 @@ class Tonal::Cents
53
53
 
54
54
  # @return [Float] value of self
55
55
  # @example
56
- # Tonal::Cents.new(ratio: 2**(1.0/12)).value => 100.00
56
+ # Tonal::Cents.new(ratio: 2**(1.0/12)).value => 100.00 ¢
57
57
  #
58
58
  def value(precision: @precision)
59
59
  @value.round(precision)
@@ -64,7 +64,7 @@ class Tonal::Cents
64
64
  # @return
65
65
  # [Tonal::Cents] nearest hundredth cent value
66
66
  # @example
67
- # Tonal::Cents.new(cents: 701.9550008653874).nearest_hundredth => 700.0
67
+ # Tonal::Cents.new(cents: 701.9550008653874).nearest_hundredth => 700.0 ¢
68
68
  #
69
69
  def nearest_hundredth
70
70
  self.class.new(cents: value.round(Tonal::Cents::HUNDREDTHS_ROUNDOFF).to_f)
@@ -73,7 +73,7 @@ class Tonal::Cents
73
73
  # @return
74
74
  # [Tonal::Cents] nearest hundredth cent difference
75
75
  # @example
76
- # Tonal::Cents.new(cents: 701.9550008653874).nearest_hundredth_difference => 1.96
76
+ # Tonal::Cents.new(cents: 701.9550008653874).nearest_hundredth_difference => 1.96 ¢
77
77
  #
78
78
  def nearest_hundredth_difference
79
79
  self.class.new(cents: (value - nearest_hundredth))
@@ -91,7 +91,7 @@ class Tonal::Cents
91
91
  # @return
92
92
  # [String] the string representation of Tonal::Cents
93
93
  # @example
94
- # Tonal::Cents.new(100.0).inspect => "100.0 ¢"
94
+ # Tonal::Cents.new(100.0).inspect => 100.0 ¢
95
95
  #
96
96
  def inspect
97
97
  "#{value.round(@precision)} ¢"
@@ -102,7 +102,7 @@ class Tonal::Cents
102
102
  #
103
103
  # @return [Tonal::Cents, Numeric] result of operation
104
104
  # @example
105
- # Tonal::Cents.new(cents: 200) - Tonal::Cents.new(cents: 100) => 100.0
105
+ # Tonal::Cents.new(cents: 200) - Tonal::Cents.new(cents: 100) => 100.0 ¢
106
106
  # @param rhs [Tonal::Cents, Numeric]
107
107
  #
108
108
  def -(rhs)
@@ -111,7 +111,7 @@ class Tonal::Cents
111
111
 
112
112
  # @return [Tonal::Cents, Numeric] result of operation
113
113
  # @example
114
- # Tonal::Cents.new(cents: 100) + Tonal::Cents.new(cents: 200) => 300.0
114
+ # Tonal::Cents.new(cents: 100) + Tonal::Cents.new(cents: 200) => 300.0 ¢
115
115
  # @param rhs [Tonal::Cents, Numeric]
116
116
  #
117
117
  def +(rhs)
@@ -120,7 +120,7 @@ class Tonal::Cents
120
120
 
121
121
  # @return [Tonal::Cents, Numeric] result of operation
122
122
  # @example
123
- # Tonal::Cents.new(cents: 200) * 2 => 400.0
123
+ # Tonal::Cents.new(cents: 200) * 2 => 400.0 ¢
124
124
  # @param rhs [Tonal::Cents, Numeric]
125
125
  #
126
126
  def *(rhs)
@@ -129,7 +129,7 @@ class Tonal::Cents
129
129
 
130
130
  # @return [Tonal::Cents, Numeric] result of operation
131
131
  # @example
132
- # Tonal::Cents.new(cents: 400) / 2 => 200.0
132
+ # Tonal::Cents.new(cents: 400) / 2 => 200.0 ¢
133
133
  # @param rhs [Tonal::Cents, Numeric]
134
134
  #
135
135
  def /(rhs)
data/lib/tonal/step.rb CHANGED
@@ -41,10 +41,12 @@ class Tonal::Scale
41
41
  # @return [Rational] of the step
42
42
  # @example
43
43
  # Tonal::Scale::Step.new(ratio: 3/2r, modulo: 31).step_to_r
44
- # => (6735213777669305/4503599627370496)
44
+ # => (18/31)
45
+ # Tonal::Scale::Step.new(ratio: 3/2r, modulo: 34).step_to_r
46
+ # => (10/17)
45
47
  #
46
48
  def step_to_r
47
- tempered.to_r
49
+ Rational(step, modulo)
48
50
  end
49
51
  alias :to_r :step_to_r
50
52
 
@@ -86,6 +88,15 @@ class Tonal::Scale
86
88
  end
87
89
  alias :cents_difference :efficiency
88
90
 
91
+ # @return [Boolean] true if the step is coprime to the modulo
92
+ # @example
93
+ # Tonal::Scale::Step.new(step: 5, modulo: 12).coprime? => true
94
+ # Tonal::Scale::Step.new(step: 6, modulo: 12).coprime? => false
95
+ #
96
+ def coprime?
97
+ step.coprime?(modulo)
98
+ end
99
+
89
100
  def +(rhs)
90
101
  self.class.new(step: (rhs % modulo), modulo: modulo)
91
102
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tonal-tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.4.0
4
+ version: 8.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jose Hales-Garcia
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2026-04-16 00:00:00.000000000 Z
10
+ date: 2026-05-03 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  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: 4.0.8
195
+ rubygems_version: 4.0.11
196
196
  specification_version: 4
197
197
  summary: Tonal tools
198
198
  test_files: []