coltrane 2.0.0 → 2.1.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 +27 -1
- data/Gemfile +1 -0
- data/Gemfile.lock +21 -3
- data/README.md +0 -7
- data/Rakefile +5 -0
- data/bin/console +2 -0
- data/bin/opal +29 -0
- data/bin/opal-build +29 -0
- data/bin/opal-mspec +29 -0
- data/bin/opal-repl +29 -0
- data/bin/rackup +12 -0
- data/bin/sprockets +12 -0
- data/bin/tilt +12 -0
- data/coltrane.gemspec +1 -1
- data/config.ru +10 -0
- data/exe/coltrane +44 -13
- data/lib/cli.rb +7 -1
- data/lib/cli/bass_guitar.rb +1 -1
- data/lib/cli/chord.rb +11 -4
- data/lib/cli/config.rb +38 -0
- data/lib/cli/guitar.rb +8 -10
- data/lib/cli/guitar_chords.rb +122 -0
- data/lib/cli/notes.rb +3 -4
- data/lib/cli/piano.rb +1 -1
- data/lib/cli/representation.rb +6 -12
- data/lib/cli/scale.rb +4 -4
- data/lib/cli/text.rb +1 -1
- data/lib/cli/ukulele.rb +1 -1
- data/lib/coltrane.rb +35 -32
- data/lib/coltrane/chord_quality.rb +4 -3
- data/lib/coltrane/circle_of_fifths.rb +29 -0
- data/lib/coltrane/classic_scales.rb +36 -43
- data/lib/coltrane/diatonic_scale.rb +34 -0
- data/lib/coltrane/frequency.rb +1 -1
- data/lib/coltrane/interval.rb +14 -0
- data/lib/coltrane/interval_class.rb +6 -0
- data/lib/coltrane/interval_sequence.rb +0 -1
- data/lib/coltrane/key.rb +14 -0
- data/lib/coltrane/note.rb +37 -2
- data/lib/coltrane/note_set.rb +23 -2
- data/lib/coltrane/pitch.rb +65 -31
- data/lib/coltrane/pitch_class.rb +25 -12
- data/lib/coltrane/progression.rb +2 -2
- data/lib/coltrane/qualities.rb +257 -0
- data/lib/coltrane/roman_chord.rb +10 -10
- data/lib/coltrane/scale.rb +9 -3
- data/lib/coltrane/version.rb +1 -1
- data/lib/coltrane/voicing.rb +38 -0
- data/lib/coltrane_game/question.rb +6 -0
- data/lib/coltrane_instruments.rb +3 -0
- data/lib/coltrane_instruments/guitar.rb +5 -2
- data/lib/coltrane_instruments/guitar/base.rb +18 -3
- data/lib/coltrane_instruments/guitar/chord.rb +139 -12
- data/lib/coltrane_instruments/guitar/note.rb +16 -0
- data/lib/coltrane_instruments/guitar/string.rb +21 -0
- data/lib/coltrane_synth.rb +7 -0
- data/lib/coltrane_synth/base.rb +47 -0
- data/lib/coltrane_synth/synth.rb +24 -0
- data/lib/core_ext.rb +25 -7
- data/lib/os.rb +19 -0
- metadata +24 -9
- data/dist/coltrane +0 -0
- data/lib/coltrane/piano_representation.rb +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aee4f6c4975a8d1c27e1c7d8b55bc89d58a73e65e93f9df8831cfbb68f0da689
|
4
|
+
data.tar.gz: 3345417f778a55d64dc1d7bdf9348fdb98d7b60c9eb6eb1f8a8969ae6933e7ca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c41d660a8d4d4d877a1614030196cca1c2f7b8b823795a259378b962e3f9dc5e22fbaa32086ff0d4cc830b7aa81ec7783c4e242552c94ee5bc069499bd055c5
|
7
|
+
data.tar.gz: d0658a0f30b263a19f7d2f190ed4ac17906e80ee9a2c99c87f18c407bd2e2f60db5adaac96705271d761dd7b3602242cd4bf690307b4d379d3dfa2fdebfdda6f
|
data/CHANGELOG.md
CHANGED
@@ -1,7 +1,33 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
3
|
## [Unreleased]
|
4
|
-
|
4
|
+
|
5
|
+
- Fix chords so that they generate a barre and a non-barre version and prevent
|
6
|
+
barre chords from picking notes before the barre.
|
7
|
+
|
8
|
+
## [2.1.0]
|
9
|
+
|
10
|
+
- Correct Flat/Sharp on Diatonic Scales
|
11
|
+
|
12
|
+
- Fix chords so that they generate a barre and a non-barre version and prevent
|
13
|
+
barre chords from picking notes before the barre.
|
14
|
+
|
15
|
+
### Adds
|
16
|
+
|
17
|
+
- Pitches and Voicings. Pitches are a way of expressing notes in a specific
|
18
|
+
octave. Voicings are a way of expressing a chord with the exact pitches
|
19
|
+
|
20
|
+
- Introduces a little sound synthesizer (experimental, macOS-only).
|
21
|
+
Use `--sound` to activate it wherever the program outputs chords.
|
22
|
+
|
23
|
+
- Introduces some modules classes to provide Guitar Chord finding.
|
24
|
+
`ColtraneInstruments::Guitar::Base.find('C6/9')`
|
25
|
+
|
26
|
+
- Introduces DiatonicScale and Key classes.
|
27
|
+
|
28
|
+
### Changes
|
29
|
+
|
30
|
+
- Guitar Chords are now outputted using the default guitar chord notation
|
5
31
|
|
6
32
|
## [2.0.0]
|
7
33
|
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
coltrane (1.
|
4
|
+
coltrane (2.1.0)
|
5
5
|
color (~> 1.8)
|
6
|
-
|
6
|
+
coreaudio
|
7
7
|
paint (~> 2.0)
|
8
8
|
pedrozath-mercenary (~> 0.3)
|
9
9
|
|
@@ -16,10 +16,12 @@ GEM
|
|
16
16
|
byebug (9.1.0)
|
17
17
|
coderay (1.1.2)
|
18
18
|
color (1.8)
|
19
|
+
concurrent-ruby (1.0.5)
|
20
|
+
coreaudio (0.0.12)
|
21
|
+
narray (~> 0.6.0.0)
|
19
22
|
diff-lcs (1.3)
|
20
23
|
docile (1.1.5)
|
21
24
|
erubis (2.7.0)
|
22
|
-
facets (3.1.0)
|
23
25
|
faraday (0.14.0)
|
24
26
|
multipart-post (>= 1.2, < 3)
|
25
27
|
flay (2.10.0)
|
@@ -30,6 +32,7 @@ GEM
|
|
30
32
|
gitlab (3.6.1)
|
31
33
|
httparty
|
32
34
|
terminal-table
|
35
|
+
hike (1.2.3)
|
33
36
|
httparty (0.16.0)
|
34
37
|
multi_xml (>= 0.5.2)
|
35
38
|
interception (0.5)
|
@@ -37,8 +40,16 @@ GEM
|
|
37
40
|
method_source (0.9.0)
|
38
41
|
multi_xml (0.6.0)
|
39
42
|
multipart-post (2.0.0)
|
43
|
+
narray (0.6.0.9)
|
40
44
|
octokit (4.8.0)
|
41
45
|
sawyer (~> 0.8.0, >= 0.5.3)
|
46
|
+
opal (0.10.5)
|
47
|
+
hike (~> 1.2)
|
48
|
+
sourcemap (~> 0.1.0)
|
49
|
+
sprockets (~> 3.1)
|
50
|
+
tilt (>= 1.4)
|
51
|
+
opal-rspec (0.6.1)
|
52
|
+
opal (>= 0.10.0, < 0.12)
|
42
53
|
paint (2.0.1)
|
43
54
|
parallel (1.12.1)
|
44
55
|
parser (2.4.0.2)
|
@@ -67,6 +78,7 @@ GEM
|
|
67
78
|
interception (>= 0.5)
|
68
79
|
pry
|
69
80
|
public_suffix (3.0.2)
|
81
|
+
rack (2.0.4)
|
70
82
|
rainbow (3.0.0)
|
71
83
|
rake (10.5.0)
|
72
84
|
rspec (3.7.0)
|
@@ -102,9 +114,14 @@ GEM
|
|
102
114
|
json (>= 1.8, < 3)
|
103
115
|
simplecov-html (~> 0.10.0)
|
104
116
|
simplecov-html (0.10.2)
|
117
|
+
sourcemap (0.1.1)
|
118
|
+
sprockets (3.7.1)
|
119
|
+
concurrent-ruby (~> 1.0)
|
120
|
+
rack (> 1, < 3)
|
105
121
|
terminal-table (1.8.0)
|
106
122
|
unicode-display_width (~> 1.1, >= 1.1.1)
|
107
123
|
thor (0.19.4)
|
124
|
+
tilt (2.0.8)
|
108
125
|
unicode-display_width (1.3.0)
|
109
126
|
|
110
127
|
PLATFORMS
|
@@ -113,6 +130,7 @@ PLATFORMS
|
|
113
130
|
DEPENDENCIES
|
114
131
|
bundler (~> 1.14)
|
115
132
|
coltrane!
|
133
|
+
opal-rspec
|
116
134
|
pronto
|
117
135
|
pronto-flay
|
118
136
|
pronto-rubocop
|
data/README.md
CHANGED
@@ -15,13 +15,6 @@ https://gitter.im/coltrane-music/Lobby
|
|
15
15
|
|
16
16
|
### Installation
|
17
17
|
|
18
|
-
#### Compiled binary
|
19
|
-
|
20
|
-
There's an experimental compiled version you can [download here](https://raw.githubusercontent.com/pedrozath/coltrane/master/dist/coltrane). It has been tested only macOS High Sierra so far, but it should work on Linux and Windows as well.
|
21
|
-
|
22
|
-
macOS & Linux: You probably will need `chmod +x coltrane` before running it.
|
23
|
-
Windows users: Please add the `.exe` extension to it before running it (via command prompt).
|
24
|
-
|
25
18
|
#### Ruby command
|
26
19
|
|
27
20
|
```bash
|
data/Rakefile
CHANGED
data/bin/console
CHANGED
data/bin/opal
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
#
|
5
|
+
# This file was generated by Bundler.
|
6
|
+
#
|
7
|
+
# The application 'opal' is installed as part of a gem, and
|
8
|
+
# this file is here to facilitate running it.
|
9
|
+
#
|
10
|
+
|
11
|
+
require "pathname"
|
12
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
13
|
+
Pathname.new(__FILE__).realpath)
|
14
|
+
|
15
|
+
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
16
|
+
|
17
|
+
if File.file?(bundle_binstub)
|
18
|
+
if File.read(bundle_binstub, 150) =~ /This file was generated by Bundler/
|
19
|
+
load(bundle_binstub)
|
20
|
+
else
|
21
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
22
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
require "rubygems"
|
27
|
+
require "bundler/setup"
|
28
|
+
|
29
|
+
load Gem.bin_path("opal", "opal")
|
data/bin/opal-build
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
#
|
5
|
+
# This file was generated by Bundler.
|
6
|
+
#
|
7
|
+
# The application 'opal-build' is installed as part of a gem, and
|
8
|
+
# this file is here to facilitate running it.
|
9
|
+
#
|
10
|
+
|
11
|
+
require "pathname"
|
12
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
13
|
+
Pathname.new(__FILE__).realpath)
|
14
|
+
|
15
|
+
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
16
|
+
|
17
|
+
if File.file?(bundle_binstub)
|
18
|
+
if File.read(bundle_binstub, 150) =~ /This file was generated by Bundler/
|
19
|
+
load(bundle_binstub)
|
20
|
+
else
|
21
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
22
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
require "rubygems"
|
27
|
+
require "bundler/setup"
|
28
|
+
|
29
|
+
load Gem.bin_path("opal", "opal-build")
|
data/bin/opal-mspec
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
#
|
5
|
+
# This file was generated by Bundler.
|
6
|
+
#
|
7
|
+
# The application 'opal-mspec' is installed as part of a gem, and
|
8
|
+
# this file is here to facilitate running it.
|
9
|
+
#
|
10
|
+
|
11
|
+
require "pathname"
|
12
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
13
|
+
Pathname.new(__FILE__).realpath)
|
14
|
+
|
15
|
+
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
16
|
+
|
17
|
+
if File.file?(bundle_binstub)
|
18
|
+
if File.read(bundle_binstub, 150) =~ /This file was generated by Bundler/
|
19
|
+
load(bundle_binstub)
|
20
|
+
else
|
21
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
22
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
require "rubygems"
|
27
|
+
require "bundler/setup"
|
28
|
+
|
29
|
+
load Gem.bin_path("opal", "opal-mspec")
|
data/bin/opal-repl
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
#
|
5
|
+
# This file was generated by Bundler.
|
6
|
+
#
|
7
|
+
# The application 'opal-repl' is installed as part of a gem, and
|
8
|
+
# this file is here to facilitate running it.
|
9
|
+
#
|
10
|
+
|
11
|
+
require "pathname"
|
12
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
13
|
+
Pathname.new(__FILE__).realpath)
|
14
|
+
|
15
|
+
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
16
|
+
|
17
|
+
if File.file?(bundle_binstub)
|
18
|
+
if File.read(bundle_binstub, 150) =~ /This file was generated by Bundler/
|
19
|
+
load(bundle_binstub)
|
20
|
+
else
|
21
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
22
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
require "rubygems"
|
27
|
+
require "bundler/setup"
|
28
|
+
|
29
|
+
load Gem.bin_path("opal", "opal-repl")
|
data/bin/rackup
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# frozen_string_literal: true
|
3
|
+
|
3
4
|
#
|
4
5
|
# This file was generated by Bundler.
|
5
6
|
#
|
@@ -11,6 +12,17 @@ require "pathname"
|
|
11
12
|
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
12
13
|
Pathname.new(__FILE__).realpath)
|
13
14
|
|
15
|
+
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
16
|
+
|
17
|
+
if File.file?(bundle_binstub)
|
18
|
+
if File.read(bundle_binstub, 150) =~ /This file was generated by Bundler/
|
19
|
+
load(bundle_binstub)
|
20
|
+
else
|
21
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
22
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
14
26
|
require "rubygems"
|
15
27
|
require "bundler/setup"
|
16
28
|
|
data/bin/sprockets
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# frozen_string_literal: true
|
3
|
+
|
3
4
|
#
|
4
5
|
# This file was generated by Bundler.
|
5
6
|
#
|
@@ -11,6 +12,17 @@ require "pathname"
|
|
11
12
|
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
12
13
|
Pathname.new(__FILE__).realpath)
|
13
14
|
|
15
|
+
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
16
|
+
|
17
|
+
if File.file?(bundle_binstub)
|
18
|
+
if File.read(bundle_binstub, 150) =~ /This file was generated by Bundler/
|
19
|
+
load(bundle_binstub)
|
20
|
+
else
|
21
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
22
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
14
26
|
require "rubygems"
|
15
27
|
require "bundler/setup"
|
16
28
|
|
data/bin/tilt
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# frozen_string_literal: true
|
3
|
+
|
3
4
|
#
|
4
5
|
# This file was generated by Bundler.
|
5
6
|
#
|
@@ -11,6 +12,17 @@ require "pathname"
|
|
11
12
|
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
12
13
|
Pathname.new(__FILE__).realpath)
|
13
14
|
|
15
|
+
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
16
|
+
|
17
|
+
if File.file?(bundle_binstub)
|
18
|
+
if File.read(bundle_binstub, 150) =~ /This file was generated by Bundler/
|
19
|
+
load(bundle_binstub)
|
20
|
+
else
|
21
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
22
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
14
26
|
require "rubygems"
|
15
27
|
require "bundler/setup"
|
16
28
|
|
data/coltrane.gemspec
CHANGED
@@ -32,7 +32,7 @@ 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 '
|
35
|
+
spec.add_runtime_dependency 'coreaudio'
|
36
36
|
spec.add_runtime_dependency 'paint', '~> 2.0'
|
37
37
|
spec.add_runtime_dependency 'color', '~> 1.8'
|
38
38
|
spec.add_runtime_dependency 'pedrozath-mercenary', '~> 0.3'
|
data/config.ru
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
require 'opal/rspec'
|
2
|
+
|
3
|
+
# or use Opal::RSpec::SprocketsEnvironment.new(spec_pattern='spec/opal/**/*_spec.{rb,opal}') to customize the pattern
|
4
|
+
sprockets_env = Opal::RSpec::SprocketsEnvironment.new
|
5
|
+
run Opal::Server.new(sprockets: sprockets_env) { |s|
|
6
|
+
s.main = 'opal/rspec/sprockets_runner'
|
7
|
+
sprockets_env.spec_exclude_pattern = 'spec/exe/**/*_spec.rb'
|
8
|
+
sprockets_env.add_spec_paths_to_sprockets
|
9
|
+
s.debug = true
|
10
|
+
}
|
data/exe/coltrane
CHANGED
@@ -5,8 +5,6 @@
|
|
5
5
|
|
6
6
|
$LOAD_PATH.unshift(File.expand_path('../../lib', __FILE__))
|
7
7
|
|
8
|
-
require 'core_ext'
|
9
|
-
require 'coltrane'
|
10
8
|
require 'cli'
|
11
9
|
|
12
10
|
full_color_terminals = %w[iTerm.app]
|
@@ -37,7 +35,13 @@ Mercenary.program(:Coltrane) do |p|
|
|
37
35
|
@flavor_option = [
|
38
36
|
:flavor,
|
39
37
|
'--flavor FLAVOR',
|
40
|
-
'Chooses which
|
38
|
+
'Chooses which additional information to display: marks, notes, intervals or degrees'
|
39
|
+
]
|
40
|
+
|
41
|
+
@sound_option = [
|
42
|
+
:sound,
|
43
|
+
'--sound',
|
44
|
+
'beta/macOS only: plays the sound of related notes/chords'
|
41
45
|
]
|
42
46
|
|
43
47
|
p.command(:note) do |c|
|
@@ -46,10 +50,16 @@ Mercenary.program(:Coltrane) do |p|
|
|
46
50
|
c.description 'Shows the given notes.'
|
47
51
|
c.option(*@instrument_option)
|
48
52
|
c.option(*@flavor_option)
|
53
|
+
c.option(*@sound_option)
|
49
54
|
c.action do |(notes), on: 'text', flavor: 'notes'|
|
55
|
+
Coltrane::Cli.config do |c|
|
56
|
+
c.on = on.to_sym
|
57
|
+
c.flavor = flavor.to_sym
|
58
|
+
end
|
59
|
+
|
50
60
|
raise 'Provide some notes. Ex: coltrane notes C-D-Gb' if notes.empty?
|
51
61
|
notes = Coltrane::NoteSet[*notes.split('-')]
|
52
|
-
Coltrane::Cli::Notes.new(notes
|
62
|
+
Coltrane::Cli::Notes.new(notes)
|
53
63
|
end
|
54
64
|
end
|
55
65
|
|
@@ -59,10 +69,17 @@ Mercenary.program(:Coltrane) do |p|
|
|
59
69
|
c.description 'Shows the given chord. Ex: coltrane chord Cmaj7 --on piano'
|
60
70
|
c.option(*@instrument_option)
|
61
71
|
c.option(*@flavor_option)
|
72
|
+
c.option(*@sound_option)
|
62
73
|
c.option :notes, '--notes C-D-E', 'finds chords with those notes, provided they are separated by dashes'
|
63
|
-
c.action do |(chords), notes: nil, on: 'text', flavor: 'notes'|
|
74
|
+
c.action do |(chords), notes: nil, on: 'text', flavor: 'notes', sound: nil|
|
75
|
+
Coltrane::Cli.config do |c|
|
76
|
+
c.on = on.to_sym
|
77
|
+
c.flavor = flavor.to_sym
|
78
|
+
c.sound = sound
|
79
|
+
end
|
80
|
+
|
64
81
|
chords = chords&.split('-')
|
65
|
-
Coltrane::Cli::Chord.new(*chords, notes: notes&.split('-')
|
82
|
+
Coltrane::Cli::Chord.new(*chords, notes: notes&.split('-'))
|
66
83
|
end
|
67
84
|
end
|
68
85
|
|
@@ -71,14 +88,20 @@ Mercenary.program(:Coltrane) do |p|
|
|
71
88
|
c.description 'Gives you information about a scale. Ex: coltrane scale natural-minor-Db --on guitar'
|
72
89
|
c.option(*@instrument_option)
|
73
90
|
c.option(*@flavor_option)
|
91
|
+
c.option(*@sound_option)
|
74
92
|
c.option :triads, '--triads', 'Outputs triads from the scale'
|
75
93
|
c.option :sevenths, '--sevenths', 'Outputs seventh chords from the scale'
|
76
94
|
c.option :pentads, '--pentads', 'Outputs pentad chords from the scale'
|
77
95
|
c.option :tertians, '--tertians SIZE', 'Outputs all tertian chords from the given size from the scale'
|
78
96
|
c.option :chords, '--chords [SIZE]', 'Outputs all chords from given size from the scale. Leave size empty to retrieve all'
|
79
|
-
c.action do |(scale_str), flavor: 'degrees', on: 'text', **options|
|
97
|
+
c.action do |(scale_str), flavor: 'degrees', on: 'text', sound: false, **options|
|
98
|
+
Coltrane::Cli.config do |c|
|
99
|
+
c.on = on.to_sym
|
100
|
+
c.flavor = flavor.to_sym
|
101
|
+
c.sound = sound
|
102
|
+
end
|
103
|
+
|
80
104
|
scale = Coltrane::Cli::Scale.parse(scale_str)
|
81
|
-
keyword_args = { flavor: flavor, on: on }
|
82
105
|
if options.include?(:triads)
|
83
106
|
chords = scale.triads
|
84
107
|
Coltrane::Cli::Chord.new(*chords, **keyword_args)
|
@@ -97,9 +120,9 @@ Mercenary.program(:Coltrane) do |p|
|
|
97
120
|
else
|
98
121
|
scale.chords(options[:chords])
|
99
122
|
end
|
100
|
-
Coltrane::Cli::Chord.new(*chords
|
123
|
+
Coltrane::Cli::Chord.new(*chords)
|
101
124
|
else
|
102
|
-
Coltrane::Cli::Scale.new(scale
|
125
|
+
Coltrane::Cli::Scale.new(scale)
|
103
126
|
end
|
104
127
|
end
|
105
128
|
end
|
@@ -109,7 +132,14 @@ Mercenary.program(:Coltrane) do |p|
|
|
109
132
|
c.description 'Gives you chords of a progression in a key. Ex: coltrane progression I-IV-iv-V in Am --on guitar'
|
110
133
|
c.option(*@instrument_option)
|
111
134
|
c.option(*@flavor_option)
|
112
|
-
c.
|
135
|
+
c.option(*@sound_option)
|
136
|
+
c.action do |(prog, _, key), on: 'text', flavor: 'notes', sound: nil|
|
137
|
+
Coltrane::Cli.config do |c|
|
138
|
+
c.on = on.symbolize
|
139
|
+
c.flavor = flavor.symbolize
|
140
|
+
c.sound = sound
|
141
|
+
end
|
142
|
+
|
113
143
|
possible_method = prog.tr('-', '_')
|
114
144
|
progression = if Coltrane::Progression.respond_to?(possible_method)
|
115
145
|
Coltrane::Progression.send(possible_method, key)
|
@@ -117,7 +147,7 @@ Mercenary.program(:Coltrane) do |p|
|
|
117
147
|
Coltrane::Progression.new(prog, key: key)
|
118
148
|
end
|
119
149
|
|
120
|
-
Coltrane::Cli::Chord.new(*progression.chords
|
150
|
+
Coltrane::Cli::Chord.new(*progression.chords)
|
121
151
|
end
|
122
152
|
end
|
123
153
|
|
@@ -172,7 +202,7 @@ Mercenary.program(:Coltrane) do |p|
|
|
172
202
|
memo & scale.all_chords.map(&:name)
|
173
203
|
end
|
174
204
|
raise 'No common chords were found' if chords.empty?
|
175
|
-
Coltrane::Cli::Chord.new(*chords
|
205
|
+
Coltrane::Cli::Chord.new(*chords)
|
176
206
|
end
|
177
207
|
end
|
178
208
|
|
@@ -196,6 +226,7 @@ Mercenary.program(:Coltrane) do |p|
|
|
196
226
|
c.description 'Starts interactive mode'
|
197
227
|
c.action do
|
198
228
|
begin
|
229
|
+
Coltrane::Cli.erase_config
|
199
230
|
puts "\n"
|
200
231
|
print Paint['coltrane ', '#F88550']
|
201
232
|
cmd = gets.chomp
|