coltrane 3.3.3 → 3.4.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/CHANGELOG.md +3 -0
- data/Gemfile.lock +1 -1
- data/bin/console +1 -0
- data/lib/coltrane/commands.rb +1 -0
- data/lib/coltrane/commands/find_guitar_chord.rb +25 -0
- data/lib/coltrane/representation/guitar.rb +7 -1
- data/lib/coltrane/representation/guitar/chord.rb +27 -1
- data/lib/coltrane/theory/chord_quality.rb +5 -5
- data/lib/coltrane/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3461b7ccf37f1b56926dd7e97ae10e1bb05b72c7b431706dc9bcfe621f583d78
|
4
|
+
data.tar.gz: d1e3cb3b4735ba4a06bb5ec10232812d729d45918159b6574f7c6b310556ce86
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0c4fed6840276e6c80e6ace57db61f66f69a69702792b98afadf72e8f59db135845e79fadd33a49f648e96d8dd2145e17ed99973780c76462b678d1a11a5629f
|
7
|
+
data.tar.gz: de98df40119044911a4e399e2ba4d985f4ba68ace17381fd3832f1db066b8600e01f0274b820aa5fdd146b2121d252eb1e240d6b83ab1f4be8adf6f1f9ea5fa8
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,9 @@
|
|
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.4.0]
|
9
|
+
- Adds `find-guitar-chord` command. It allows discovering a guitar chord name.
|
10
|
+
|
8
11
|
## [3.3.3]
|
9
12
|
- Fixes a bug in greek modes for accidental notes
|
10
13
|
|
data/Gemfile.lock
CHANGED
data/bin/console
CHANGED
data/lib/coltrane/commands.rb
CHANGED
@@ -0,0 +1,25 @@
|
|
1
|
+
module Coltrane
|
2
|
+
module Commands
|
3
|
+
class FindGuitarChord < Command
|
4
|
+
attr_reader :notation
|
5
|
+
|
6
|
+
def initialize(notation)
|
7
|
+
@notation = notation
|
8
|
+
end
|
9
|
+
|
10
|
+
def representation
|
11
|
+
Representation::Guitar.find_chord_by_notation(notation)
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.mercenary_init(program)
|
15
|
+
program.command(:'find-guitar-chord') do |c|
|
16
|
+
c.syntax 'find-guitar-chord x-2-2-4-5-x'
|
17
|
+
c.description 'find the chord name assuming the standard tuning (EADGBE)'
|
18
|
+
c.action do |(notation)|
|
19
|
+
new(notation).render
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -22,12 +22,18 @@ module Coltrane
|
|
22
22
|
Guitar::NoteSet.new(notes, guitar: new)
|
23
23
|
end
|
24
24
|
|
25
|
+
def self.find_chord_by_notation(chord_notation)
|
26
|
+
Guitar::Chord.find_by_notation(new, chord_notation)
|
27
|
+
end
|
28
|
+
|
25
29
|
def initialize(tuning: nil, frets: nil, special_frets: nil)
|
26
30
|
@tuning = tuning || %w[E2 A2 D3 G3 B3 E4]
|
27
31
|
@special_frets = special_frets || [3, 5, 7, 9, 12, 15, 17, 19]
|
28
32
|
@frets = frets || 23
|
29
33
|
|
30
|
-
@strings = @tuning.map
|
34
|
+
@strings = @tuning.map do |p|
|
35
|
+
String.new(Theory::Pitch[p], guitar: self)
|
36
|
+
end
|
31
37
|
end
|
32
38
|
end
|
33
39
|
end
|
@@ -17,6 +17,32 @@ module Coltrane
|
|
17
17
|
.reverse
|
18
18
|
end
|
19
19
|
|
20
|
+
def self.find_by_notation(guitar, chord_notation)
|
21
|
+
chord_notation
|
22
|
+
.split('-')
|
23
|
+
.map
|
24
|
+
.with_index do |n, i|
|
25
|
+
next if n == 'x'
|
26
|
+
n = Guitar::Note.new(guitar.strings[i], n.to_i).pitch.pitch_class
|
27
|
+
end
|
28
|
+
.yield_self do |notes|
|
29
|
+
notes
|
30
|
+
.map
|
31
|
+
.with_index do |note, index|
|
32
|
+
begin
|
33
|
+
Theory::Chord.new(notes: notes.rotate(index))
|
34
|
+
rescue Theory::ChordNotFoundError
|
35
|
+
next
|
36
|
+
end
|
37
|
+
end
|
38
|
+
.compact
|
39
|
+
.yield_self do |chords|
|
40
|
+
raise(Theory::ChordNotFoundError) if chords.empty?
|
41
|
+
chords.compact.uniq &:name
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
20
46
|
def initialize(target_chord,
|
21
47
|
guitar_notes: [],
|
22
48
|
free_fingers: 4,
|
@@ -183,4 +209,4 @@ module Coltrane
|
|
183
209
|
end
|
184
210
|
end
|
185
211
|
end
|
186
|
-
end
|
212
|
+
end
|
@@ -76,16 +76,16 @@ module Coltrane
|
|
76
76
|
|
77
77
|
def get_name
|
78
78
|
find_chord(retrieve_chord_intervals.compact) ||
|
79
|
-
|
80
|
-
|
81
|
-
|
79
|
+
find_chord(retrieve_chord_intervals(sus2_sequence).compact) ||
|
80
|
+
find_chord(retrieve_chord_intervals(sus4_sequence).compact) ||
|
81
|
+
raise(ChordNotFoundError)
|
82
82
|
end
|
83
83
|
|
84
84
|
def suspension_type
|
85
85
|
if has_major_second?
|
86
86
|
'sus2'
|
87
|
-
|
88
|
-
|
87
|
+
elsif has_fourth?
|
88
|
+
'sus4'
|
89
89
|
end
|
90
90
|
end
|
91
91
|
|
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.
|
4
|
+
version: 3.4.0
|
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-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tty-reader
|
@@ -179,6 +179,7 @@ files:
|
|
179
179
|
- lib/coltrane/commands/command.rb
|
180
180
|
- lib/coltrane/commands/common_chords.rb
|
181
181
|
- lib/coltrane/commands/errors.rb
|
182
|
+
- lib/coltrane/commands/find_guitar_chord.rb
|
182
183
|
- lib/coltrane/commands/find_progression.rb
|
183
184
|
- lib/coltrane/commands/find_scale.rb
|
184
185
|
- lib/coltrane/commands/notes.rb
|
@@ -265,7 +266,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
265
266
|
version: '0'
|
266
267
|
requirements: []
|
267
268
|
rubyforge_project:
|
268
|
-
rubygems_version: 2.7.
|
269
|
+
rubygems_version: 2.7.7
|
269
270
|
signing_key:
|
270
271
|
specification_version: 4
|
271
272
|
summary: It deals with all sorts of calculations around music theory and allows for
|