chord_diagrams 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -1
- data/README.md +9 -2
- data/Rakefile +18 -8
- data/lib/chord_diagrams.rb +96 -35
- data/lib/chord_diagrams/fingerings.csv +90 -0
- data/lib/chord_diagrams/fingerings.rb +12 -126
- data/lib/chord_diagrams/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c4b24bca4ad95e9adaad3ef03c04795cadd130f174af421ad90e061a3fcc66b8
|
4
|
+
data.tar.gz: 40a547576fe43380cd46b0a063b3dc3aa2fcc5333085e969c3c615b5f41b3f4a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5585f6225df041d60cbca67c5756254693ab6b89dcf4a618ed16d2645a8119c146b186caa0355a0397932b2a04c686fa82028c5e8124787c8c28292644ef4a6a
|
7
|
+
data.tar.gz: c9fc438228064e291ad436dce2fb5e857812bcaa29a208a52dda915bb757a27e5e25b1d470c008087652b0c06c3b86483df8613f31120dd85461d481f8bde430
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# ChordDiagrams
|
2
2
|
|
3
|
-
Generate SVGs
|
3
|
+
Generate SVGs for Guitar and Ukulele Chord Diagrams
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -22,11 +22,18 @@ Or install it yourself as:
|
|
22
22
|
|
23
23
|
```ruby
|
24
24
|
require 'chord_diagrams'
|
25
|
-
puts ChordDiagrams.
|
25
|
+
puts ChordDiagrams.guitar_svg('Am')
|
26
|
+
puts ChordDiagrams.ukulele_svg('Am')
|
26
27
|
```
|
27
28
|
|
29
|
+
### Guitar
|
30
|
+
|
28
31
|
<svg width="100" height="100" viewBox="0 0 200 200"><text x="100" y="40" text-anchor="middle" style="font-size:36; font-weight:bold">Am</text><line x1="50" y1="80" x2="150" y2="80" style="stroke:black; stroke-width:2; stroke-linecap:square"/><line x1="50" y1="100" x2="150" y2="100" style="stroke:black; stroke-width:2; stroke-linecap:square"/><line x1="50" y1="120" x2="150" y2="120" style="stroke:black; stroke-width:2; stroke-linecap:square"/><line x1="50" y1="140" x2="150" y2="140" style="stroke:black; stroke-width:2; stroke-linecap:square"/><line x1="50" y1="160" x2="150" y2="160" style="stroke:black; stroke-width:2; stroke-linecap:square"/><line x1="50" y1="80" x2="50" y2="160" style="stroke:black; stroke-width:2; stroke-linecap:square"/><line x1="70" y1="80" x2="70" y2="160" style="stroke:black; stroke-width:2; stroke-linecap:square"/><line x1="90" y1="80" x2="90" y2="160" style="stroke:black; stroke-width:2; stroke-linecap:square"/><line x1="110" y1="80" x2="110" y2="160" style="stroke:black; stroke-width:2; stroke-linecap:square"/><line x1="130" y1="80" x2="130" y2="160" style="stroke:black; stroke-width:2; stroke-linecap:square"/><line x1="150" y1="80" x2="150" y2="160" style="stroke:black; stroke-width:2; stroke-linecap:square"/><line x1="49" y1="77" x2="151" y2="77" style="stroke:black; stroke-width:8"/><circle cx="50" cy="61" r="6" style="stroke:black; fill:white; stroke-width:2"/><circle cx="70" cy="61" r="6" style="stroke:black; fill:white; stroke-width:2"/><circle cx="90" cy="110" r="8" style="fill:black"/><circle cx="110" cy="110" r="8" style="fill:black"/><circle cx="130" cy="90" r="8" style="fill:black"/><circle cx="150" cy="61" r="6" style="stroke:black; fill:white; stroke-width:2"/></svg>
|
29
32
|
|
33
|
+
### Ukulele
|
34
|
+
|
35
|
+
<svg width="80" height="100" viewBox="0 0 160 200"><text id="chordName" x="80" y="40" text-anchor="middle" style="font-size:36; font-weight:bold">Am</text><line x1="50" y1="80" x2="110" y2="80" style="stroke:black; stroke-width:2; stroke-linecap:square"/><line x1="50" y1="100" x2="110" y2="100" style="stroke:black; stroke-width:2; stroke-linecap:square"/><line x1="50" y1="120" x2="110" y2="120" style="stroke:black; stroke-width:2; stroke-linecap:square"/><line x1="50" y1="140" x2="110" y2="140" style="stroke:black; stroke-width:2; stroke-linecap:square"/><line x1="50" y1="160" x2="110" y2="160" style="stroke:black; stroke-width:2; stroke-linecap:square"/><line x1="50" y1="80" x2="50" y2="160" style="stroke:black; stroke-width:2; stroke-linecap:square"/><line x1="70" y1="80" x2="70" y2="160" style="stroke:black; stroke-width:2; stroke-linecap:square"/><line x1="90" y1="80" x2="90" y2="160" style="stroke:black; stroke-width:2; stroke-linecap:square"/><line x1="110" y1="80" x2="110" y2="160" style="stroke:black; stroke-width:2; stroke-linecap:square"/><line id="nut" x1="49" y1="77" x2="111" y2="77" style="stroke:black; stroke-width:8"/><circle cx="50" cy="90" r="8" style="fill:black"/><circle cx="70" cy="61" r="6" style="stroke:black; fill:white; stroke-width:2"/><circle cx="90" cy="61" r="6" style="stroke:black; fill:white; stroke-width:2"/><circle cx="110" cy="61" r="6" style="stroke:black; fill:white; stroke-width:2"/></svg>
|
36
|
+
|
30
37
|
## Development
|
31
38
|
|
32
39
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
data/Rakefile
CHANGED
@@ -1,19 +1,29 @@
|
|
1
1
|
require 'bundler/gem_tasks'
|
2
2
|
require 'rspec/core/rake_task'
|
3
|
+
require 'chord_diagrams'
|
3
4
|
|
4
5
|
RSpec::Core::RakeTask.new(:spec)
|
5
6
|
|
6
7
|
task default: :spec
|
7
8
|
|
8
|
-
task :
|
9
|
-
require 'chord_diagrams'
|
9
|
+
task sheets: %i[guitar ukulele]
|
10
10
|
|
11
|
-
|
11
|
+
task :guitar do
|
12
|
+
html = ''
|
12
13
|
|
13
|
-
ChordDiagrams::
|
14
|
-
|
15
|
-
html << diagram
|
14
|
+
ChordDiagrams::GUITAR_FINGERINGS.keys.each do |name|
|
15
|
+
html << ChordDiagrams.guitar_svg(name)
|
16
16
|
end
|
17
17
|
|
18
|
-
File.open('
|
19
|
-
end
|
18
|
+
File.open('guitar.html', 'w') { |file| file.write(html) }
|
19
|
+
end
|
20
|
+
|
21
|
+
task :ukulele do
|
22
|
+
html = ''
|
23
|
+
|
24
|
+
ChordDiagrams::UKULELE_FINGERINGS.keys.each do |name|
|
25
|
+
html << ChordDiagrams.ukulele_svg(name)
|
26
|
+
end
|
27
|
+
|
28
|
+
File.open('ukulele.html', 'w') { |file| file.write(html) }
|
29
|
+
end
|
data/lib/chord_diagrams.rb
CHANGED
@@ -10,28 +10,82 @@ module ChordDiagrams
|
|
10
10
|
}.freeze
|
11
11
|
|
12
12
|
class << self
|
13
|
-
def
|
14
|
-
svg = Victor::SVG.new template: :html, width:
|
13
|
+
def ukulele_svg(name, _fingering = nil)
|
14
|
+
svg = Victor::SVG.new template: :html, width: 80, height: 100, viewBox: '0 0 160 200'
|
15
|
+
|
16
|
+
ChordDiagrams.draw_ukulele_name(name, svg)
|
17
|
+
ChordDiagrams.draw_ukulele_frets(svg)
|
18
|
+
ChordDiagrams.draw_ukulele_strings(svg)
|
15
19
|
|
16
|
-
ChordDiagrams
|
17
|
-
ChordDiagrams.draw_frets(svg)
|
18
|
-
ChordDiagrams.draw_strings(svg)
|
20
|
+
fingering = ChordDiagrams::UKULELE_FINGERINGS[name] if fingering.nil?
|
19
21
|
|
20
|
-
if
|
21
|
-
|
22
|
+
if !fingering.nil?
|
23
|
+
ChordDiagrams.draw_chord_diagram(fingering, svg)
|
24
|
+
else
|
25
|
+
ChordDiagrams.draw_ukulele_missing_chord_diagram(name, svg)
|
22
26
|
end
|
23
27
|
|
24
|
-
|
25
|
-
|
28
|
+
svg.render
|
29
|
+
end
|
30
|
+
|
31
|
+
def guitar_svg(name, fingering = nil)
|
32
|
+
svg = Victor::SVG.new template: :html, width: 100, height: 100, viewBox: '0 0 200 200'
|
33
|
+
|
34
|
+
ChordDiagrams.draw_guitar_name(name, svg)
|
35
|
+
ChordDiagrams.draw_guitar_frets(svg)
|
36
|
+
ChordDiagrams.draw_guitar_strings(svg)
|
37
|
+
|
38
|
+
fingering = ChordDiagrams::GUITAR_FINGERINGS[name] if fingering.nil?
|
39
|
+
|
40
|
+
if !fingering.nil?
|
41
|
+
ChordDiagrams.draw_chord_diagram(fingering, svg)
|
26
42
|
else
|
27
|
-
ChordDiagrams.
|
43
|
+
ChordDiagrams.draw_guitar_missing_chord_diagram(name, svg)
|
28
44
|
end
|
29
45
|
|
30
46
|
svg.render
|
31
47
|
end
|
32
48
|
|
33
|
-
def
|
34
|
-
|
49
|
+
def draw_ukulele_name(name, svg)
|
50
|
+
svg.text name, id: 'chordName', x: 80, y: 40, text_anchor: :middle, style: {
|
51
|
+
font_size: 36,
|
52
|
+
font_weight: :bold
|
53
|
+
}
|
54
|
+
end
|
55
|
+
|
56
|
+
def draw_guitar_name(name, svg)
|
57
|
+
svg.text name, id: 'chordName', x: 100, y: 40, text_anchor: :middle, style: {
|
58
|
+
font_size: 36,
|
59
|
+
font_weight: :bold
|
60
|
+
}
|
61
|
+
end
|
62
|
+
|
63
|
+
def draw_guitar_frets(svg)
|
64
|
+
[80, 100, 120, 140, 160].each do |y|
|
65
|
+
svg.line x1: 50, y1: y, x2: 150, y2: y, style: LINE_STYLE
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
def draw_ukulele_frets(svg)
|
70
|
+
[80, 100, 120, 140, 160].each do |y|
|
71
|
+
svg.line x1: 50, y1: y, x2: 110, y2: y, style: LINE_STYLE
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
def draw_guitar_strings(svg)
|
76
|
+
[50, 70, 90, 110, 130, 150].each do |x|
|
77
|
+
svg.line x1: x, y1: 80, x2: x, y2: 160, style: LINE_STYLE
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
def draw_ukulele_strings(svg)
|
82
|
+
[50, 70, 90, 110].each do |x|
|
83
|
+
svg.line x1: x, y1: 80, x2: x, y2: 160, style: LINE_STYLE
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
def draw_guitar_missing_chord_diagram(name, svg)
|
88
|
+
puts "Could't find fingerings for the Guitar chord '#{name}'"
|
35
89
|
|
36
90
|
svg.text '?', x: 102, y: 155, text_anchor: :middle, style: {
|
37
91
|
font_size: 96,
|
@@ -40,17 +94,32 @@ module ChordDiagrams
|
|
40
94
|
}
|
41
95
|
end
|
42
96
|
|
97
|
+
def draw_ukulele_missing_chord_diagram(name, svg)
|
98
|
+
puts "Could't find fingerings for the Ukulele chord '#{name}'"
|
99
|
+
|
100
|
+
svg.text '?', x: 81, y: 155, text_anchor: :middle, style: {
|
101
|
+
font_size: 96,
|
102
|
+
font_weight: :bold,
|
103
|
+
fill: :gray
|
104
|
+
}
|
105
|
+
end
|
106
|
+
|
43
107
|
def draw_chord_diagram(fingerings, svg)
|
44
108
|
fingerings = fingerings.split('')
|
45
109
|
|
46
|
-
lowest_fret = fingerings.reject{ |fret| fret.to_i < 1 }.min
|
110
|
+
lowest_fret = fingerings.reject { |fret| fret.to_i < 1 }.min
|
111
|
+
highest_fret = fingerings.reject { |fret| fret.to_i < 1 }.max
|
47
112
|
|
48
|
-
if lowest_fret.to_i >
|
49
|
-
|
113
|
+
if lowest_fret.to_i > 3 || highest_fret.to_i > 4
|
114
|
+
draw_fret_number(lowest_fret, svg)
|
50
115
|
|
51
|
-
fingerings =
|
116
|
+
fingerings = shift_guitar_fingerings(fingerings, lowest_fret)
|
52
117
|
else
|
53
|
-
|
118
|
+
if fingerings.size == 6
|
119
|
+
draw_guitar_nut(svg)
|
120
|
+
else
|
121
|
+
draw_ukulele_nut(svg)
|
122
|
+
end
|
54
123
|
end
|
55
124
|
|
56
125
|
fingerings.each_with_index do |fingering, index|
|
@@ -66,15 +135,15 @@ module ChordDiagrams
|
|
66
135
|
end
|
67
136
|
end
|
68
137
|
|
69
|
-
def
|
70
|
-
svg.
|
71
|
-
|
72
|
-
|
138
|
+
def draw_guitar_nut(svg)
|
139
|
+
svg.line id: 'nut', x1: 49, y1: 77, x2: 151, y2: 77, style: {
|
140
|
+
stroke: :black,
|
141
|
+
stroke_width: 8
|
73
142
|
}
|
74
143
|
end
|
75
144
|
|
76
|
-
def
|
77
|
-
svg.line id: 'nut', x1: 49, y1: 77, x2:
|
145
|
+
def draw_ukulele_nut(svg)
|
146
|
+
svg.line id: 'nut', x1: 49, y1: 77, x2: 111, y2: 77, style: {
|
78
147
|
stroke: :black,
|
79
148
|
stroke_width: 8
|
80
149
|
}
|
@@ -97,21 +166,13 @@ module ChordDiagrams
|
|
97
166
|
svg.line x1: offset - 4, y1: 61 + 4, x2: offset + 4, y2: 61 - 4, style: LINE_STYLE
|
98
167
|
end
|
99
168
|
|
100
|
-
|
101
|
-
[50, 70, 90, 110, 130, 150].each do |x|
|
102
|
-
svg.line x1: x, y1: 80, x2: x, y2: 160, style: LINE_STYLE
|
103
|
-
end
|
104
|
-
end
|
169
|
+
private
|
105
170
|
|
106
|
-
def
|
107
|
-
|
108
|
-
svg.line x1: 50, y1: y, x2: 150, y2: y, style: LINE_STYLE
|
109
|
-
end
|
171
|
+
def draw_fret_number(number, svg)
|
172
|
+
svg.text number, id: 'fretNumber', x: 37, y: 98, text_anchor: :end, style: {font_size: 24}
|
110
173
|
end
|
111
174
|
|
112
|
-
|
113
|
-
|
114
|
-
def shift_fingerings(fingerings, lowest_fret)
|
175
|
+
def shift_guitar_fingerings(fingerings, lowest_fret)
|
115
176
|
fingerings.map do |fingering|
|
116
177
|
if fingering != 'x' && fingering != '0'
|
117
178
|
fingering.to_i - lowest_fret.to_i + 1
|
@@ -0,0 +1,90 @@
|
|
1
|
+
chord,guitar,ukulele
|
2
|
+
A,002220,2100
|
3
|
+
B,x24442,4322
|
4
|
+
Bb,x13331,3211
|
5
|
+
C,x32010,0003
|
6
|
+
C#,x46664,1114
|
7
|
+
D,xx0232,2220
|
8
|
+
D#,x68886,0331
|
9
|
+
E,022100,4442
|
10
|
+
Eb,x68886,0331
|
11
|
+
F,133211,2010
|
12
|
+
F#,244322,3121
|
13
|
+
G,320003,0232
|
14
|
+
G#,466544,1343
|
15
|
+
C5,x355xx,0033
|
16
|
+
D5,x577xx,2200
|
17
|
+
D#5,x688xx,2255
|
18
|
+
C6,x32210,0000
|
19
|
+
D6,xx0202,2222
|
20
|
+
E6,022120,4444
|
21
|
+
G6,320000,0202
|
22
|
+
A7,002020,0100
|
23
|
+
B7,x21202,2322
|
24
|
+
C7,x32310,0001
|
25
|
+
C#7,x46464,1112
|
26
|
+
D7,x00212,2223
|
27
|
+
E7,020100,1202
|
28
|
+
F7,131211,2313
|
29
|
+
F#7,242322,3424
|
30
|
+
G7,320001,0212
|
31
|
+
G#7,464544,1323
|
32
|
+
AM7,x02120,1100
|
33
|
+
CM7,x32000,0002
|
34
|
+
DM7,xx0222,2224
|
35
|
+
EM7,xx2444,1302
|
36
|
+
FM7,132211,2413
|
37
|
+
Cadd9,x32033,0203
|
38
|
+
Fadd9,xx3213,0010
|
39
|
+
Dsus2,xx0230,2200
|
40
|
+
Asus2,x02200,1341
|
41
|
+
Asus4,x02230,2200
|
42
|
+
Dsus4,xx0233,0230
|
43
|
+
Esus4,022200,4400
|
44
|
+
A7sus4,002030,0200
|
45
|
+
G7sus4,353533,0213
|
46
|
+
Am,002210,1000
|
47
|
+
Bm,x24432,3222
|
48
|
+
Cm,x35543,0333
|
49
|
+
C#m,x46654,1104
|
50
|
+
Dm,x00231,2210
|
51
|
+
Em,022000,0432
|
52
|
+
Fm,133111,1013
|
53
|
+
F#m,244222,2120
|
54
|
+
Gm,355333,0231
|
55
|
+
G#m,466444,4342
|
56
|
+
Am7,002010,0433
|
57
|
+
A#m7,x13121,1111
|
58
|
+
Bm7,x24232,2222
|
59
|
+
Cm7,x35343,3333
|
60
|
+
C#m7,x46454,1102
|
61
|
+
Dm7,x00211,2213
|
62
|
+
Em7,020030,0202
|
63
|
+
Fm7,131111,1313
|
64
|
+
F#m7,242222,2424
|
65
|
+
Gm7,353333,0211
|
66
|
+
Am9,x05557,1032
|
67
|
+
Bm11,x20220,4200
|
68
|
+
F#m11,202200,4420
|
69
|
+
A/C#,042220,2100
|
70
|
+
A/E,00222x,2100
|
71
|
+
A/F#,202220,2100
|
72
|
+
Bb/A,x00331,3210
|
73
|
+
C/B,x22010,0002
|
74
|
+
C/E,032010,0003
|
75
|
+
D/A,x04232,2220
|
76
|
+
D/F#,200232,2220
|
77
|
+
F/A,x03211,2010
|
78
|
+
G/B,x20003,4232
|
79
|
+
C7/G,3323xx,0001
|
80
|
+
D7/F#,200212,2223
|
81
|
+
G7/F,123003,0212
|
82
|
+
D9/F#,2x0210,5425
|
83
|
+
Am/D,xx0210,2203
|
84
|
+
Am/G,302210,0000
|
85
|
+
A#m/D#,xx1321,2214
|
86
|
+
Dm/F,10323x,2210
|
87
|
+
Gm/Bb,x10333,0231
|
88
|
+
G#dim,4564xx,1202
|
89
|
+
D#dim7,xx1212,2323
|
90
|
+
G#dim7,456464,1212
|
@@ -1,130 +1,16 @@
|
|
1
|
-
|
2
|
-
FINGERINGS = {
|
3
|
-
# Major Chords
|
4
|
-
'A': '002220',
|
5
|
-
'B': 'x24442',
|
6
|
-
'Bb': 'x13331',
|
7
|
-
'C': 'x32010',
|
8
|
-
'C#': 'x46664',
|
9
|
-
'D': 'xx0232',
|
10
|
-
'D#': 'x68886',
|
11
|
-
'E': '022100',
|
12
|
-
'Eb': 'x68886',
|
13
|
-
'F': '133211',
|
14
|
-
'F#': '244322',
|
15
|
-
'G': '320003',
|
16
|
-
'G#': '466544',
|
17
|
-
|
18
|
-
# Root/Five Chords
|
19
|
-
'C5': 'x355xx',
|
20
|
-
'D5': 'x577xx',
|
21
|
-
'D#5': 'x688xx',
|
22
|
-
|
23
|
-
# Six Chords
|
24
|
-
'C6': 'x32210',
|
25
|
-
'D6': 'xx0202',
|
26
|
-
'E6': '022120',
|
27
|
-
'G6': '320000',
|
28
|
-
|
29
|
-
# Seventh Chords
|
30
|
-
'A7': '002020',
|
31
|
-
'B7': 'x21202',
|
32
|
-
'C7': 'x32310',
|
33
|
-
'C#7': 'x46464',
|
34
|
-
'D7': 'x00212',
|
35
|
-
'E7': '020100',
|
36
|
-
'F7': '131211',
|
37
|
-
'F#7': '242322',
|
38
|
-
'G7': '320001',
|
39
|
-
'G#7': '464544',
|
40
|
-
|
41
|
-
# Major Seventh Chords
|
42
|
-
'AM7': 'x02120',
|
43
|
-
'CM7': 'x32000',
|
44
|
-
'DM7': 'xx0222',
|
45
|
-
'EM7': 'xx2444',
|
46
|
-
'FM7': '132211',
|
47
|
-
|
48
|
-
# Major 9th Chords
|
49
|
-
'Cadd9': 'x32033',
|
50
|
-
'Fadd9': 'xx3213',
|
51
|
-
|
52
|
-
# Major Suspended 2nd Chords
|
53
|
-
'Dsus2': 'xx0230',
|
54
|
-
'Asus2': 'x02200',
|
55
|
-
|
56
|
-
# Major Suspended 4th Chords
|
57
|
-
'Asus4': 'x02230',
|
58
|
-
'Dsus4': 'xx0233',
|
59
|
-
'Esus4': '022200',
|
1
|
+
require 'csv'
|
60
2
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
# Minor Chords
|
66
|
-
'Am': '002210',
|
67
|
-
'Bm': 'x24432',
|
68
|
-
'Cm': 'x35543',
|
69
|
-
'C#m': 'x46654',
|
70
|
-
'Dm': 'x00231',
|
71
|
-
'Em': '022000',
|
72
|
-
'Fm': '133111',
|
73
|
-
'F#m': '244222',
|
74
|
-
'Gm': '355333',
|
75
|
-
'G#m': '466444',
|
76
|
-
|
77
|
-
# Minor Seventh Chords
|
78
|
-
'Am7': '002010',
|
79
|
-
'A#m7': 'x13121',
|
80
|
-
'Bm7': 'x24232',
|
81
|
-
'Cm7': 'x35343',
|
82
|
-
'C#m7': 'x46454',
|
83
|
-
'Dm7': 'x00211',
|
84
|
-
'Em7': '020030',
|
85
|
-
'Fm7': '131111',
|
86
|
-
'F#m7': '242222',
|
87
|
-
'Gm7': '353333',
|
88
|
-
|
89
|
-
# Minor Ninth Chotds
|
90
|
-
'Am9': "x05557",
|
91
|
-
|
92
|
-
# Minor Eleventh Chords
|
93
|
-
'Bm11': 'x20220',
|
94
|
-
'F#m11': '202200',
|
95
|
-
|
96
|
-
# Major Chords with Bass Notes
|
97
|
-
'A/C#': '042220',
|
98
|
-
'A/E': '00222x',
|
99
|
-
'A/F#': '202220',
|
100
|
-
'Bb/A': 'x00331',
|
101
|
-
'C/B': 'x22010',
|
102
|
-
'C/E': '032010',
|
103
|
-
'D/A': 'x04232',
|
104
|
-
'D/F#': '200232',
|
105
|
-
'F/A': 'x03211',
|
106
|
-
'G/B': 'x20003',
|
107
|
-
|
108
|
-
# Seventh Chords with Bass Notes
|
109
|
-
'C7/G': '3323xx',
|
110
|
-
'D7/F#': '200212',
|
111
|
-
'G7/F': '123003',
|
112
|
-
|
113
|
-
# Ninth Chords with Bass Notes
|
114
|
-
'D9/F#': '2x0210',
|
3
|
+
module ChordDiagrams
|
4
|
+
guitar_fingerings = {}
|
5
|
+
ukulele_fingerings = {}
|
115
6
|
|
116
|
-
|
117
|
-
'Am/D': 'xx0210',
|
118
|
-
'Am/G': '302210',
|
119
|
-
'A#m/D#': 'xx1321',
|
120
|
-
'Dm/F': '10323x',
|
121
|
-
'Gm/Bb': 'x10333',
|
7
|
+
fingerings_file = File.join(File.expand_path(File.dirname(__FILE__)), 'fingerings.csv')
|
122
8
|
|
123
|
-
|
124
|
-
|
9
|
+
CSV.foreach(fingerings_file, headers: true) do |row|
|
10
|
+
guitar_fingerings[row[0]] = row[1] unless row[1].nil?
|
11
|
+
ukulele_fingerings[row[0]] = row[2] unless row[2].nil?
|
12
|
+
end
|
125
13
|
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
}.freeze
|
130
|
-
end
|
14
|
+
GUITAR_FINGERINGS = guitar_fingerings.freeze
|
15
|
+
UKULELE_FINGERINGS = ukulele_fingerings.freeze
|
16
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chord_diagrams
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Kelly
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-07-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: victor
|
@@ -98,6 +98,7 @@ files:
|
|
98
98
|
- bin/setup
|
99
99
|
- chord_diagrams.gemspec
|
100
100
|
- lib/chord_diagrams.rb
|
101
|
+
- lib/chord_diagrams/fingerings.csv
|
101
102
|
- lib/chord_diagrams/fingerings.rb
|
102
103
|
- lib/chord_diagrams/version.rb
|
103
104
|
homepage: https://github.com/spilth/chord_diagrams
|