coltrane 3.3.1 → 3.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 875bc7bd199ea9861cfaad5aceb0f9ccc8005d7617fe84cb6767ed4aa8d47972
4
- data.tar.gz: 6e0b3af6769f03290b2c5efccede1e92a7a479324af3907005bd0e1a5c8476cb
3
+ metadata.gz: 3fe037a225ee4b1d95347b454262b9f97a89b457a4d9512f2bb494c61492587a
4
+ data.tar.gz: 983e49a02cbaeb9d1451f060350f9af1e3bbb9bfeab4149456d8b216e5bb8729
5
5
  SHA512:
6
- metadata.gz: f84e7beafef420b8f0178e0e2e07779018f55725a40123deeaa8a1a4bc8b8a883a13b2e3432a47ea2fe8162df4325a1a6b712df12d4abac40a114d66e0da2ad0
7
- data.tar.gz: 0f1a2d26f22f7692d867dcdf5d014043bc5e347bcd78a6e777415c7b5c9bb43860a1211808ef3f3424a1bd4f3732b15d30c64b7e04c72173c2249e869c0e7497
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.1)
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.5)
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)
@@ -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
- GREEK_MODES.each_with_index do |mode, index|
38
- mode_name = mode
39
- mode_n = index + 1
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
- end
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 major
42
+ alias diatonic major
55
43
  alias natural_minor minor
56
- alias pentatonic pentatonic_major
57
- alias blues blues_major
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 = ::ClassicScales::SCALES.key(is.rotate(i)))
48
+ if (scale_name = ClassicScales::SCALES.key(is.rotate(i)))
49
49
  return scale_name
50
50
  end
51
51
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Coltrane
4
- VERSION = '3.3.1'
4
+ VERSION = '3.3.2'
5
5
  end
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.1
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-13 00:00:00.000000000 Z
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