chordy 0.7.1 → 0.7.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,3 +6,6 @@ before_install:
6
6
  - gem update --system
7
7
  - gem install bundler
8
8
  - gem --version
9
+ after_install:
10
+ - rake build
11
+
data/Gemfile CHANGED
@@ -6,11 +6,11 @@ source "http://rubygems.org"
6
6
  # Add dependencies to develop your gem here.
7
7
  # Include everything needed to run rake, tests, features, etc.
8
8
  group :development do
9
- gem "shoulda", ">= 0"
9
+ gem "shoulda"
10
10
  gem "rake", ">=10.0.2"
11
11
  gem "rdoc", ">= 3.12"
12
12
  gem "bundler", ">= 1.2.3"
13
13
  gem "jeweler", ">= 1.8.4"
14
- gem "simplecov", ">= 0"
15
- gem "ruby-debug19", ">= 0"
14
+ gem "jekyll", ">= 0.11.2"
15
+ gem "debugger"
16
16
  end
@@ -1,7 +1,7 @@
1
1
  = chordy {<img src="https://travis-ci.org/darth10/chordy.png" />}[https://travis-ci.org/darth10/chordy]
2
2
 
3
3
  chordy is a DSL written in Ruby for printing guitar chord diagrams.
4
- A chordy script produces output that looks like a song with various chords, sections and notes.
4
+ A chordy script produces output that looks like a song with various chords, sections and arbitrary text.
5
5
 
6
6
  It supports all chord families and most chord types.
7
7
  Variations in a note, such as a palm-mute or a trill, are also supported.
@@ -9,95 +9,183 @@ Formatting options are also provided.
9
9
 
10
10
  == Installation
11
11
 
12
- <em>Ruby Gems</em> is required.
13
-
14
- Download the latest gem distribution from the {downloads page}[http://github.com/darth10/chordy/downloads]
15
- and run <code>gem install chordy.gem</code> to install chordy.
12
+ <em>Ruby Gems</em> is required. Run <code>gem install chordy</code> to install the gem.
16
13
 
17
14
  == Usage
18
15
 
19
16
  After installing the chordy gem, you can start chordy in an interactive mode through <code>irb</code>.
20
17
  You can declare chords to play using the <code>play</code> function.
21
18
 
19
+ The <code>play</code> function takes one required arugment, which can be a chord family like C or F#.
20
+ There are a handful of notations to specify a chord family.
21
+ For example, the C chord family can be represented as <code>C</code>, <code>:C</code> or <code>"C"</code>.
22
+ Similarly, F sharp is <code>FSharp</code>, <code>:F!</code> or <code>"F!"</code>.
23
+ A <code>!</code> suffix denotes a sharp, and <code>_</code> denotes a flat.
24
+
22
25
  $ irb -r chordy
23
- irb(main):001:0> play C
24
- E [--3-]
25
- A [--3-]
26
- D [--2-]
26
+ 1.9.3p327 :001 > play C
27
+ e [--0-]
28
+ b [--1-]
27
29
  G [--0-]
28
- B [--1-]
29
- E [--0-]
30
-
31
-
32
- => #<C:0x4d896f8 @flags=0, @strings=[3, 3, 2, 0, 1, 0], @type=:major>
33
-
34
- irb(main):002:0> play EFlat
35
- E [--3-----]
36
- A [--3---1-]
37
- D [--2---1-]
30
+ D [--2-]
31
+ A [--3-]
32
+ E [--3-]
33
+
34
+
35
+ => #<Chordy::C:0x9288e54 @strings=[3, 3, 2, 0, 1, 0], @type=:major, @flags=0>
36
+
37
+ 1.9.3p327 :002 > play :F!
38
+ e [--0---2-]
39
+ b [--1---2-]
38
40
  G [--0---3-]
39
- B [--1---4-]
40
- E [--0---3-]
41
-
42
-
43
- => #<DSharp:0x4d7afc8 @flags=0, @strings=[-1, 1, 1, 3, 4, 3], @type=:major>
44
-
45
- irb(main):003:0>
41
+ D [--2---4-]
42
+ A [--3---4-]
43
+ E [--3---2-]
44
+
45
+
46
+ => #<Chordy::FSharp:0x92673f8 @strings=[2, 4, 4, 3, 2, 2], @type=:major, @flags=0>
47
+
48
+ 1.9.3p327 :003 > play :E_
49
+ e [--0---2---3-]
50
+ b [--1---2---4-]
51
+ G [--0---3---3-]
52
+ D [--2---4---1-]
53
+ A [--3---4---1-]
54
+ E [--3---2-----]
55
+
56
+
57
+ => #<Chordy::DSharp:0x9258e70 @strings=[-1, 1, 1, 3, 4, 3], @type=:major, @flags=0>
58
+
59
+ 1.9.3p327 :004 >
46
60
 
47
61
  To specify a chord type such a minor or a suspended chord, specify a second parameter such as <code>:minor</code> or <code>:suspended_4</code>.
48
62
  The chord type can also specified in a shorter way like <code>:m</code> or <code>:sus4</code>.
49
63
  Note that the default for this parameter is <code>:major</code>, which is shortened to <code>:M</code>.
50
64
  This {wiki page}[http://darth10.github.com/chordy/chords.html] contains a complete listing of all chord families and types.
51
65
 
52
- irb(main):001:0> play C, :minor
53
- E [----]
54
- A [--3-]
66
+ 1.9.3p327 :001 > play C, :minor
67
+ e [--3-]
68
+ b [--4-]
69
+ G [--0-]
55
70
  D [--1-]
71
+ A [--3-]
72
+ E [----]
73
+
74
+
75
+ => #<Chordy::C:0xa1d0650 @strings=[-1, 3, 1, 0, 4, 3], @type=:minor, @flags=0>
76
+
77
+ 1.9.3p327 :002 > play :E_, :sus4
78
+ e [--3---4-]
79
+ b [--4---4-]
80
+ G [--0---1-]
81
+ D [--1---1-]
82
+ A [--3---1-]
83
+ E [--------]
84
+
85
+
86
+ => #<Chordy::DSharp:0xa1ae668 @strings=[-1, 1, 1, 1, 4, 4], @type=:suspended_4, @flags=0>
87
+
88
+ 1.9.3p327 :003 >
89
+
90
+ Chords are printed in high-to-low string order by default.
91
+ To switch to low-to-high and high-to-string orders for printing, use the <code>do_low_to_high</code> and <code>do_high_to_low</code> functions respectively.
92
+ Note that chords are always internally represented in low-to-high string order.
93
+
94
+ 1.9.3p327 :001 > play C
95
+ e [--0-]
96
+ b [--1-]
56
97
  G [--0-]
57
- B [--4-]
98
+ D [--2-]
99
+ A [--3-]
58
100
  E [--3-]
101
+
59
102
 
103
+ => #<Chordy::C:0x940be84 @strings=[3, 3, 2, 0, 1, 0], @type=:major, @flags=0>
104
+
105
+ 1.9.3p327 :002 > play D
106
+ e [--0---2-]
107
+ b [--1---3-]
108
+ G [--0---2-]
109
+ D [--2---0-]
110
+ A [--3---0-]
111
+ E [--3-----]
112
+
60
113
 
61
- => #<C:0xb72e1924 @flags=0, @strings=[-1, 3, 1, 0, 4, 3], @type=:minor>
114
+ => #<Chordy::D:0x93ea658 @strings=[-1, 0, 0, 2, 3, 2], @type=:major, @flags=0>
62
115
 
63
- irb(main):002:0> play E, :sus4
64
- E [------0-]
65
- A [--3---2-]
66
- D [--1---2-]
116
+ 1.9.3p327 :003 > do_low_to_high
117
+ E [--3-----]
118
+ A [--3---0-]
119
+ D [--2---0-]
67
120
  G [--0---2-]
68
- B [--4---0-]
69
- E [--3---0-]
121
+ b [--1---3-]
122
+ e [--0---2-]
123
+
70
124
 
125
+ => nil
71
126
 
72
- => #<E:0xb72df138 @flags=0, @strings=[0, 2, 2, 2, 0, 0], @type=:suspended_4>
127
+ 1.9.3p327 :004 > do_high_to_low
128
+ e [--0---2-]
129
+ b [--1---3-]
130
+ G [--0---2-]
131
+ D [--2---0-]
132
+ A [--3---0-]
133
+ E [--3-----]
134
+
73
135
 
74
- irb(main):003:0>
136
+ => nil
137
+
138
+ 1.9.3p327 :005 >
75
139
 
76
140
  A chord can also be described in terms of it's strings, by just passing an array of integers to the <code>play</code> function.
141
+ The array represents the individual strings of chord in high-to-low string order.
142
+ You can specify low-to-high string order for playing a chord by adding a <code>:low_to_high</code> argument.
77
143
 
78
- irb(main):001:0> play [5]
79
- E [--5-]
80
- A [----]
81
- D [----]
144
+ 1.9.3-p327 :001 > play [5]
145
+ e [--5-]
146
+ b [----]
82
147
  G [----]
83
- B [----]
148
+ D [----]
149
+ A [----]
84
150
  E [----]
151
+
85
152
 
86
-
87
- => #<Chord:0xb726e2e4 @strings=[5, -1, -1, -1, -1, -1], @flags=0>
88
-
89
- irb(main):002:0> play [2, 4, 4]
90
- E [--5---2-]
91
- A [------4-]
92
- D [------4-]
153
+ => #<Chordy::Chord:0x9602440 @strings=[-1, -1, -1, -1, -1, 5], @flags=0>
154
+
155
+ 1.9.3-p327 :002 > play [5], :low_to_high
156
+ e [--5-----]
157
+ b [--------]
93
158
  G [--------]
94
- B [--------]
95
- E [--------]
159
+ D [--------]
160
+ A [--------]
161
+ E [------5-]
162
+
96
163
 
164
+ => #<Chordy::Chord:0x95f8af8 @strings=[5, -1, -1, -1, -1, -1], @flags=0>
165
+
166
+ 1.9.3-p327 :003 > play [2, 4, 4]
167
+ e [--5-------2-]
168
+ b [----------4-]
169
+ G [----------4-]
170
+ D [------------]
171
+ A [------------]
172
+ E [------5-----]
173
+
97
174
 
98
- => #<Chord:0xb726b01c @strings=[2, 4, 4, -1, -1, -1], @flags=0>
175
+ => #<Chordy::Chord:0x95a9bd8 @strings=[-1, -1, -1, 4, 4, 2], @flags=0>
176
+
177
+ 1.9.3-p327 :004 > play [2, 4, 4], :low_to_high
178
+ e [--5-------2-----]
179
+ b [----------4-----]
180
+ G [----------4-----]
181
+ D [--------------4-]
182
+ A [--------------4-]
183
+ E [------5-------2-]
184
+
99
185
 
100
- irb(main):003:0>
186
+ => #<Chordy::Chord:0x958d99c @strings=[2, 4, 4, -1, -1, -1], @flags=0>
187
+
188
+ 1.9.3-p327 :005 >
101
189
 
102
190
  You can also play variations in notes, such as a muted chord or a harmonic.
103
191
  To play a variation, you can either use the <code>play</code> function suffixed with the variation name to play.
@@ -105,60 +193,110 @@ Alternatively, you could use the name of the variation itself as a function, whi
105
193
  For example, the <code>play_mute</code> function plays a muted chord, and the <code>slide_down</code> function plays multiple chords with a slide down.
106
194
  This {wiki page}[http://darth10.github.com/chordy/chords.html] contains a complete listing of all supported varations.
107
195
 
108
- irb(main):001:0> play_mute A
109
- E [--0-]
110
- A [--0-]
111
- D [--2-]
196
+ An interesting consequence is that variations can overlap.
197
+ It's possible that a chord can have a <code>mute</code> as well as a <code>slide_down</code> variation.
198
+ Of course, all such combinations are not possible.
199
+ You won't get an error, but the printing will appear unaffected.
200
+ For example, it's not possible to print both variations in a chord with both <code>mute</code> and <code>harmonic</code> variations.
201
+
202
+ 1.9.3-p327 :001 > play_mute A
203
+ e [--0-]
204
+ b [--2-]
112
205
  G [--2-]
113
- B [--2-]
206
+ D [--2-]
207
+ A [--0-]
114
208
  E [--0-]
115
- M
116
-
117
- => #<A:0x4d85018 @flags=1, @strings=[0, 0, 2, 2, 2, 0], @type=:major>
209
+ M
118
210
 
119
- irb(main):002:0> slide_down {
120
- irb(main):003:1* play [2, 2, 4]
121
- irb(main):004:1> play [4, 4, 6]
122
- irb(main):005:1> }
123
- E [--0---2\--4\]
124
- A [--0---2\--4\]
125
- D [--2---4\--6\]
211
+ => #<Chordy::A:0x9f95fac @strings=[0, 0, 2, 2, 2, 0], @type=:major, @flags=1>
212
+
213
+ 1.9.3-p327 :002 > slide_down {
214
+ 1.9.3-p327 :003 > play [2, 4, 4], :low_to_high
215
+ 1.9.3-p327 :004?> play [4, 6, 6], :low_to_high
216
+ 1.9.3-p327 :005?> }
217
+ e [--0---------]
218
+ b [--2---------]
126
219
  G [--2---------]
127
- B [--2---------]
128
- E [--0---------]
129
- M
220
+ D [--2---4\--6\]
221
+ A [--0---4\--6\]
222
+ E [--0---2\--4\]
223
+ M
224
+
225
+ => #<Chordy::Chord:0x9d36914 @strings=[4, 6, 6, -1, -1, -1], @flags=32>
226
+
227
+ 1.9.3-p327 :006 > mute { slide_down { play [6] } }
228
+ e [--0-----------6\]
229
+ b [--2-------------]
230
+ G [--2-------------]
231
+ D [--2---4\--6\----]
232
+ A [--0---4\--6\----]
233
+ E [--0---2\--4\----]
234
+ M M
130
235
 
131
- => #<Chord:0x4d4a1a0 @flags=32, @strings=[4, 4, 6, -1, -1, -1]>
236
+ => #<Chordy::Chord:0x9fbbf7c @strings=[-1, -1, -1, -1, -1, 6], @flags=33>
237
+
238
+ 1.9.3-p327 :007 > harmonic { mute { play [6] } }
239
+ e [--0-----------6\-|--6-]
240
+ b [--2--------------|----]
241
+ G [--2--------------|----]
242
+ D [--2---4\--6\-----|----]
243
+ A [--0---4\--6\-----|----]
244
+ E [--0---2\--4\-----|----]
245
+ M M M
132
246
 
133
- irb(main):006:0>
247
+ => #<Chordy::Chord:0x9faed40 @strings=[-1, -1, -1, -1, -1, 6], @flags=3>
248
+
249
+ 1.9.3-p327 :008 >
134
250
 
135
251
  Chordy also supports different tunings.
136
252
  The <code>tune</code> function can be used to change the tuning, and has to be supplied with a tuning parameter.
137
- A tuning is represented as a variable prefixed with <em>tuning_</em>, followed by the number of strings in the tuning and the name of the tuning.
138
- For example, <code>tuning_7_a</code> represents A-tuning on a 7-string instrument.
253
+ A tuning is represented as <em>tuning_x_y</em>, where <em>x</em> is the number of strings in the tuning and <em>y</em> is the name of the tuning.
254
+ You must also prefix the <code>Chordy</code> module name.
255
+ For example, <code>Chordy.tuning_7_a</code> represents A-tuning on a 7-string instrument.
139
256
  This {wiki page}[http://darth10.github.com/chordy/tuning.html] contains a complete listing of all supported tunings.
140
257
 
141
- irb(main):001:0> tuning_7_a
142
- => ["a", "d", "g", "c", "f", "a", "d"]
143
-
144
- irb(main):002:0> tune tuning_7_a
145
- => nil
258
+ 1.9.3-p327 :001 > play :C
259
+ e [--0-]
260
+ b [--1-]
261
+ G [--0-]
262
+ D [--2-]
263
+ A [--3-]
264
+ E [--3-]
265
+
146
266
 
147
- irb(main):003:0> play C
148
- A [----]
149
- D [--3-]
150
- G [--3-]
267
+ => #<Chordy::C:0x98f60e8 @strings=[3, 3, 2, 0, 1, 0], @type=:major, @flags=0>
268
+
269
+ 1.9.3-p327 :002 > Chordy.tuning_7_a
270
+ => ["a", "d", "g", "c", "f", "a", "d"]
271
+
272
+ 1.9.3-p327 :003 > tune Chordy.tuning_7_a
273
+ d [--0-]
274
+ a [--1-]
275
+ f [--0-]
151
276
  C [--2-]
152
- F [--0-]
153
- A [--1-]
154
- D [--0-]
155
-
277
+ G [--3-]
278
+ D [--3-]
279
+ A [----]
280
+
156
281
 
157
- => #<C:0x4d67018 @flags=0, @strings=[-1, 3, 3, 2, 0, 1, 0], @type=:major>
282
+ => nil
283
+
284
+ 1.9.3-p327 :004 > play D
285
+ d [--0---2-]
286
+ a [--1---3-]
287
+ f [--0---2-]
288
+ C [--2---0-]
289
+ G [--3---0-]
290
+ D [--3-----]
291
+ A [--------]
292
+
158
293
 
159
- irb(main):004:0>
294
+ => #<Chordy::D:0x989dc04 @strings=[-1, -1, 0, 0, 2, 3, 2], @type=:major, @flags=0>
295
+
296
+ 1.9.3-p327 :005 >
160
297
 
161
298
  You could also script the chords to play by using <code>require 'chordy_script'</code>.
299
+ Just be sure to call <code>print_chords</code>.
162
300
  Here's a sample chordy script.
163
301
 
164
302
  # 'sample.rb'
@@ -172,16 +310,84 @@ Here's a sample chordy script.
172
310
  play [-1, 3, 3, 2, 0, 1, -1]
173
311
  play [-1, 0, 2, 2]
174
312
 
313
+ print_chords
314
+
175
315
  Here's what the output of the script looks like.
176
316
 
177
- $ ruby sample.rb
178
- # TODO #
317
+ $ ruby -r rubygems sample.rb
318
+ e [--0---0---3---0--|--3-----]
319
+ b [--1---0---4---0--|--3---0-]
320
+ G [--0---1---0---0--|--2---2-]
321
+ D [--2---2---1---2--|--0---2-]
322
+ A [--3---2---3---2--|--1-----]
323
+ E [--3---0-------0--|--------]
324
+
325
+ Text can be added by using <code>text</code>.
326
+ To provide structure to your output, use <code>section</code> to separate chords.
327
+ Here's the previous script with some text and sections.
179
328
 
180
- TODO sections and text
329
+ # sample.rb
330
+ require 'chordy_script'
331
+
332
+ text "Some tune"
333
+
334
+ section "Intro"
335
+
336
+ play :C
337
+ play "E"
338
+
339
+ section "Phrase 1"
340
+
341
+ play :C, :m
342
+ play "E", "minor"
343
+
344
+ section "Phrase 2"
345
+
346
+ play [-1, 3, 3, 2, 0, 1, -1]
347
+ play [-1, 0, 2, 2]
348
+
349
+ print_chords
350
+
351
+ Here's the output of the modified script.
352
+
353
+ $ ruby -r rubygems sample.rb
354
+ Some tune
355
+
356
+ --Intro---------------------------------
357
+
358
+ e [--0---0-]
359
+ b [--1---0-]
360
+ G [--0---1-]
361
+ D [--2---2-]
362
+ A [--3---2-]
363
+ E [--3---0-]
364
+
365
+
366
+ --Phrase 1------------------------------
367
+
368
+ e [--3---0-]
369
+ b [--4---0-]
370
+ G [--0---0-]
371
+ D [--1---2-]
372
+ A [--3---2-]
373
+ E [------0-]
374
+
375
+
376
+ --Phrase 2------------------------------
377
+
378
+ e [--3-----]
379
+ b [--3---0-]
380
+ G [--2---2-]
381
+ D [--0---2-]
382
+ A [--1-----]
383
+ E [--------]
181
384
 
182
385
  == Documentation
183
386
 
184
- Visit the wiki[http://darth10.github.com/chordy] for more information. To generate the API documentation, use <code>rake rdoc</code>.
387
+ The {API documentation}[http://rubydoc.info/github/darth10/chordy/frames/file/README.rdoc] is available on RDoc.info.
388
+ You could also generate the RDoc yourself by using <code>rake rdoc</code>.
389
+
390
+ Visit the wiki[http://darth10.github.com/chordy] for more information.
185
391
 
186
392
  == Contributing
187
393
 
@@ -193,4 +399,3 @@ Visit the wiki[http://darth10.github.com/chordy] for more information. To genera
193
399
  * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
194
400
  * Make sure your code is formatted as described in the Github Ruby style-guide.
195
401
  * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
196
-