motion-music 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/lib/motion-music/version.rb +1 -1
  3. data/lib/rb-music/version.rb +1 -1
  4. metadata +2 -70
  5. data/.gitignore +0 -6
  6. data/Gemfile +0 -8
  7. data/Guardfile +0 -6
  8. data/doc/Gemfile.html +0 -111
  9. data/doc/Gemfile_lock.html +0 -168
  10. data/doc/Guardfile.html +0 -111
  11. data/doc/LICENSE.html +0 -124
  12. data/doc/Object.html +0 -116
  13. data/doc/RBMusic.html +0 -164
  14. data/doc/RBMusic/Interval.html +0 -440
  15. data/doc/RBMusic/Note.html +0 -620
  16. data/doc/RBMusic/NoteSet.html +0 -277
  17. data/doc/RBMusic/Scale.html +0 -274
  18. data/doc/README_md.html +0 -163
  19. data/doc/created.rid +0 -8
  20. data/doc/fonts.css +0 -167
  21. data/doc/fonts/Lato-Light.ttf +0 -0
  22. data/doc/fonts/Lato-LightItalic.ttf +0 -0
  23. data/doc/fonts/Lato-Regular.ttf +0 -0
  24. data/doc/fonts/Lato-RegularItalic.ttf +0 -0
  25. data/doc/fonts/SourceCodePro-Bold.ttf +0 -0
  26. data/doc/fonts/SourceCodePro-Regular.ttf +0 -0
  27. data/doc/images/add.png +0 -0
  28. data/doc/images/arrow_up.png +0 -0
  29. data/doc/images/brick.png +0 -0
  30. data/doc/images/brick_link.png +0 -0
  31. data/doc/images/bug.png +0 -0
  32. data/doc/images/bullet_black.png +0 -0
  33. data/doc/images/bullet_toggle_minus.png +0 -0
  34. data/doc/images/bullet_toggle_plus.png +0 -0
  35. data/doc/images/date.png +0 -0
  36. data/doc/images/delete.png +0 -0
  37. data/doc/images/find.png +0 -0
  38. data/doc/images/loadingAnimation.gif +0 -0
  39. data/doc/images/macFFBgHack.png +0 -0
  40. data/doc/images/package.png +0 -0
  41. data/doc/images/page_green.png +0 -0
  42. data/doc/images/page_white_text.png +0 -0
  43. data/doc/images/page_white_width.png +0 -0
  44. data/doc/images/plugin.png +0 -0
  45. data/doc/images/ruby.png +0 -0
  46. data/doc/images/tag_blue.png +0 -0
  47. data/doc/images/tag_green.png +0 -0
  48. data/doc/images/transparent.png +0 -0
  49. data/doc/images/wrench.png +0 -0
  50. data/doc/images/wrench_orange.png +0 -0
  51. data/doc/images/zoom.png +0 -0
  52. data/doc/index.html +0 -93
  53. data/doc/js/darkfish.js +0 -140
  54. data/doc/js/jquery.js +0 -18
  55. data/doc/js/navigation.js +0 -142
  56. data/doc/js/search.js +0 -109
  57. data/doc/js/search_index.js +0 -1
  58. data/doc/js/searcher.js +0 -228
  59. data/doc/projections_json.html +0 -115
  60. data/doc/rb-music_gemspec.html +0 -132
  61. data/doc/rdoc.css +0 -580
  62. data/doc/table_of_contents.html +0 -192
  63. data/lib/rb-music.rb +0 -8
  64. data/motion-music.gemspec +0 -20
  65. data/projections.json +0 -12
  66. data/rb-music.gemspec +0 -29
  67. data/spec/rb-music/constants_spec.rb +0 -27
  68. data/spec/rb-music/interval_spec.rb +0 -90
  69. data/spec/rb-music/note_set_spec.rb +0 -191
  70. data/spec/rb-music/note_spec.rb +0 -318
  71. data/spec/rb-music/scale_spec.rb +0 -88
  72. data/spec/spec_helper.rb +0 -14
@@ -1,192 +0,0 @@
1
- <!DOCTYPE html>
2
-
3
- <html>
4
- <head>
5
- <meta charset="UTF-8">
6
-
7
- <title>Table of Contents - RDoc Documentation</title>
8
-
9
- <link href="./fonts.css" rel="stylesheet">
10
- <link href="./rdoc.css" rel="stylesheet">
11
-
12
- <script type="text/javascript">
13
- var rdoc_rel_prefix = "./";
14
- </script>
15
-
16
- <script src="./js/jquery.js"></script>
17
- <script src="./js/navigation.js"></script>
18
- <script src="./js/search_index.js"></script>
19
- <script src="./js/search.js"></script>
20
- <script src="./js/searcher.js"></script>
21
- <script src="./js/darkfish.js"></script>
22
-
23
-
24
- <body id="top" class="table-of-contents">
25
- <main role="main">
26
- <h1 class="class">Table of Contents - RDoc Documentation</h1>
27
-
28
-
29
- <h2 id="classes">Classes and Modules</h2>
30
- <ul>
31
- <li class="class">
32
- <a href="Object.html">Object</a>
33
- </li>
34
- <li class="module">
35
- <a href="RBMusic.html">RBMusic</a>
36
- </li>
37
- <li class="class">
38
- <a href="RBMusic/Interval.html">RBMusic::Interval</a>
39
- </li>
40
- <li class="class">
41
- <a href="RBMusic/Note.html">RBMusic::Note</a>
42
- </li>
43
- <li class="class">
44
- <a href="RBMusic/NoteSet.html">RBMusic::NoteSet</a>
45
- </li>
46
- <li class="class">
47
- <a href="RBMusic/Scale.html">RBMusic::Scale</a>
48
- </li>
49
- </ul>
50
-
51
- <h2 id="methods">Methods</h2>
52
- <ul>
53
-
54
- <li class="method">
55
- <a href="RBMusic/Note.html#method-c-from_latin">::from_latin</a>
56
- &mdash;
57
- <span class="container">RBMusic::Note</span>
58
-
59
- <li class="method">
60
- <a href="RBMusic/Interval.html#method-c-from_name">::from_name</a>
61
- &mdash;
62
- <span class="container">RBMusic::Interval</span>
63
-
64
- <li class="method">
65
- <a href="RBMusic/Interval.html#method-c-from_semitones">::from_semitones</a>
66
- &mdash;
67
- <span class="container">RBMusic::Interval</span>
68
-
69
- <li class="method">
70
- <a href="RBMusic/Interval.html#method-c-from_tones_semitones">::from_tones_semitones</a>
71
- &mdash;
72
- <span class="container">RBMusic::Interval</span>
73
-
74
- <li class="method">
75
- <a href="RBMusic/NoteSet.html#method-c-new">::new</a>
76
- &mdash;
77
- <span class="container">RBMusic::NoteSet</span>
78
-
79
- <li class="method">
80
- <a href="RBMusic/Scale.html#method-c-new">::new</a>
81
- &mdash;
82
- <span class="container">RBMusic::Scale</span>
83
-
84
- <li class="method">
85
- <a href="RBMusic/Interval.html#method-c-new">::new</a>
86
- &mdash;
87
- <span class="container">RBMusic::Interval</span>
88
-
89
- <li class="method">
90
- <a href="RBMusic/Note.html#method-c-new">::new</a>
91
- &mdash;
92
- <span class="container">RBMusic::Note</span>
93
-
94
- <li class="method">
95
- <a href="RBMusic/Note.html#method-i-3D-3D">#==</a>
96
- &mdash;
97
- <span class="container">RBMusic::Note</span>
98
-
99
- <li class="method">
100
- <a href="RBMusic/Note.html#method-i-accidental">#accidental</a>
101
- &mdash;
102
- <span class="container">RBMusic::Note</span>
103
-
104
- <li class="method">
105
- <a href="RBMusic/NoteSet.html#method-i-add">#add</a>
106
- &mdash;
107
- <span class="container">RBMusic::NoteSet</span>
108
-
109
- <li class="method">
110
- <a href="RBMusic/Interval.html#method-i-add">#add</a>
111
- &mdash;
112
- <span class="container">RBMusic::Interval</span>
113
-
114
- <li class="method">
115
- <a href="RBMusic/Note.html#method-i-add">#add</a>
116
- &mdash;
117
- <span class="container">RBMusic::Note</span>
118
-
119
- <li class="method">
120
- <a href="RBMusic/Scale.html#method-i-degree_count">#degree_count</a>
121
- &mdash;
122
- <span class="container">RBMusic::Scale</span>
123
-
124
- <li class="method">
125
- <a href="RBMusic/Note.html#method-i-enharmonic-3F">#enharmonic?</a>
126
- &mdash;
127
- <span class="container">RBMusic::Note</span>
128
-
129
- <li class="method">
130
- <a href="RBMusic/Note.html#method-i-enharmonically_equivalent_to-3F">#enharmonically_equivalent_to?</a>
131
- &mdash;
132
- <span class="container">RBMusic::Note</span>
133
-
134
- <li class="method">
135
- <a href="RBMusic/Note.html#method-i-frequency">#frequency</a>
136
- &mdash;
137
- <span class="container">RBMusic::Note</span>
138
-
139
- <li class="method">
140
- <a href="RBMusic/Note.html#method-i-latin">#latin</a>
141
- &mdash;
142
- <span class="container">RBMusic::Note</span>
143
-
144
- <li class="method">
145
- <a href="RBMusic/Scale.html#method-i-notes_in_range">#notes_in_range</a>
146
- &mdash;
147
- <span class="container">RBMusic::Scale</span>
148
-
149
- <li class="method">
150
- <a href="RBMusic/Note.html#method-i-octave">#octave</a>
151
- &mdash;
152
- <span class="container">RBMusic::Note</span>
153
-
154
- <li class="method">
155
- <a href="RBMusic/Note.html#method-i-scale">#scale</a>
156
- &mdash;
157
- <span class="container">RBMusic::Note</span>
158
-
159
- <li class="method">
160
- <a href="RBMusic/Interval.html#method-i-semitone">#semitone</a>
161
- &mdash;
162
- <span class="container">RBMusic::Interval</span>
163
-
164
- <li class="method">
165
- <a href="RBMusic/Interval.html#method-i-subtract">#subtract</a>
166
- &mdash;
167
- <span class="container">RBMusic::Interval</span>
168
-
169
- <li class="method">
170
- <a href="RBMusic/Note.html#method-i-subtract">#subtract</a>
171
- &mdash;
172
- <span class="container">RBMusic::Note</span>
173
-
174
- <li class="method">
175
- <a href="RBMusic/NoteSet.html#method-i-subtract">#subtract</a>
176
- &mdash;
177
- <span class="container">RBMusic::NoteSet</span>
178
-
179
- <li class="method">
180
- <a href="RBMusic/Interval.html#method-i-tone_semitone">#tone_semitone</a>
181
- &mdash;
182
- <span class="container">RBMusic::Interval</span>
183
- </ul>
184
- </main>
185
-
186
-
187
- <footer id="validator-badges" role="contentinfo">
188
- <p><a href="http://validator.w3.org/check/referer">Validate</a>
189
- <p>Generated by <a href="http://rdoc.rubyforge.org">RDoc</a> 4.1.1.
190
- <p>Based on <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
191
- </footer>
192
-
@@ -1,8 +0,0 @@
1
- dir = File.dirname(__FILE__) + '/rb-music'
2
- require dir + '/constants'
3
- require dir + '/note'
4
- require dir + '/scale'
5
- require dir + '/note_set'
6
- require dir + '/interval'
7
-
8
- include RBMusic
@@ -1,20 +0,0 @@
1
- $LOAD_PATH.push File.expand_path("../lib", __FILE__)
2
- require "motion-music/version"
3
-
4
- Gem::Specification.new do |s|
5
- s.name = "motion-music"
6
- s.version = MotionMusic::VERSION
7
- s.platform = Gem::Platform::RUBY
8
- s.license = "MIT"
9
- s.summary = "Music theory library for RubyMotion"
10
- s.description = "This gem wraps the rb-music gem to provide RubyMotion classes for working with musical notes, scales and intervals."
11
- s.author = "Mark Wise"
12
- s.authors = ["Mark Wise"]
13
- s.email = ["markmediadude@mgail.comm"]
14
- s.files = `git ls-files`.split($\)
15
- s.homepage = "https://rubygems.org/mwise/motion-music"
16
-
17
- s.require_paths = ["lib"]
18
-
19
- s.extra_rdoc_files = ['README.md']
20
- end
@@ -1,12 +0,0 @@
1
- {
2
- "lib/rb-music/*.rb": {
3
- "command": "sources",
4
- "alternate": "./spec/rb-music/%s_spec.rb",
5
- "reverse_layout": false
6
- },
7
- "spec/rb-music/*_spec.rb": {
8
- "command": "specs",
9
- "alternate": "./lib/rb-music/%s.rb",
10
- "reverse_layout": true
11
- }
12
- }
@@ -1,29 +0,0 @@
1
- $LOAD_PATH.push File.expand_path("../lib", __FILE__)
2
- require "rb-music/version"
3
-
4
- Gem::Specification.new do |s|
5
- s.name = "rb-music"
6
- s.version = RBMusic::VERSION
7
- s.platform = Gem::Platform::RUBY
8
- s.license = "MIT"
9
- s.summary = "Music theory library for Ruby"
10
- s.description = "This gem provides Ruby classes for working with musical notes, scales and intervals."
11
- s.author = "Mark Wise"
12
- s.authors = ["Mark Wise"]
13
- s.email = ["markmediadude@mgail.comm"]
14
- s.files = ["lib/rb-music.rb"]
15
- s.homepage = "https://rubygems.org/mwise/rb-music"
16
-
17
- s.require_paths = ["lib"]
18
- s.required_ruby_version = ">= 1.8.6"
19
- s.files = `git ls-files -- lib/*`.split("\n")
20
- s.files += %w[README.md LICENSE]
21
- s.test_files = `git ls-files -- spec/*`.split("\n")
22
-
23
- s.extra_rdoc_files = ['README.md']
24
-
25
- s.add_development_dependency("guard-rspec")
26
- s.add_development_dependency("rake")
27
- s.add_development_dependency("rspec")
28
- s.add_development_dependency("simplecov")
29
- end
@@ -1,27 +0,0 @@
1
- require_relative '../spec_helper'
2
-
3
- describe "RBMusic Constants" do
4
-
5
- describe RBMusic::NOTE_NAMES do
6
- it "is correct" do
7
- subject.should == ["F", "C", "G", "D", "A", "E", "B"]
8
- end
9
- end
10
-
11
- describe RBMusic::ACCIDENTALS do
12
- it "is correct" do
13
- subject.should == ["bb", "b", "", "#", "x"]
14
- end
15
- end
16
-
17
- describe RBMusic::NOTES do
18
- it "contains a key for each note/accidental combination" do
19
- RBMusic::NOTE_NAMES.each do |note_name|
20
- ACCIDENTALS.each do |accidental|
21
- NOTES.should have_key("#{note_name}#{accidental}")
22
- end
23
- end
24
- end
25
- end
26
-
27
- end
@@ -1,90 +0,0 @@
1
- require_relative '../spec_helper'
2
-
3
- describe RBMusic::Interval do
4
-
5
- context "after initialization" do
6
- let(:subject) { described_class.new("some coord") }
7
-
8
- it "assigns the coord argument" do
9
- subject.coord.should == "some coord"
10
- end
11
- end
12
-
13
- describe "class methods" do
14
- describe "#from_name" do
15
- it "looks up the correct coordinates" do
16
- subject = described_class.from_name("major_second")
17
-
18
- subject.coord.should == described_class::INTERVALS[:major_second]
19
- end
20
- end
21
-
22
- describe "#from_semitones" do
23
- it "looks up the correct coordinates" do
24
- subject = described_class.from_semitones(3)
25
-
26
- subject.coord.should == described_class::INTERVALS_SEMITONES[3]
27
- end
28
- end
29
-
30
- describe "#from_tones_semitones" do
31
- it "looks up the correct coordinates" do
32
- subject = described_class.from_tones_semitones([0, 3])
33
-
34
- subject.coord.should == [9, -15]
35
- end
36
- end
37
- end
38
-
39
- describe "instance methods" do
40
- let(:subject) { described_class.from_name("major_second") }
41
-
42
- describe "#tone_semitone" do
43
- it "returns the tone / semitone vector" do
44
- subject.tone_semitone.should == [1, 0]
45
- end
46
- end
47
-
48
- describe "#semitone" do
49
- it "returns number of semitones" do
50
- subject.semitone.should == 2
51
- end
52
- end
53
-
54
- describe "#add" do
55
- context "when given a string" do
56
- it "adds the string as an Interval" do
57
- result = subject.add("major_second")
58
- result.coord.should == Interval.from_name("major_third").coord
59
- end
60
- end
61
-
62
- context "when given an Interval" do
63
- it "adds the given Interval's coordinates and returns a new Interval" do
64
- result = subject.add(described_class.from_name("minor_second"))
65
- result.coord.should == Interval.from_name("minor_third").coord
66
- end
67
- end
68
- end
69
-
70
- describe "#subtract" do
71
- context "when given a string" do
72
- it "returns a Interval with the given string as Interval subtracted" do
73
- result = subject.subtract("major_second")
74
- result.coord.should == Interval.from_name("unison").coord
75
- end
76
- end
77
-
78
- context "when given an Interval" do
79
- it "subtracts the coordinates of the given Interval and returns a new Interval" do
80
- subject = described_class.from_name("major_third")
81
- result = subject.subtract(described_class.from_name("major_second"))
82
-
83
- result.coord.should == Interval.from_name("major_second").coord
84
- end
85
- end
86
- end
87
-
88
- end
89
-
90
- end
@@ -1,191 +0,0 @@
1
- require_relative '../spec_helper'
2
-
3
- describe RBMusic::NoteSet do
4
-
5
- describe "class methods" do
6
- describe "#from_scale" do
7
- let(:scale) { RBMusic::Scale.new("C", "major") }
8
-
9
- context "without any arguments" do
10
- it "raises an ArgumentError" do
11
- lambda {
12
- described_class.from_scale
13
- }.should raise_error(ArgumentError)
14
- end
15
- end
16
-
17
- context "without a valid RBMusic::Scale" do
18
- it "raises an ArgumentError" do
19
- lambda {
20
- described_class.from_scale("foo")
21
- }.should raise_error(RBMusic::ArgumentError)
22
- end
23
- end
24
-
25
- context "with a RBMusic::Scale only" do
26
- let(:subject) { described_class.from_scale(scale) }
27
-
28
- it "returns a #{described_class}" do
29
- subject.should be_a(described_class)
30
- end
31
-
32
- it "builds a note for each scale degree in the default octave ranage (1)" do
33
- subject.notes.length.should == scale.degree_count
34
- end
35
-
36
- it "builds notes from the default octave (0)" do
37
- subject.notes[0].should == Note.from_latin("#{scale.key}0")
38
- end
39
- end
40
-
41
- context "with a RBMusic::Scale and an octave" do
42
- let(:octave) { 3 }
43
- let(:subject) { described_class.from_scale(scale, octave) }
44
-
45
- it "builds notes for the scale from the given octave" do
46
- subject.notes[0].should == Note.from_latin("#{scale.key}#{octave}")
47
- subject.notes.length.should == scale.degree_count
48
- end
49
- end
50
-
51
- context "with a RBMusic::Scale, octave and octave range" do
52
- let(:octave) { 3 }
53
- let(:octaves) { 2 }
54
- let(:subject) { described_class.from_scale(scale, octave, octaves) }
55
-
56
- it "builds notes for the given octave range" do
57
- degrees = scale.degree_count
58
-
59
- subject.notes[0].should == Note.from_latin("#{scale.key}#{octave}")
60
- subject.notes[degrees].should == Note.from_latin("#{scale.key}#{octave + 1}")
61
- subject.notes.length.should == scale.degree_count * octaves
62
- end
63
- end
64
-
65
- context "with an invalid octave range" do
66
- it "raises an ArgumentError" do
67
- lambda {
68
- described_class.from_scale(scale, 3, -1)
69
- }.should raise_exception(RBMusic::ArgumentError)
70
- end
71
- end
72
- end
73
- end
74
-
75
- describe "instance methods" do
76
-
77
- describe "#initialize" do
78
- let(:notes_array) { ["foo", "bar"] }
79
-
80
- it "assigns the notes array" do
81
- subject = described_class.new(notes_array)
82
-
83
- subject.notes.should == notes_array
84
- end
85
- end
86
-
87
- describe "#==" do
88
- let(:notes) { ["foo", "bar"] }
89
-
90
- context "when all the notes are equal" do
91
- it "is true" do
92
- described_class.new(notes).should == described_class.new(notes)
93
- end
94
- end
95
-
96
- context "when note all the notes are equal" do
97
- it "is false" do
98
- described_class.new(notes).should_not == described_class.new([1, 2])
99
- end
100
- end
101
- end
102
-
103
- describe "#add" do
104
- let(:f4) { Note.from_latin("F4") }
105
- let(:g4) { Note.from_latin("G4") }
106
- let(:subject) { NoteSet.new([f4, g4]) }
107
-
108
- context "when adding an interval string" do
109
- let(:operand) { "major_second" }
110
-
111
- it "retuns a new NoteSet with the operand added to each element of the original" do
112
- result = subject.add(operand)
113
-
114
- result.should be_a(NoteSet)
115
- result[0].frequency.should == subject[0].add(operand).frequency
116
- result[1].frequency.should == subject[1].add(operand).frequency
117
- end
118
- end
119
-
120
- context "when adding an interval symbol" do
121
- let(:operand) { :major_second }
122
-
123
- it "retuns a new NoteSet with the operand added to each element of the original" do
124
- result = subject.add(operand)
125
-
126
- result.should be_a(NoteSet)
127
- result[0].frequency.should == subject[0].add(operand).frequency
128
- result[1].frequency.should == subject[1].add(operand).frequency
129
- end
130
- end
131
-
132
- context "when adding an note" do
133
- let(:operand) { Note.from_latin("C4") }
134
-
135
- it "retuns a new NoteSet with the operand added to each element of the original" do
136
- result = subject.add(operand)
137
-
138
- result.should be_a(NoteSet)
139
- result[0].frequency.should == subject[0].add(operand).frequency
140
- result[1].frequency.should == subject[1].add(operand).frequency
141
- end
142
- end
143
-
144
- end
145
-
146
- describe "#subtract" do
147
- let(:f4) { Note.from_latin("F4") }
148
- let(:g4) { Note.from_latin("G4") }
149
- let(:subject) { NoteSet.new([f4, g4]) }
150
-
151
- context "when subtracting an interval string" do
152
- let(:operand) { "major_second" }
153
-
154
- it "retuns a new NoteSet with the operand subtracted to each element of the original" do
155
- result = subject.subtract(operand)
156
-
157
- result.should be_a(NoteSet)
158
- result[0].frequency.should == subject[0].subtract(operand).frequency
159
- result[1].frequency.should == subject[1].subtract(operand).frequency
160
- end
161
- end
162
-
163
- context "when subtracting an interval symbol" do
164
- let(:operand) { :major_second }
165
-
166
- it "retuns a new NoteSet with the operand subtracted to each element of the original" do
167
- result = subject.subtract(operand)
168
-
169
- result.should be_a(NoteSet)
170
- result[0].frequency.should == subject[0].subtract(operand).frequency
171
- result[1].frequency.should == subject[1].subtract(operand).frequency
172
- end
173
- end
174
-
175
- context "when subtracting an note" do
176
- let(:operand) { Note.from_latin("C4") }
177
-
178
- it "retuns a new NoteSet with the operand subtracted to each element of the original" do
179
- result = subject.subtract(operand)
180
-
181
- result.should be_a(NoteSet)
182
- result[0].coord.should == subject[0].subtract(operand).coord
183
- result[1].coord.should == subject[1].subtract(operand).coord
184
- end
185
- end
186
-
187
- end
188
-
189
- end
190
-
191
- end