coltrane 3.3.1 → 3.3.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 +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +2 -2
- data/lib/coltrane/theory.rb +1 -0
- data/lib/coltrane/theory/classic_scales.rb +7 -19
- data/lib/coltrane/theory/greek_mode.rb +47 -0
- data/lib/coltrane/theory/scale.rb +1 -1
- data/lib/coltrane/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3fe037a225ee4b1d95347b454262b9f97a89b457a4d9512f2bb494c61492587a
|
4
|
+
data.tar.gz: 983e49a02cbaeb9d1451f060350f9af1e3bbb9bfeab4149456d8b216e5bb8729
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 04c66aa471f914b9c061b55d083915888efe873ac6eec8b4efb3c4f62e335e16090126661b1f68e54a4c32dce0143fb3fd15936c2256cf1f83cd5a2fc6b516b7
|
7
|
+
data.tar.gz: 63c1c79f57ace4dabcf4f8a010d7f30ac32fee0f0a7469a8f79b6f549ed88d29eadf2c3065a6febc85d867ea5eb82c4a8fd15f54f22bf6fde502134bf460cb74
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,10 @@
|
|
5
5
|
- Fix chords so that they generate a barre and a non-barre version and prevent
|
6
6
|
barre chords from picking notes before the barre.
|
7
7
|
|
8
|
+
## [3.3.2]
|
9
|
+
- Fixes greek modes so now they output correct sharps/flats
|
10
|
+
- Adds a coherence criteria for picking best guitar chords (based on distance between freqs.)
|
11
|
+
|
8
12
|
## [3.2.0]
|
9
13
|
- Adds custom_guitar and custom_guitar_frets
|
10
14
|
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
coltrane (3.3.
|
4
|
+
coltrane (3.3.2)
|
5
5
|
color (~> 1.8)
|
6
6
|
dry-monads (~> 0.4)
|
7
7
|
paint (~> 2.0)
|
@@ -18,7 +18,7 @@ GEM
|
|
18
18
|
concurrent-ruby (1.0.5)
|
19
19
|
diff-lcs (1.3)
|
20
20
|
docile (1.3.0)
|
21
|
-
dry-core (0.4.
|
21
|
+
dry-core (0.4.6)
|
22
22
|
concurrent-ruby (~> 1.0)
|
23
23
|
dry-equalizer (0.2.1)
|
24
24
|
dry-monads (0.4.0)
|
data/lib/coltrane/theory.rb
CHANGED
@@ -42,6 +42,7 @@ module Coltrane
|
|
42
42
|
autoload :ScaleSet, 'coltrane/theory/scale_set'
|
43
43
|
autoload :CircleOfFifths, 'coltrane/theory/circle_of_fifths'
|
44
44
|
autoload :DiatonicScale, 'coltrane/theory/diatonic_scale'
|
45
|
+
autoload :GreekMode, 'coltrane/theory/greek_mode'
|
45
46
|
autoload :Key, 'coltrane/theory/key'
|
46
47
|
|
47
48
|
autoload :NotableProgressions, 'coltrane/theory/notable_progressions'
|
@@ -16,16 +16,6 @@ module Coltrane
|
|
16
16
|
'Chromatic' => [1] * 12
|
17
17
|
}.freeze
|
18
18
|
|
19
|
-
GREEK_MODES = %w[
|
20
|
-
Ionian
|
21
|
-
Dorian
|
22
|
-
Phrygian
|
23
|
-
Lydian
|
24
|
-
Mixolydian
|
25
|
-
Aeolian
|
26
|
-
Locrian
|
27
|
-
].freeze
|
28
|
-
|
29
19
|
# Creates factories for scales
|
30
20
|
SCALES.each do |name, distances|
|
31
21
|
define_method name.underscore do |tone = 'C', mode = 1|
|
@@ -34,13 +24,11 @@ module Coltrane
|
|
34
24
|
end
|
35
25
|
|
36
26
|
# Creates factories for Greek Modes
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
define_method mode.underscore do |tone = 'C'|
|
41
|
-
new(notes: DiatonicScale.new(tone).notes.rotate(index))
|
27
|
+
class_eval(GreekMode::MODES.each_with_index.reduce('') { |code, (mode, index)| code + <<-RUBY }, __FILE__, __LINE__ + 1)
|
28
|
+
def #{mode.underscore}(tone = 'C')
|
29
|
+
GreekMode.new(:#{mode.underscore.to_sym}, tone)
|
42
30
|
end
|
43
|
-
|
31
|
+
RUBY
|
44
32
|
|
45
33
|
# Factories for the diatonic scale
|
46
34
|
def major(note = 'C')
|
@@ -51,10 +39,10 @@ module Coltrane
|
|
51
39
|
DiatonicScale.new(note, major: false)
|
52
40
|
end
|
53
41
|
|
54
|
-
alias diatonic
|
42
|
+
alias diatonic major
|
55
43
|
alias natural_minor minor
|
56
|
-
alias pentatonic
|
57
|
-
alias blues
|
44
|
+
alias pentatonic pentatonic_major
|
45
|
+
alias blues blues_major
|
58
46
|
|
59
47
|
def known_scales
|
60
48
|
SCALES.keys + ['Major', 'Natural Minor']
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module Coltrane
|
2
|
+
module Theory
|
3
|
+
class GreekMode < Scale
|
4
|
+
attr_reader :mode
|
5
|
+
|
6
|
+
MODES = %w[
|
7
|
+
Ionian
|
8
|
+
Dorian
|
9
|
+
Phrygian
|
10
|
+
Lydian
|
11
|
+
Mixolydian
|
12
|
+
Aeolian
|
13
|
+
Locrian
|
14
|
+
].freeze
|
15
|
+
|
16
|
+
LETTER_SEQUENCE = %w[C D E F G A B].freeze
|
17
|
+
|
18
|
+
def initialize(mode, tone)
|
19
|
+
super name: mode.capitalize, notes: begin
|
20
|
+
@mode = mode.to_s
|
21
|
+
@tone = tone
|
22
|
+
# binding.pry
|
23
|
+
base_major_notes
|
24
|
+
.rotate(mode_index)
|
25
|
+
.zip(letter_sequence)
|
26
|
+
.map { |(note, letter)| note.as(letter) }
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
def letter_sequence
|
33
|
+
LETTER_SEQUENCE.yield_self { |seq| seq.rotate(seq.index(tone))}
|
34
|
+
end
|
35
|
+
|
36
|
+
def mode_index
|
37
|
+
@mode_index ||= MODES.map(&:downcase).index(mode.to_s)
|
38
|
+
end
|
39
|
+
|
40
|
+
def base_major_notes
|
41
|
+
base_scale = DiatonicScale.new(Note['C']).notes
|
42
|
+
base_interval = base_scale[0] - base_scale[mode_index]
|
43
|
+
DiatonicScale.new(Note[tone] - base_interval).notes
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -45,7 +45,7 @@ module Coltrane
|
|
45
45
|
@name ||= begin
|
46
46
|
is = interval_sequence.relative_intervals
|
47
47
|
(0...is.size).each do |i|
|
48
|
-
if (scale_name =
|
48
|
+
if (scale_name = ClassicScales::SCALES.key(is.rotate(i)))
|
49
49
|
return scale_name
|
50
50
|
end
|
51
51
|
end
|
data/lib/coltrane/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: coltrane
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.3.
|
4
|
+
version: 3.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pedro Maciel
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-05-
|
11
|
+
date: 2018-05-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tty-reader
|
@@ -223,6 +223,7 @@ files:
|
|
223
223
|
- lib/coltrane/theory/errors.rb
|
224
224
|
- lib/coltrane/theory/frequency.rb
|
225
225
|
- lib/coltrane/theory/frequency_interval.rb
|
226
|
+
- lib/coltrane/theory/greek_mode.rb
|
226
227
|
- lib/coltrane/theory/interval.rb
|
227
228
|
- lib/coltrane/theory/interval_class.rb
|
228
229
|
- lib/coltrane/theory/interval_sequence.rb
|