tonal-tools 8.6.0 → 8.7.0
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/midi.rb +2 -1
- data/lib/tonal/step.rb +16 -0
- 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: 65ae90958bc67835b5792e9d248eebf51ef5625f5bf3e1fa2da75064f76865d9
|
|
4
|
+
data.tar.gz: b9620ff46f3ded909da90d12af35326fa85387000f1432b768d8377b205f78c4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d73630cb8dec599a68d9f85731f676c3193d0f4f038f5757ace29a77ae8af65b5c74a5808f808605baa0e7392137b3200a4241b22f73870a788de4afb6c4f11a
|
|
7
|
+
data.tar.gz: 18977208ddb36b81b446e5559acf7e1618baf360fdf49f75b567e0c6407727077840846b0ce0ada874a428e1c2ae3d281abe484d4f0d27c115c905cc76c1b191
|
data/lib/tonal/attributions.rb
CHANGED
data/lib/tonal/midi.rb
CHANGED
|
@@ -4,6 +4,7 @@ module Tonal::Midi
|
|
|
4
4
|
|
|
5
5
|
REFERENCE_FREQUENCY = 440.0
|
|
6
6
|
A4_MIDI_NUMBER = 69
|
|
7
|
+
C4_MIDI_NUMBER = 60
|
|
7
8
|
|
|
8
9
|
attr_reader :number, :frequency
|
|
9
10
|
|
|
@@ -32,7 +33,7 @@ module Tonal::Midi
|
|
|
32
33
|
end
|
|
33
34
|
|
|
34
35
|
def <=>(other)
|
|
35
|
-
number <=> other.number
|
|
36
|
+
number <=> (other.kind_of?(self.class) ? other.number : other)
|
|
36
37
|
end
|
|
37
38
|
end
|
|
38
39
|
end
|
data/lib/tonal/step.rb
CHANGED
|
@@ -58,6 +58,22 @@ class Tonal::Scale
|
|
|
58
58
|
Tonal::Ratio.new(step, modulo)
|
|
59
59
|
end
|
|
60
60
|
|
|
61
|
+
# @return the [Tonal::Midi::Note] representation of the step
|
|
62
|
+
#
|
|
63
|
+
# @example
|
|
64
|
+
# Tonal::Scale::Step.new(ratio: 3/2r, modulo: 31).step_to_midi
|
|
65
|
+
# => 78
|
|
66
|
+
# Tonal::Scale::Step.new(ratio: 3/2r, modulo: 12).step_to_midi
|
|
67
|
+
# => 67
|
|
68
|
+
# Tonal::Scale::Step.new(ratio: 3/2r, modulo: 12).step_to_midi(midi_root: Tonal::Midi::Note::A4_MIDI_NUMBER)
|
|
69
|
+
# => 76
|
|
70
|
+
#
|
|
71
|
+
# @param midi_root [Integer] the MIDI number that corresponds to the 0 step of the scale. Default is C4 (60 MIDI).
|
|
72
|
+
#
|
|
73
|
+
def step_to_midi(midi_root: Tonal::Midi::Note::C4_MIDI_NUMBER)
|
|
74
|
+
Tonal::Midi::Note.new(number: step + midi_root)
|
|
75
|
+
end
|
|
76
|
+
|
|
61
77
|
# @return the [Rational] representation of the ratio of self
|
|
62
78
|
# @example
|
|
63
79
|
# Tonal::Scale::Step.new(ratio: 3/2r, modulo: 31).ratio_to_r
|
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
|
+
version: 8.7.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jose Hales-Garcia
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date: 2026-
|
|
10
|
+
date: 2026-06-02 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: yaml
|