coltrane 1.0.22 → 1.0.24

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: 57dabf818555a71744bf6fb434099d6c33e1b9b33aa3fdaa475c38433b42554f
4
- data.tar.gz: 0c405a62ff1eaf8fc94f0f819d4c3eac4158565ca83ba8374c21964d4c68c0e5
3
+ metadata.gz: a1412370cff765b0e183ec7c6d41290d4162f1ecd11cf7899f10f6a1b6e2fc44
4
+ data.tar.gz: 1c45cadfe804956ce78bbbcb7109b13dd4decf4767a5269495eb942fefb02584
5
5
  SHA512:
6
- metadata.gz: 9e86b4fbad7d9961eddf2f1a6d3eb15b86f280e963322a67d4e1ae1d469f7234f632be0d1a0abaaa0d1ee1a3a9409a804e6e44ceefdad45852a402ee9b00ced4
7
- data.tar.gz: 7dba69b15767ff2d1aac5262075e40eca9548d0aabc244fc018801876c22a4917a54815293e295e048c1c7a7b1d6a706b91010f4783551810410b24c6f2c333e
6
+ metadata.gz: e81e810c26c8511b682b27f9bc6af6881c4fee7c2ebca55669034b250dcc4ae7c5316b3bbb39bca46ca3d54dd9a84f1791a42e35236d672d5c1eb45b1ce3ba09
7
+ data.tar.gz: 790c5c2955888c8ff80170f7b3dd064d14b6b3ac90e4923c7fa6bed34e0ebb94ef342d570a7759c504483a61924f824e80be35ac79f42eef9929ea7862b4288e
data/CHANGELOG.md ADDED
@@ -0,0 +1,37 @@
1
+ # Changelog
2
+ All notable changes to this project will be documented in this file.
3
+
4
+ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
5
+ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
6
+
7
+
8
+ ## [Unreleased]
9
+
10
+ ### Fixes
11
+ - Correct Flat/Sharp on scales
12
+
13
+ ### Adds
14
+ - Progressions
15
+ - Refactor notes and add pitch frequencies, pitch classes
16
+
17
+
18
+ ## [1.1.24]
19
+
20
+ ### Adds
21
+ - Some coloring on guitar output
22
+ - Chromatic Scale
23
+
24
+ ### Fixes
25
+ - Adjusts the marked frets alignment
26
+
27
+ ### Changes
28
+ - Removes Natural sign ~padding~ for guitar instruments
29
+
30
+
31
+ ## [1.1.23]
32
+
33
+ ### Adds
34
+ - A changelog
35
+
36
+ ### Fixes
37
+ - #- operation on Note against number
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- coltrane (1.0.22)
4
+ coltrane (1.0.23)
5
5
  color (~> 1.8)
6
6
  facets (~> 3.1)
7
7
  mercenary (~> 0.3)
data/README.md CHANGED
@@ -11,12 +11,24 @@ https://gitter.im/coltrane-music/Lobby
11
11
 
12
12
  ## CLI (Command Line Interface)
13
13
 
14
+ ### Installation
15
+
16
+ #### Compiled binary
17
+
18
+ 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.
19
+
20
+ macOS & Linux: You probably will need `chmod +x coltrane` before running it.
21
+ Windows users: Please add the `.exe` extension to it before running it (via command prompt).
22
+
23
+ #### Ruby command
24
+
14
25
  ```bash
15
26
  $ gem install coltrane
16
27
  ```
17
28
 
18
- When you install the gem on your system, you automatically gain access to the
19
- CLI.
29
+ Once you install the gem the CLI is instaled in your system and it's ready to be used.
30
+
31
+ ### Usage
20
32
 
21
33
  It allows you to query for notes and chords and display them on your favorite instrument. No sheet music reading skills needed. It also allows you to find scales with a chord and find chords shared between two scales (that is actually the main goal when I did this project).
22
34
 
data/bin/build ADDED
@@ -0,0 +1 @@
1
+ rubyc ../exe/coltrane -o ../dist/coltrane
data/dist/coltrane ADDED
Binary file
data/lib/cli/errors.rb CHANGED
@@ -18,7 +18,7 @@ module Coltrane
18
18
 
19
19
  class BadFindScales < ColtraneCliError
20
20
  def initialize(msg = nil)
21
- super msg || 'Provide --notes or --chords. Ex: `coltrane find-scale --notes C E G`.'
21
+ super msg || 'Provide --notes or --chords. Ex: `coltrane find-scale --notes C-E-G`.'
22
22
  end
23
23
  end
24
24
 
data/lib/cli/guitar.rb CHANGED
@@ -2,10 +2,11 @@
2
2
 
3
3
  module Coltrane
4
4
  module Cli
5
- SPECIAL_FRETS = [3, 5, 7, 9, 12, 15, 17, 19].freeze
6
-
7
5
  # Renders notes in a common most popular ukulele scheme
8
6
  class Guitar < Representation
7
+ SPECIAL_FRETS = [3, 5, 7, 9, 12, 15, 17, 19].freeze
8
+
9
+ include Color
9
10
  def initialize(notes, flavor, tuning: %w[E A D G B E], frets: 22)
10
11
  @notes = notes
11
12
  @tuning = tuning.reverse
@@ -19,15 +20,15 @@ module Coltrane
19
20
  end
20
21
 
21
22
  def render_notes
22
- @tuning.map do |string|
23
+ @tuning.each_with_index.map do |string, str_i|
23
24
  string_note = Note[string]
24
25
  Array.new(@frets + 2) do |i|
25
26
  if i.zero?
26
- string
27
+ Paint[string, HSL.new(140 + str_i * 20,50,50).html]
27
28
  else
28
29
  fret = i - 1
29
30
  note = string_note + fret
30
- m = (@notes.include?(note) ? place_mark(note) : '--')
31
+ m = (@notes.include?(note) ? place_mark(note) : place_empty(str_i))
31
32
  fret.zero? ? (m + ' |') : m
32
33
  end
33
34
  end.join(' ')
@@ -35,22 +36,33 @@ module Coltrane
35
36
  end
36
37
 
37
38
  def render_special_frets
38
- Array.new(@frets + 1) do |fret|
39
+ ' ' +
40
+ Array.new(@frets + 2) do |fret|
39
41
  m = SPECIAL_FRETS.include?(fret) ? fret.to_s.rjust(2, 0.to_s) : ' '
40
42
  "#{m}#{' ' if fret.zero?}"
41
43
  end.join(' ')
42
44
  end
43
45
 
44
- def render_dotted_frets; end
46
+ def place_empty(str_i)
47
+ Paint['--', HSL.new(180 + str_i * 3,50,30).html]
48
+ end
45
49
 
46
50
  def place_mark(note)
47
- case @flavor
48
- when :notes then note.pretty_name.ljust(2, "\u266E")
49
- when :intervals then (@ref_note - note).name.ljust(2, '-')
50
- when :degrees then @notes.degree(note).to_s.rjust(2, '0')
51
- when :marks then '◼◼'
52
- else raise WrongFlavorError
53
- end
51
+ mark =
52
+ case @flavor
53
+ when :notes then note.pretty_name.ljust(2, ' ')
54
+ when :intervals then (@ref_note - note).name.ljust(2, '-')
55
+ when :degrees then @notes.degree(note).to_s.rjust(2, '0')
56
+ when :marks then ' ' # '◼◼'
57
+ else raise WrongFlavorError
58
+ end
59
+
60
+ base_hue = (180 + note.number * 10) % 360 # + 260
61
+ Paint[
62
+ mark,
63
+ HSL.new(0, 0, 100).html,
64
+ HSL.new(base_hue, 100, 30).html
65
+ ]
54
66
  end
55
67
  end
56
68
  end
@@ -32,7 +32,7 @@ module Coltrane
32
32
  def hint
33
33
  case @flavor
34
34
  when :marks then ''
35
- when :notes then "(\u266E means the note is natural, not flat nor sharp)"
35
+ # when :notes then "(\u266E means the note is natural, not flat nor sharp)"
36
36
  when :intervals
37
37
  <<~DESC
38
38
  The letters represent the intervals relative to the root tone
@@ -4,37 +4,16 @@ module Coltrane
4
4
  # It's totally a wip yet.
5
5
  module ClassicProgressions
6
6
  PROGRESSIONS = {
7
- pop: [:major, [1, 5, 6, 4]],
8
- fifties: [:major, [1, 6, 4, 5]],
9
- blues: [:major, [1, 4, 1, 5, 4, 1]],
10
- jazz: [:major, [2, 5, 1]],
11
- jazz_minor: [:minor, [2, 5, 1]],
12
- andalusian: [:minor, [1, 7, 6, 5]]
7
+ 'Pop' => %w[I V vi IV],
8
+ 'Blues' => %w[I I I I IV IV I I V IV I I],
9
+ # 'Jazz Blues' => %w[I7 IV7 I7 I7 F7 F7 I7 ]
10
+ 'Fifties' => %w[I IV V],
11
+ # pop: [:major, [1, 5, 6, 4]],
12
+ # fifties: [:major, [1, 6, 4, 5]],
13
+ # blues: [:major, [1, 4, 1, 5, 4, 1]],
14
+ # jazz: [:major, [2, 5, 1]],
15
+ # jazz_minor: [:minor, [2, 5, 1]],
16
+ # andalusian: [:minor, [1, 7, 6, 5]]
13
17
  }.freeze
14
-
15
- def pop(tone)
16
- scale, degrees = PROGRESSIONS[:pop]
17
- Scale.public_send(scale, tone).progression(*degrees)
18
- end
19
-
20
- def fifties(tone)
21
- scale, degrees = PROGRESSIONS[:fifties]
22
- Scale.public_send(scale, tone).progression(*degrees)
23
- end
24
-
25
- def blues(tone)
26
- scale, degrees = PROGRESSIONS[:blues]
27
- Scale.public_send(scale, tone).progression(*degrees)
28
- end
29
-
30
- def jazz(tone)
31
- scale, degrees = PROGRESSIONS[:jazz]
32
- Scale.public_send(scale, tone).progression(*degrees)
33
- end
34
-
35
- def andalusian(tone)
36
- scale, degrees = PROGRESSIONS[:andalusian]
37
- Scale.public_send(scale, tone).progression(*degrees)
38
- end
39
18
  end
40
19
  end
@@ -13,7 +13,8 @@ module Coltrane
13
13
  'Pentatonic Minor' => [3, 2, 2, 3, 2],
14
14
  'Blues Minor' => [3, 2, 1, 1, 3, 2],
15
15
  'Whole Tone' => [2, 2, 2, 2, 2, 2],
16
- 'Flamenco' => [1, 3, 1, 2, 1, 2, 2]
16
+ 'Flamenco' => [1, 3, 1, 2, 1, 2, 2],
17
+ 'Chromatic' => [1]*12
17
18
  }.freeze
18
19
 
19
20
  MODES = {
data/lib/coltrane/note.rb CHANGED
@@ -77,7 +77,7 @@ module Coltrane
77
77
 
78
78
  def -(other)
79
79
  case other
80
- when Numeric then Note.new(other - number)
80
+ when Numeric then Note[number - other]
81
81
  when Note then Interval.new(other.number - number)
82
82
  end
83
83
  end
@@ -85,5 +85,12 @@ module Coltrane
85
85
  def interval_to(note_name)
86
86
  Note[note_name] - self
87
87
  end
88
+
89
+ def enharmonic?(other)
90
+ case other
91
+ when String then number == Note[other].number
92
+ when Note then number == other.number
93
+ end
94
+ end
88
95
  end
89
96
  end
@@ -11,10 +11,8 @@ module Coltrane
11
11
  @scale = Scale.from_key(key) unless key.nil?
12
12
  end
13
13
 
14
- private
14
+ def chords
15
15
 
16
- def chord_indexes
17
- scale.degrees.map { |d| d - 1 }
18
16
  end
19
17
  end
20
18
  end
@@ -7,23 +7,29 @@ module Coltrane
7
7
  class RomanChord
8
8
  DIGITS = %w[I II III IV V VI VII].freeze
9
9
  NOTATION_REGEX = %r{
10
- (?<degree>[ivIV]*)
10
+ (?<degree>b?[ivIV]*)
11
11
  (?<quality>.*)
12
12
  }x
13
13
 
14
14
  def initialize(scale, notation)
15
15
  @scale = scale
16
16
  @notation = notation.match(NOTATION_REGEX).named_captures
17
+ @notation['quality'] = @notation['quality']
18
+ .gsub('o', 'dim')
19
+ .gsub('ø', 'm7b5')
17
20
  end
18
21
 
19
22
  def degree
20
- DIGITS.index(@notation['degree'].upcase) + 1
23
+ d = @notation['degree']
24
+ @flats = d.count('b')
25
+ d = d.delete('b')
26
+ @degree ||= DIGITS.index(d.upcase) + 1
21
27
  end
22
28
 
23
29
  def quality_name
24
30
  [
25
31
  minor_notation,
26
- @notation['quality'].gsub('o', 'dim').gsub('ø', 'm7b5')
32
+ @notation['quality']
27
33
  ].join
28
34
  end
29
35
 
@@ -46,7 +52,8 @@ module Coltrane
46
52
  end
47
53
 
48
54
  def root_note
49
- @scale[@degree]
55
+ binding.pry if @scale[degree] - @flats == Note['A#']
56
+ @scale[degree] - @flats
50
57
  end
51
58
  end
52
59
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Coltrane
4
- VERSION = '1.0.22'
4
+ VERSION = '1.0.24'
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: 1.0.22
4
+ version: 1.0.24
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-01-30 00:00:00.000000000 Z
11
+ date: 2018-02-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: facets
@@ -107,6 +107,7 @@ files:
107
107
  - ".rspec"
108
108
  - ".rubocop.yml"
109
109
  - ".ruby-version"
110
+ - CHANGELOG.md
110
111
  - CODE_OF_CONDUCT.md
111
112
  - Gemfile
112
113
  - Gemfile.lock
@@ -115,6 +116,7 @@ files:
115
116
  - README.md
116
117
  - Rakefile
117
118
  - bin/_guard-core
119
+ - bin/build
118
120
  - bin/bundle
119
121
  - bin/bundler
120
122
  - bin/byebug
@@ -147,6 +149,7 @@ files:
147
149
  - db/cache.sqlite3
148
150
  - db/cache_test.sqlite3
149
151
  - db/config.yml
152
+ - dist/coltrane
150
153
  - exe/coltrane
151
154
  - img/coltrane-logo.png
152
155
  - img/screen-1.png