jazz_model 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/README.md +187 -0
  4. data/db/schema.rb +83 -0
  5. data/lib/jazz_model/base.rb +13 -6
  6. data/lib/jazz_model/chord.rb +50 -70
  7. data/lib/jazz_model/chord_collection.rb +21 -45
  8. data/lib/jazz_model/chord_quality.rb +5 -6
  9. data/lib/jazz_model/chord_scale.rb +13 -13
  10. data/lib/jazz_model/chord_symbol.rb +14 -12
  11. data/lib/jazz_model/chord_symbol_collection.rb +3 -10
  12. data/lib/jazz_model/chord_tone.rb +20 -21
  13. data/lib/jazz_model/definition.rb +18 -18
  14. data/lib/jazz_model/definitions/default.rb +316 -321
  15. data/lib/jazz_model/definitions/keys.rb +36 -36
  16. data/lib/jazz_model/definitions.rb +3 -0
  17. data/lib/jazz_model/key.rb +22 -25
  18. data/lib/jazz_model/key_context.rb +31 -22
  19. data/lib/jazz_model/mode.rb +30 -35
  20. data/lib/jazz_model/mode_context.rb +22 -26
  21. data/lib/jazz_model/mode_sequence.rb +13 -12
  22. data/lib/jazz_model/notes_collection.rb +64 -71
  23. data/lib/jazz_model/scale.rb +63 -85
  24. data/lib/jazz_model/scale_tone.rb +14 -15
  25. data/lib/jazz_model/tone.rb +47 -48
  26. data/lib/jazz_model/tone_sequence.rb +56 -58
  27. data/lib/jazz_model/version.rb +2 -2
  28. data/lib/jazz_model/voicing.rb +6 -7
  29. data/lib/jazz_model/voicing_tone.rb +5 -6
  30. data/lib/jazz_model.rb +7 -10
  31. metadata +104 -141
  32. data/CHANGELOG.rdoc +0 -14
  33. data/Gemfile +0 -4
  34. data/README.rdoc +0 -186
  35. data/Rakefile +0 -14
  36. data/lib/jazz_model/note_sequence.rb +0 -15
  37. data/spec/chord_collection_spec.rb +0 -21
  38. data/spec/chord_quality_spec.rb +0 -27
  39. data/spec/chord_scale_spec.rb +0 -7
  40. data/spec/chord_spec.rb +0 -29
  41. data/spec/chord_symbol_spec.rb +0 -6
  42. data/spec/chord_tone_spec.rb +0 -6
  43. data/spec/definition_spec.rb +0 -35
  44. data/spec/key_context_spec.rb +0 -27
  45. data/spec/key_spec.rb +0 -15
  46. data/spec/mode_spec.rb +0 -9
  47. data/spec/notes_collection_spec.rb +0 -25
  48. data/spec/scale_spec.rb +0 -42
  49. data/spec/scale_tone_spec.rb +0 -6
  50. data/spec/spec_helper.rb +0 -12
  51. data/spec/tone_sequence_spec.rb +0 -17
  52. data/spec/tone_spec.rb +0 -4
  53. data/spec/voicing_spec.rb +0 -6
  54. data/spec/voicing_tone_spec.rb +0 -6
@@ -1,27 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe JazzModel::KeyContext do
4
- describe "chord without context" do
5
- subject { JazzModel::Chord['maj7'] }
6
-
7
- it "should accept key context" do
8
- subject.in_key_of('G').key.name.should == 'G'
9
- end
10
-
11
- it "should should accept then remove key context" do
12
- subject.in_key_of('G').without_key.key.should be_nil
13
- end
14
- end
15
-
16
- describe "chord with context" do
17
- subject { JazzModel::Chord['Fmaj7'] }
18
-
19
- it "should have correct context" do
20
- subject.key.name.should == 'F'
21
- end
22
-
23
- it "should be put out of context" do
24
- subject.without_key.key.should be_nil
25
- end
26
- end
27
- end
data/spec/key_spec.rb DELETED
@@ -1,15 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe JazzModel::Key do
4
- it "should default to C" do
5
- JazzModel::Key.default.name.should == "C"
6
- end
7
-
8
- it "should expose 12 primary keys" do
9
- JazzModel::Key.should have(12).primaries
10
- end
11
-
12
- it "should treat Eb and D# as enharmonic" do
13
- JazzModel::Key['Eb'].should be_enharmonic_with(JazzModel::Key['D#'])
14
- end
15
- end
data/spec/mode_spec.rb DELETED
@@ -1,9 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe JazzModel::Mode do
4
- subject { JazzModel::Scale['CMajor'].modes['Dorian'] }
5
-
6
- it "should yield correct notes" do
7
- subject.notes.should == ['D', 'E', 'F', 'G', 'A', 'B', 'C']
8
- end
9
- end
@@ -1,25 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe JazzModel::NotesCollection do
4
- it "should recognize invalid keys" do
5
- JazzModel::NotesCollection['C,E,G,H'].should have(3).keys
6
- end
7
-
8
- it "should accept key context" do
9
- JazzModel::NotesCollection['C,E,G,A'].in_key_of('A').should have(1).chords
10
- end
11
-
12
- pairings = {
13
- 'A C E G' => %w[Amin7 C6]
14
- }
15
-
16
- pairings.each do |notes, chords|
17
- context "as #{notes}" do
18
- it "should give correct chords" do
19
- notes_collection = JazzModel::NotesCollection[notes]
20
- notes_collection.should_not be_nil
21
- notes_collection.chords.symbols.to_set.should == chords.to_set
22
- end
23
- end
24
- end
25
- end
data/spec/scale_spec.rb DELETED
@@ -1,42 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe JazzModel::Scale do
4
- subject { JazzModel::Scale['Major'] }
5
-
6
- it { should be_valid }
7
-
8
- it "should recognize symmetric scale" do
9
- JazzModel::Scale['Diminished'].should be_symmetric
10
- end
11
-
12
- it "should recognize asymmetric scale" do
13
- JazzModel::Scale['Major'].should_not be_symmetric
14
- end
15
-
16
- it "should accept numeric mode context" do
17
- subject.in_mode(2).notes.first.should == 'D'
18
- end
19
-
20
- it "should accept named mode context" do
21
- subject.in_mode('Dorian').notes.first.should == 'D'
22
- end
23
-
24
- it "should remove mode context" do
25
- subject.in_mode('Dorian').without_mode.notes.first.should == 'C'
26
- end
27
-
28
- pairings = {
29
- 'C Major' => %w[C D E F G A B],
30
- 'C Harmonic Minor' => %w[C D Eb F G Ab B]
31
- }
32
-
33
- pairings.each do |scale, notes|
34
- context "as #{scale}" do
35
- it "should give correct notes" do
36
- scale = JazzModel::Scale[scale]
37
- scale.should_not be_nil
38
- scale.notes.should == notes
39
- end
40
- end
41
- end
42
- end
@@ -1,6 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe JazzModel::ScaleTone do
4
- subject { JazzModel::ScaleTone.new }
5
- it { should be_valid }
6
- end
data/spec/spec_helper.rb DELETED
@@ -1,12 +0,0 @@
1
- require "rspec"
2
- require "shoulda"
3
- require "active_support"
4
- require "active_model"
5
- require "jazz_model"
6
-
7
- RSpec.configure do |config|
8
-
9
- end
10
-
11
- # TODO: Move to context in individual specs, or test in a separate namespace
12
- JazzModel::Base.load_definitions
@@ -1,17 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe JazzModel::ToneSequence do
4
- subject { JazzModel::Chord['Cmaj7'] }
5
-
6
- it "should should accept key context" do
7
- subject.tones.in_key_of('F').notes.first.should == 'F'
8
- end
9
-
10
- it "should yield all notes" do
11
- subject.tones.all.first.position.should == 1
12
- end
13
-
14
- it "should accept mode context" do
15
- subject.tones.in_mode(2).notes.first.should == 'E'
16
- end
17
- end
data/spec/tone_spec.rb DELETED
@@ -1,4 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe JazzModel::Tone do
4
- end
data/spec/voicing_spec.rb DELETED
@@ -1,6 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe JazzModel::Voicing do
4
- subject { JazzModel::Voicing.new }
5
- it { should be_valid }
6
- end
@@ -1,6 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe JazzModel::VoicingTone do
4
- subject { JazzModel::VoicingTone.new }
5
- it { should be_valid }
6
- end