tonal-tools 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/data/commas.yml +11 -0
- data/lib/tonal/comma.rb +17 -0
- data/lib/tonal/ratio.rb +1 -1
- data/lib/tonal/tools.rb +3 -0
- metadata +33 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 618bd26c11332eb200cf9b9bf8bb38f7956b1bc084d07f693ebe41f203839ccf
|
4
|
+
data.tar.gz: 2de816e7bd17637d912c31ebda7b2f93fb717e89caefc804805e4b0a786cee90
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c90617a5ecef6e01195e2e7d95f8d3588e068d119c5b4dbc602de97b5229086efc17e6de7a4e7c539d281693127d57225536bd259bcb435eeaba1e3646710f47
|
7
|
+
data.tar.gz: a64f852eab9bc77c7ccf5267a4b48999aa5860728191c8f13e67b0184de6b4766480a33415a82eadf3decfc07b9d804c49ad1c76c4b6fb82122a7b47454be903
|
data/data/commas.yml
ADDED
@@ -0,0 +1,11 @@
|
|
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
|
+
diaschisma: 2048/2025
|
9
|
+
dieses1: 648/625
|
10
|
+
dieses2: 128/125
|
11
|
+
septimal: 64/63
|
data/lib/tonal/comma.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
class Tonal::Comma
|
2
|
+
def self.commas
|
3
|
+
@commas ||= JSON.parse(YAML::load_file("#{__dir__}/../../data/commas.yml", aliases: true).to_json)["commas"]
|
4
|
+
end
|
5
|
+
|
6
|
+
def self.values
|
7
|
+
@values ||= commas.values.map(&:to_r)
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.keys
|
11
|
+
@keys ||= commas.keys
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.method_missing(comma)
|
15
|
+
commas[comma.to_s].to_r
|
16
|
+
end
|
17
|
+
end
|
data/lib/tonal/ratio.rb
CHANGED
@@ -469,7 +469,7 @@ class Tonal::Ratio
|
|
469
469
|
# Return label, if defined; or,
|
470
470
|
# Return the "antecedent/consequent", if antecedent is less than 7 digits long; or
|
471
471
|
# Return the floating point representation rounded to 2 digits of precision
|
472
|
-
@label || ((Math.log10(antecedent).to_i + 1) <= 6 ? "#{antecedent}/#{consequent}" : to_f.round(2))
|
472
|
+
(@label || ((Math.log10(antecedent).to_i + 1) <= 6 ? "#{antecedent}/#{consequent}" : to_f.round(2))).to_s
|
473
473
|
end
|
474
474
|
|
475
475
|
# @return [String] the string representation of Tonal::Ratio
|
data/lib/tonal/tools.rb
CHANGED
@@ -1,9 +1,12 @@
|
|
1
1
|
module Tonal
|
2
|
+
require "yaml"
|
3
|
+
require "json"
|
2
4
|
require "prime"
|
3
5
|
require "matrix"
|
4
6
|
require "sorted_set"
|
5
7
|
require "continued_fractions"
|
6
8
|
require "fraction_tree"
|
9
|
+
require "tonal/comma"
|
7
10
|
require "tonal/cents"
|
8
11
|
require "tonal/hertz"
|
9
12
|
require "tonal/log"
|
metadata
CHANGED
@@ -1,15 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tonal-tools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
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: 2023-12-
|
11
|
+
date: 2023-12-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: yaml
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.2'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.2'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: json
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '2.6'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '2.6'
|
13
41
|
- !ruby/object:Gem::Dependency
|
14
42
|
name: prime
|
15
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -129,8 +157,10 @@ executables: []
|
|
129
157
|
extensions: []
|
130
158
|
extra_rdoc_files: []
|
131
159
|
files:
|
160
|
+
- data/commas.yml
|
132
161
|
- lib/tonal/approximations.rb
|
133
162
|
- lib/tonal/cents.rb
|
163
|
+
- lib/tonal/comma.rb
|
134
164
|
- lib/tonal/extensions.rb
|
135
165
|
- lib/tonal/hertz.rb
|
136
166
|
- lib/tonal/interval.rb
|
@@ -153,7 +183,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
153
183
|
requirements:
|
154
184
|
- - ">="
|
155
185
|
- !ruby/object:Gem::Version
|
156
|
-
version:
|
186
|
+
version: 3.1.2
|
157
187
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
158
188
|
requirements:
|
159
189
|
- - ">="
|