chordy 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,8 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.2
4
+ - 1.9.3
5
+ before_install:
6
+ - gem update --system
7
+ - gem install bundler
8
+ - gem --version
data/Gemfile ADDED
@@ -0,0 +1,16 @@
1
+ source "http://rubygems.org"
2
+ # Add dependencies required to use your gem here.
3
+ # Example:
4
+ # gem "activesupport", ">= 2.3.5"
5
+
6
+ # Add dependencies to develop your gem here.
7
+ # Include everything needed to run rake, tests, features, etc.
8
+ group :development do
9
+ gem "shoulda", ">= 0"
10
+ gem "rake", ">=10.0.2"
11
+ gem "rdoc", ">= 3.12"
12
+ gem "bundler", ">= 1.2.3"
13
+ gem "jeweler", ">= 1.8.4"
14
+ gem "simplecov", ">= 0"
15
+ gem "ruby-debug19", ">= 0"
16
+ end
@@ -0,0 +1,24 @@
1
+ = chordy
2
+
3
+ The MIT License
4
+
5
+ Copyright (c) 2012 Akhil Wali
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining
8
+ a copy of this software and associated documentation files (the
9
+ "Software"), to deal in the Software without restriction, including
10
+ without limitation the rights to use, copy, modify, merge, publish,
11
+ distribute, sublicense, and/or sell copies of the Software, and to
12
+ permit persons to whom the Software is furnished to do so, subject to
13
+ the following conditions:
14
+
15
+ The above copyright notice and this permission notice shall be
16
+ included in all copies or substantial portions of the Software.
17
+
18
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
22
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,196 @@
1
+ = chordy {<img src="https://travis-ci.org/darth10/chordy.png" />}[https://travis-ci.org/darth10/chordy]
2
+
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.
5
+
6
+ It supports all chord families and most chord types.
7
+ Variations in a note, such as a palm-mute or a trill, are also supported.
8
+ Formatting options are also provided.
9
+
10
+ == Installation
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.
16
+
17
+ == Usage
18
+
19
+ After installing the chordy gem, you can start chordy in an interactive mode through <code>irb</code>.
20
+ You can declare chords to play using the <code>play</code> function.
21
+
22
+ $ irb -r chordy
23
+ irb(main):001:0> play C
24
+ E [--3-]
25
+ A [--3-]
26
+ D [--2-]
27
+ 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-]
38
+ 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>
46
+
47
+ 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
+ The chord type can also specified in a shorter way like <code>:m</code> or <code>:sus4</code>.
49
+ Note that the default for this parameter is <code>:major</code>, which is shortened to <code>:M</code>.
50
+ This {wiki page}[http://darth10.github.com/chordy/chords.html] contains a complete listing of all chord families and types.
51
+
52
+ irb(main):001:0> play C, :minor
53
+ E [----]
54
+ A [--3-]
55
+ D [--1-]
56
+ G [--0-]
57
+ B [--4-]
58
+ E [--3-]
59
+
60
+
61
+ => #<C:0xb72e1924 @flags=0, @strings=[-1, 3, 1, 0, 4, 3], @type=:minor>
62
+
63
+ irb(main):002:0> play E, :sus4
64
+ E [------0-]
65
+ A [--3---2-]
66
+ D [--1---2-]
67
+ G [--0---2-]
68
+ B [--4---0-]
69
+ E [--3---0-]
70
+
71
+
72
+ => #<E:0xb72df138 @flags=0, @strings=[0, 2, 2, 2, 0, 0], @type=:suspended_4>
73
+
74
+ irb(main):003:0>
75
+
76
+ 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.
77
+
78
+ irb(main):001:0> play [5]
79
+ E [--5-]
80
+ A [----]
81
+ D [----]
82
+ G [----]
83
+ B [----]
84
+ E [----]
85
+
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-]
93
+ G [--------]
94
+ B [--------]
95
+ E [--------]
96
+
97
+
98
+ => #<Chord:0xb726b01c @strings=[2, 4, 4, -1, -1, -1], @flags=0>
99
+
100
+ irb(main):003:0>
101
+
102
+ You can also play variations in notes, such as a muted chord or a harmonic.
103
+ To play a variation, you can either use the <code>play</code> function suffixed with the variation name to play.
104
+ Alternatively, you could use the name of the variation itself as a function, which takes a block of chords to be played.
105
+ 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
+ This {wiki page}[http://darth10.github.com/chordy/chords.html] contains a complete listing of all supported varations.
107
+
108
+ irb(main):001:0> play_mute A
109
+ E [--0-]
110
+ A [--0-]
111
+ D [--2-]
112
+ G [--2-]
113
+ B [--2-]
114
+ E [--0-]
115
+ M
116
+
117
+ => #<A:0x4d85018 @flags=1, @strings=[0, 0, 2, 2, 2, 0], @type=:major>
118
+
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\]
126
+ G [--2---------]
127
+ B [--2---------]
128
+ E [--0---------]
129
+ M
130
+
131
+ => #<Chord:0x4d4a1a0 @flags=32, @strings=[4, 4, 6, -1, -1, -1]>
132
+
133
+ irb(main):006:0>
134
+
135
+ Chordy also supports different tunings.
136
+ 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.
139
+ This {wiki page}[http://darth10.github.com/chordy/tuning.html] contains a complete listing of all supported tunings.
140
+
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
146
+
147
+ irb(main):003:0> play C
148
+ A [----]
149
+ D [--3-]
150
+ G [--3-]
151
+ C [--2-]
152
+ F [--0-]
153
+ A [--1-]
154
+ D [--0-]
155
+
156
+
157
+ => #<C:0x4d67018 @flags=0, @strings=[-1, 3, 3, 2, 0, 1, 0], @type=:major>
158
+
159
+ irb(main):004:0>
160
+
161
+ You could also script the chords to play by using <code>require 'chordy_script'</code>.
162
+ Here's a sample chordy script.
163
+
164
+ # 'sample.rb'
165
+ require 'chordy_script'
166
+
167
+ play :C
168
+ play "E"
169
+ play :C, :m
170
+ play "E", "minor"
171
+
172
+ play [-1, 3, 3, 2, 0, 1, -1]
173
+ play [-1, 0, 2, 2]
174
+
175
+ Here's what the output of the script looks like.
176
+
177
+ $ ruby sample.rb
178
+ # TODO #
179
+
180
+ TODO sections and text
181
+
182
+ == Documentation
183
+
184
+ Visit the wiki[http://darth10.github.com/chordy] for more information. To generate the API documentation, use <code>rake rdoc</code>.
185
+
186
+ == Contributing
187
+
188
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
189
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
190
+ * Fork the project.
191
+ * Start a feature/bugfix branch.
192
+ * Commit and push until you are happy with your contribution.
193
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
194
+ * Make sure your code is formatted as described in the Github Ruby style-guide.
195
+ * 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
+
@@ -0,0 +1,47 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake/dsl_definition'
13
+ require 'rake'
14
+
15
+ require 'jeweler'
16
+ Jeweler::Tasks.new do |gem|
17
+ gem.name = "chordy"
18
+ gem.rubyforge_project = "chordy"
19
+ gem.version = "0.7.1"
20
+ gem.homepage = "http://github.com/darth10/chordy"
21
+ gem.license = "MIT"
22
+ gem.summary = %Q{DSL for guitar chords}
23
+ gem.description = %Q{Chordy is a DSL written in Ruby to print guitar chords diagrams}
24
+ gem.email = "akhil.wali.10@gmail.com"
25
+ gem.authors = ["Akhil Wali"]
26
+ end
27
+ Jeweler::RubygemsDotOrgTasks.new
28
+
29
+ require 'rake/testtask'
30
+ Rake::TestTask.new(:test) do |test|
31
+ test.libs << 'lib' << 'test'
32
+ test.pattern = 'test/**/test_*.rb'
33
+ test.verbose = true
34
+ end
35
+
36
+ task :default => [:test, :build]
37
+
38
+ require 'rdoc/task'
39
+ Rake::RDocTask.new do |rdoc|
40
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
41
+
42
+ rdoc.rdoc_dir = 'rdoc'
43
+ rdoc.title = "chordy #{version}"
44
+ rdoc.rdoc_files.include('README*')
45
+ rdoc.rdoc_files.include('LICENSE.rdoc')
46
+ rdoc.rdoc_files.include('lib/**/*.rb')
47
+ end
@@ -0,0 +1,81 @@
1
+ # encoding: utf-8
2
+
3
+ require 'chord'
4
+
5
+ class A < Chord
6
+ def play_major
7
+ [0, 0, 2, 2, 2, 0]
8
+ end
9
+
10
+ def play_minor
11
+ [0, 0, 2, 2, 1, 0]
12
+ end
13
+
14
+ def play_dominant_7
15
+ [0, 0, 2, 0, 2, 0]
16
+ end
17
+
18
+ def play_dominant_7_5
19
+ [-1, 0, 1, 0, 2, 3]
20
+ end
21
+
22
+ def play_major_6
23
+ [0, 0, 2, 2, 2, 2]
24
+ end
25
+
26
+ def play_major_7
27
+ [0, 0, 2, 1, 2, 0]
28
+ end
29
+
30
+ def play_major_9
31
+ [-1, 2, 2, 2, 2, 3]
32
+ end
33
+
34
+ def play_minor_6
35
+ [2, 0, 2, 2, 1, 2]
36
+ end
37
+
38
+ def play_minor_7
39
+ [0, 0, 2, 0, 1, 0]
40
+ end
41
+
42
+ def play_half_diminished_7
43
+ [-1, 0, 1, 0, 1, 3]
44
+ end
45
+
46
+ def play_minor_major_7
47
+ [0, 0, 2, 1, 1, 0]
48
+ end
49
+
50
+ def play_augmented_5
51
+ [1, 0, 3, 2, 2, 1]
52
+ end
53
+
54
+ def play_augmented_7
55
+ [1, 4, 3, 0, 2, 1]
56
+ end
57
+
58
+ def play_augmented_major_7
59
+ [-1, 0, -1, 1, 2, 1]
60
+ end
61
+
62
+ def play_diminished_5
63
+ [5, 6, 7, 5, 4, 5]
64
+ end
65
+
66
+ def play_diminished_7
67
+ [-1, -1, 1, 2, 1, 2]
68
+ end
69
+
70
+ def play_diminished_9
71
+ [2, -1, 5, 3, 2, 5]
72
+ end
73
+
74
+ def play_suspended_4
75
+ [0, 0, 2, 2, 3, 0]
76
+ end
77
+
78
+ def play_suspended_7
79
+ [0, 0, 2, 0, 3, 0]
80
+ end
81
+ end
@@ -0,0 +1,83 @@
1
+ # encoding: utf-8
2
+
3
+ require 'chord'
4
+
5
+ class ASharp < Chord
6
+ def play_major
7
+ [1, 1, 3, 3, 3, 1]
8
+ end
9
+
10
+ def play_minor
11
+ [1, 1, 3, 3, 2, 1]
12
+ end
13
+
14
+ def play_dominant_7
15
+ [1, 1, 3, 1, 3, 1]
16
+ end
17
+
18
+ def play_dominant_7_5
19
+ [0, 1, 2, 1, 3, 4]
20
+ end
21
+
22
+ def play_major_6
23
+ [1, 1, 3, 3, 3, 3]
24
+ end
25
+
26
+ def play_major_7
27
+ [1, 1, 3, 2, 3, 1]
28
+ end
29
+
30
+ def play_major_9
31
+ [-1, 1, 0, 1, 1, 1]
32
+ end
33
+
34
+ def play_minor_6
35
+ [-1, -1, 3, 3, 2, 3]
36
+ end
37
+
38
+ def play_minor_7
39
+ [1, 1, 3, 1, 2, 1]
40
+ end
41
+
42
+ def play_half_diminished_7
43
+ [1, 1, 2, 1, 2, 4]
44
+ end
45
+
46
+ def play_minor_major_7
47
+ [1, 1, 3, 2, 2, 1]
48
+ end
49
+
50
+ def play_augmented_5
51
+ [2, -1, 4, 3, 3, 2]
52
+ end
53
+
54
+ def play_augmented_7
55
+ [-1, 1, 4, 1, 3, 2]
56
+ end
57
+
58
+ def play_augmented_major_7
59
+ [-1, 1, 0, 2, 3, 2]
60
+ end
61
+
62
+ def play_diminished_5
63
+ [0, 1, 2, 3, 2, 0]
64
+ end
65
+
66
+ def play_diminished_7
67
+ [-1, -1, 2, 3, 2, 3]
68
+ end
69
+
70
+ def play_diminished_9
71
+ [1, 1, 0, 1, 0, 1]
72
+ end
73
+
74
+ def play_suspended_4
75
+ [1, 1, 1, 3, 4, 1]
76
+ end
77
+
78
+ def play_suspended_7
79
+ [1, 1, 1, 1, 3, 1]
80
+ end
81
+ end
82
+
83
+ BFlat = ASharp