coltrane 3.0.0.rc1 → 3.0.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/Gemfile +1 -2
- data/Gemfile.lock +4 -34
- data/README.md +2 -2
- data/coltrane.gemspec +1 -2
- data/lib/coltrane/commands/chords.rb +16 -9
- data/lib/coltrane/commands/command.rb +8 -2
- data/lib/coltrane/commands/notes.rb +1 -0
- data/lib/coltrane/commands/progression.rb +1 -0
- data/lib/coltrane/commands/scale.rb +2 -1
- data/lib/coltrane/theory/notable_progressions.rb +7 -7
- data/lib/coltrane/version.rb +1 -1
- metadata +5 -20
- data/lib/coltrane/commands/representation.rb +0 -41
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 24aa3d9be0bb2cdecadedb502c16276e1d749cb59cd0e58be75ec92ba49e61f7
|
|
4
|
+
data.tar.gz: b5cb786fc245433adec30d304aa13017a975bf031802082f82a43738e2e7ccfb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f8364216d8f087301c4d9576f5f2722e6635a194e8bd4910d2114ff68bd79dbc1091a5a894680dc11e004063132d6add3bb5f43029dd6391b147db1ffc1c723a
|
|
7
|
+
data.tar.gz: 05127ca168287aff2d5754eeb0f2cddce7ed27f0fa4b36bf149c1d6725b16bedc592df1a1842b0504904bf467a51e65255879175b8bd527b1d122316a5afc80e
|
data/Gemfile
CHANGED
|
@@ -6,13 +6,12 @@ group :test, :development do
|
|
|
6
6
|
gem 'pry'
|
|
7
7
|
gem 'pry-byebug'
|
|
8
8
|
gem 'pry-rescue'
|
|
9
|
-
# gem 'pronto'
|
|
10
|
-
gem 'pronto-rubocop'
|
|
11
9
|
gem 'opal-rspec'
|
|
12
10
|
end
|
|
13
11
|
|
|
14
12
|
group :test do
|
|
15
13
|
gem 'rspec'
|
|
14
|
+
gem 'tty-prompt'
|
|
16
15
|
gem 'simplecov', require: false
|
|
17
16
|
gem 'rubocop', require: false
|
|
18
17
|
end
|
data/Gemfile.lock
CHANGED
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
coltrane (3.0.0
|
|
4
|
+
coltrane (3.0.0)
|
|
5
5
|
color (~> 1.8)
|
|
6
6
|
dry-monads (~> 0.4)
|
|
7
|
+
mercenary (~> 0.3)
|
|
7
8
|
paint (~> 2.0.1)
|
|
8
|
-
pedrozath-mercenary (~> 0.3)
|
|
9
|
-
tty-prompt (~> 0.16.0)
|
|
10
9
|
|
|
11
10
|
GEM
|
|
12
11
|
remote: https://rubygems.org/
|
|
13
12
|
specs:
|
|
14
|
-
addressable (2.5.2)
|
|
15
|
-
public_suffix (>= 2.0.2, < 4.0)
|
|
16
13
|
ast (2.3.0)
|
|
17
14
|
byebug (9.1.0)
|
|
18
15
|
coderay (1.1.2)
|
|
@@ -27,23 +24,13 @@ GEM
|
|
|
27
24
|
dry-core (~> 0.3, >= 0.3.3)
|
|
28
25
|
dry-equalizer
|
|
29
26
|
equatable (0.5.0)
|
|
30
|
-
faraday (0.14.0)
|
|
31
|
-
multipart-post (>= 1.2, < 3)
|
|
32
|
-
gitlab (3.6.1)
|
|
33
|
-
httparty
|
|
34
|
-
terminal-table
|
|
35
27
|
hike (1.2.3)
|
|
36
28
|
hitimes (1.2.6)
|
|
37
|
-
httparty (0.16.1)
|
|
38
|
-
multi_xml (>= 0.5.2)
|
|
39
29
|
interception (0.5)
|
|
40
30
|
json (2.1.0)
|
|
31
|
+
mercenary (0.3.6)
|
|
41
32
|
method_source (0.9.0)
|
|
42
|
-
multi_xml (0.6.0)
|
|
43
|
-
multipart-post (2.0.0)
|
|
44
33
|
necromancer (0.4.0)
|
|
45
|
-
octokit (4.8.0)
|
|
46
|
-
sawyer (~> 0.8.0, >= 0.5.3)
|
|
47
34
|
opal (0.10.5)
|
|
48
35
|
hike (~> 1.2)
|
|
49
36
|
sourcemap (~> 0.1.0)
|
|
@@ -58,16 +45,7 @@ GEM
|
|
|
58
45
|
pastel (0.7.2)
|
|
59
46
|
equatable (~> 0.5.0)
|
|
60
47
|
tty-color (~> 0.4.0)
|
|
61
|
-
pedrozath-mercenary (0.3.6)
|
|
62
48
|
powerpack (0.1.1)
|
|
63
|
-
pronto (0.6.0)
|
|
64
|
-
gitlab (~> 3.6, >= 3.4.0)
|
|
65
|
-
octokit (~> 4.3, >= 4.1.0)
|
|
66
|
-
rugged (~> 0.24, >= 0.23.0)
|
|
67
|
-
thor (~> 0.19.0)
|
|
68
|
-
pronto-rubocop (0.6.2)
|
|
69
|
-
pronto (~> 0.6.0)
|
|
70
|
-
rubocop (~> 0.38, >= 0.35.0)
|
|
71
49
|
pry (0.11.3)
|
|
72
50
|
coderay (~> 1.1.0)
|
|
73
51
|
method_source (~> 0.9.0)
|
|
@@ -77,7 +55,6 @@ GEM
|
|
|
77
55
|
pry-rescue (1.4.5)
|
|
78
56
|
interception (>= 0.5)
|
|
79
57
|
pry
|
|
80
|
-
public_suffix (3.0.2)
|
|
81
58
|
rack (2.0.4)
|
|
82
59
|
rainbow (3.0.0)
|
|
83
60
|
rake (10.5.0)
|
|
@@ -102,10 +79,6 @@ GEM
|
|
|
102
79
|
ruby-progressbar (~> 1.7)
|
|
103
80
|
unicode-display_width (~> 1.0, >= 1.0.1)
|
|
104
81
|
ruby-progressbar (1.9.0)
|
|
105
|
-
rugged (0.26.0)
|
|
106
|
-
sawyer (0.8.1)
|
|
107
|
-
addressable (>= 2.3.5, < 2.6)
|
|
108
|
-
faraday (~> 0.8, < 1.0)
|
|
109
82
|
simplecov (0.15.1)
|
|
110
83
|
docile (~> 1.1.0)
|
|
111
84
|
json (>= 1.8, < 3)
|
|
@@ -115,9 +88,6 @@ GEM
|
|
|
115
88
|
sprockets (3.7.1)
|
|
116
89
|
concurrent-ruby (~> 1.0)
|
|
117
90
|
rack (> 1, < 3)
|
|
118
|
-
terminal-table (1.8.0)
|
|
119
|
-
unicode-display_width (~> 1.1, >= 1.1.1)
|
|
120
|
-
thor (0.19.4)
|
|
121
91
|
tilt (2.0.8)
|
|
122
92
|
timers (4.1.2)
|
|
123
93
|
hitimes
|
|
@@ -144,7 +114,6 @@ DEPENDENCIES
|
|
|
144
114
|
bundler (~> 1.14)
|
|
145
115
|
coltrane!
|
|
146
116
|
opal-rspec
|
|
147
|
-
pronto-rubocop
|
|
148
117
|
pry
|
|
149
118
|
pry-byebug
|
|
150
119
|
pry-rescue
|
|
@@ -152,6 +121,7 @@ DEPENDENCIES
|
|
|
152
121
|
rspec
|
|
153
122
|
rubocop
|
|
154
123
|
simplecov
|
|
124
|
+
tty-prompt
|
|
155
125
|
|
|
156
126
|
BUNDLED WITH
|
|
157
127
|
1.16.1
|
data/README.md
CHANGED
|
@@ -11,7 +11,7 @@ A music calculation library/CLI written in Ruby.
|
|
|
11
11
|
|
|
12
12
|
* [How to use this library](https://github.com/pedrozath/coltrane/wiki/Core-music-theory-library).
|
|
13
13
|
* [Why did I write this library](https://medium.com/@pedrozath/so-i-wrote-a-library-to-help-me-compose-music-ddb4ae7c8227).
|
|
14
|
-
* [Chat room for discussing the project, answering questions, etc.](
|
|
14
|
+
* [Chat room for discussing the project, answering questions, etc.](http://coltrane-ruby.herokuapp.com/)
|
|
15
15
|
|
|
16
16
|
## CLI (Command Line Interface)
|
|
17
17
|
|
|
@@ -42,7 +42,7 @@ PS: Once you install the gem the CLI is instaled in your system and it's ready t
|
|
|
42
42
|
|
|
43
43
|
## Contributing
|
|
44
44
|
|
|
45
|
-
We are looking for contributors. Find me on [our chatroom](
|
|
45
|
+
We are looking for contributors. Find me on [our chatroom](http://coltrane-ruby.herokuapp.com/) if you need any kind of information.
|
|
46
46
|
|
|
47
47
|
### How to contribute
|
|
48
48
|
1. Fork this code
|
data/coltrane.gemspec
CHANGED
|
@@ -32,11 +32,10 @@ Gem::Specification.new do |spec|
|
|
|
32
32
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
33
33
|
spec.require_paths = ["lib"]
|
|
34
34
|
|
|
35
|
-
spec.add_runtime_dependency 'tty-prompt', '~> 0.16.0'
|
|
36
35
|
spec.add_runtime_dependency 'dry-monads', '~> 0.4'
|
|
37
36
|
spec.add_runtime_dependency 'paint', '~> 2.0.1'
|
|
38
37
|
spec.add_runtime_dependency 'color', '~> 1.8'
|
|
39
|
-
spec.add_runtime_dependency '
|
|
38
|
+
spec.add_runtime_dependency 'mercenary', '~> 0.3'
|
|
40
39
|
spec.add_development_dependency "bundler", '~> 1.14'
|
|
41
40
|
spec.add_development_dependency "rake", '~> 10.0'
|
|
42
41
|
end
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
module Coltrane
|
|
2
2
|
module Commands
|
|
3
3
|
class Chords < Command
|
|
4
|
-
attr_reader :chord, :flavor, :on, :preface
|
|
4
|
+
attr_reader :chord, :flavor, :on, :preface, :voicings
|
|
5
5
|
|
|
6
6
|
def initialize(chord = nil,
|
|
7
7
|
flavor: :notes,
|
|
8
8
|
on: :text,
|
|
9
9
|
notes: nil,
|
|
10
10
|
preface: nil,
|
|
11
|
+
voicings: 4,
|
|
11
12
|
**options)
|
|
12
13
|
if chord
|
|
13
14
|
@chord = chord.is_a?(Theory::Chord) ? chord : Theory::Chord.new(name: chord)
|
|
@@ -18,9 +19,10 @@ module Coltrane
|
|
|
18
19
|
'or coltrane chords --notes C-E-G'
|
|
19
20
|
end
|
|
20
21
|
|
|
21
|
-
@flavor
|
|
22
|
-
@preface
|
|
23
|
-
@on
|
|
22
|
+
@flavor = flavor.to_sym
|
|
23
|
+
@preface = preface || @chord.name
|
|
24
|
+
@on = on.to_sym
|
|
25
|
+
@voicings = voicings.to_i
|
|
24
26
|
end
|
|
25
27
|
|
|
26
28
|
def representation
|
|
@@ -31,10 +33,12 @@ module Coltrane
|
|
|
31
33
|
def on_model
|
|
32
34
|
case on
|
|
33
35
|
when :text then chord
|
|
34
|
-
when :guitar then Representation::Guitar.find_chords(chord).first(
|
|
35
|
-
when :ukulele, :ukelele then Representation::Ukulele.find_chords(chord).first(
|
|
36
|
-
when :bass then Representation::Bass.
|
|
36
|
+
when :guitar then Representation::Guitar.find_chords(chord).first(voicings)
|
|
37
|
+
when :ukulele, :ukelele then Representation::Ukulele.find_chords(chord).first(voicings)
|
|
38
|
+
when :bass then Representation::Bass.find_notes(chord.notes)
|
|
37
39
|
when :piano then Representation::Piano.find_notes(chord.notes)
|
|
40
|
+
when :'guitar-frets' then Representation::Guitar.find_notes(chord.notes)
|
|
41
|
+
when :'ukulele-frets', :'ukelele-frets' then Representation::Ukulele.find_notes(chord.notes)
|
|
38
42
|
end
|
|
39
43
|
end
|
|
40
44
|
|
|
@@ -48,7 +52,7 @@ module Coltrane
|
|
|
48
52
|
(
|
|
49
53
|
{
|
|
50
54
|
layout: :horizontal,
|
|
51
|
-
per_row:
|
|
55
|
+
per_row: 4,
|
|
52
56
|
} if layout_horizontal?
|
|
53
57
|
)
|
|
54
58
|
]
|
|
@@ -67,8 +71,11 @@ module Coltrane
|
|
|
67
71
|
|
|
68
72
|
add_shared_option(:flavor, c)
|
|
69
73
|
add_shared_option(:on, c)
|
|
74
|
+
add_shared_option(:voicings, c)
|
|
70
75
|
c.action { |(chords), **options|
|
|
71
|
-
(chords&.split('-') || [nil]).each { |chord|
|
|
76
|
+
(chords&.split('-') || [nil]).each { |chord|
|
|
77
|
+
new(chord, **options).render
|
|
78
|
+
}
|
|
72
79
|
}
|
|
73
80
|
end
|
|
74
81
|
end
|
|
@@ -3,15 +3,21 @@ module Coltrane
|
|
|
3
3
|
class Command
|
|
4
4
|
COMMON_OPTIONS = {
|
|
5
5
|
on: [
|
|
6
|
-
'--on
|
|
6
|
+
'--on <INSTRUMENT>',
|
|
7
7
|
'Shows the notes on the given instrument/representation type. ' \
|
|
8
8
|
'Can be piano, guitar, ukulele, bass or text'
|
|
9
9
|
],
|
|
10
10
|
|
|
11
11
|
flavor: [
|
|
12
|
-
'--flavor FLAVOR',
|
|
12
|
+
'--flavor <FLAVOR>',
|
|
13
13
|
'Chooses which additional information to display: ' \
|
|
14
14
|
'marks, notes, intervals or degrees'
|
|
15
|
+
],
|
|
16
|
+
|
|
17
|
+
voicings: [
|
|
18
|
+
'--voicings <NUMBER>',
|
|
19
|
+
'Number of voicings for guitar like instruments. Default is 6' \
|
|
20
|
+
'provided they are separated by dashes'
|
|
15
21
|
]
|
|
16
22
|
}
|
|
17
23
|
|
|
@@ -34,6 +34,7 @@ module Coltrane
|
|
|
34
34
|
c.alias(:note)
|
|
35
35
|
c.syntax 'notes <notes separated by space> [--on <instrument>]'
|
|
36
36
|
c.description 'Shows the given notes.'
|
|
37
|
+
add_shared_option(:voicings, c)
|
|
37
38
|
add_shared_option(:flavor, c)
|
|
38
39
|
add_shared_option(:on, c)
|
|
39
40
|
c.action { |(notes), **options| new(notes, **options).render }
|
|
@@ -7,6 +7,7 @@ module Coltrane
|
|
|
7
7
|
c.description 'Gives you chords of a progression in a key. Ex: coltrane progression I-IV-iv-V in Am --on guitar'
|
|
8
8
|
add_shared_option(:flavor, c)
|
|
9
9
|
add_shared_option(:on, c)
|
|
10
|
+
add_shared_option(:voicings, c)
|
|
10
11
|
c.action do |(prog, _, key), **options|
|
|
11
12
|
prog
|
|
12
13
|
.tr('-', '_')
|
|
@@ -18,10 +18,11 @@ module Coltrane
|
|
|
18
18
|
program.command(:scale) do |c|
|
|
19
19
|
c.syntax 'scale <root_note> <scale name> [--on <instrument>]'
|
|
20
20
|
c.description 'Gives you information about a scale. Ex: coltrane scale D Natural Minor --on guitar'
|
|
21
|
-
c.option :tertians, '--tertians SIZE', 'Outputs all tertian chords from the given size from the scale'
|
|
21
|
+
c.option :tertians, '--tertians <SIZE>', 'Outputs all tertian chords from the given size from the scale'
|
|
22
22
|
c.option :chords, '--chords [SIZE]', 'Outputs all chords from given size from the scale. Leave size empty to retrieve all'
|
|
23
23
|
add_shared_option(:flavor, c)
|
|
24
24
|
add_shared_option(:on, c)
|
|
25
|
+
add_shared_option(:voicings, c)
|
|
25
26
|
|
|
26
27
|
c.action { |scale_notation, **options|
|
|
27
28
|
parse(scale_notation.join(' '))
|
|
@@ -6,15 +6,15 @@ module Coltrane
|
|
|
6
6
|
# based on common standards and practices.
|
|
7
7
|
module NotableProgressions
|
|
8
8
|
PROGRESSIONS = {
|
|
9
|
-
'Pop'
|
|
10
|
-
'Jazzy Pop'
|
|
11
|
-
'Jazz'
|
|
9
|
+
'Pop' => ['I-V-vi-IV', :major],
|
|
10
|
+
'Jazzy Pop' => ['IM7-V7-vi7-IVM7', :major],
|
|
11
|
+
'Jazz' => ['ii7-V7-I7', :major],
|
|
12
12
|
'Jazz Minor' => ['ii7-V7-i7', :major],
|
|
13
|
-
'Blues'
|
|
13
|
+
'Blues' => ['IM7-IV7-I7-V7-IV7-I7', :major],
|
|
14
14
|
'Jazz Blues' => ['I7-IV7-I7-V7-IV7-I7', :major],
|
|
15
|
-
'Fifties'
|
|
16
|
-
'Circle'
|
|
17
|
-
'Tune Up'
|
|
15
|
+
'Fifties' => ['I-vi-IV-V', :major],
|
|
16
|
+
'Circle' => ['vi-ii-V-I', :major],
|
|
17
|
+
'Tune Up' => ['ii7-V7-IM7-i7-IV7-IVM7-VIIM7', :minor]
|
|
18
18
|
}.freeze
|
|
19
19
|
|
|
20
20
|
PROGRESSIONS.each do |name, values|
|
data/lib/coltrane/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,29 +1,15 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: coltrane
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.0.0
|
|
4
|
+
version: 3.0.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-04-
|
|
11
|
+
date: 2018-04-02 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
|
-
- !ruby/object:Gem::Dependency
|
|
14
|
-
name: tty-prompt
|
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
|
16
|
-
requirements:
|
|
17
|
-
- - "~>"
|
|
18
|
-
- !ruby/object:Gem::Version
|
|
19
|
-
version: 0.16.0
|
|
20
|
-
type: :runtime
|
|
21
|
-
prerelease: false
|
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
-
requirements:
|
|
24
|
-
- - "~>"
|
|
25
|
-
- !ruby/object:Gem::Version
|
|
26
|
-
version: 0.16.0
|
|
27
13
|
- !ruby/object:Gem::Dependency
|
|
28
14
|
name: dry-monads
|
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -67,7 +53,7 @@ dependencies:
|
|
|
67
53
|
- !ruby/object:Gem::Version
|
|
68
54
|
version: '1.8'
|
|
69
55
|
- !ruby/object:Gem::Dependency
|
|
70
|
-
name:
|
|
56
|
+
name: mercenary
|
|
71
57
|
requirement: !ruby/object:Gem::Requirement
|
|
72
58
|
requirements:
|
|
73
59
|
- - "~>"
|
|
@@ -182,7 +168,6 @@ files:
|
|
|
182
168
|
- lib/coltrane/commands/find_scale.rb
|
|
183
169
|
- lib/coltrane/commands/notes.rb
|
|
184
170
|
- lib/coltrane/commands/progression.rb
|
|
185
|
-
- lib/coltrane/commands/representation.rb
|
|
186
171
|
- lib/coltrane/commands/scale.rb
|
|
187
172
|
- lib/coltrane/renderers.rb
|
|
188
173
|
- lib/coltrane/renderers/renderer.rb
|
|
@@ -259,9 +244,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
259
244
|
version: '2.5'
|
|
260
245
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
261
246
|
requirements:
|
|
262
|
-
- - "
|
|
247
|
+
- - ">="
|
|
263
248
|
- !ruby/object:Gem::Version
|
|
264
|
-
version:
|
|
249
|
+
version: '0'
|
|
265
250
|
requirements: []
|
|
266
251
|
rubyforge_project:
|
|
267
252
|
rubygems_version: 2.7.6
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Coltrane
|
|
4
|
-
module Cli
|
|
5
|
-
# It manages notes representations, most of times instruments
|
|
6
|
-
class Representation
|
|
7
|
-
ACCEPTED_FLAVORS = %i[marks notes intervals degrees].freeze
|
|
8
|
-
|
|
9
|
-
def self.inherited(subclass)
|
|
10
|
-
@@types ||= {}
|
|
11
|
-
@@types[subclass.to_s.split('::').last.underscore.to_sym] = subclass
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
def self.build(notes)
|
|
15
|
-
type = Cli.config.on
|
|
16
|
-
raise WrongFlavorError unless ACCEPTED_FLAVORS.include?(Cli.config.flavor)
|
|
17
|
-
raise(WrongRepresentationTypeError, type) unless @@types.include?(type)
|
|
18
|
-
@@types[type].new(notes)
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
def initialize(notes)
|
|
22
|
-
@notes = notes
|
|
23
|
-
@ref_note = notes.first
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
def hint
|
|
27
|
-
case Cli.config.flavor
|
|
28
|
-
when :marks then ''
|
|
29
|
-
# when :notes then "(\u266E means the note is natural, not flat nor sharp)"
|
|
30
|
-
when :intervals
|
|
31
|
-
<<~DESC
|
|
32
|
-
The letters represent the intervals relative to the root tone
|
|
33
|
-
Ex: 1P = Perfect First / 3m = Minor Third / 4A = Augmented Fourth
|
|
34
|
-
DESC
|
|
35
|
-
|
|
36
|
-
when :degrees then '(The numbers represent the degree of the note in the scale)'
|
|
37
|
-
end
|
|
38
|
-
end
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
end
|