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.
- checksums.yaml +7 -0
- data/LICENSE.txt +21 -0
- data/README.md +187 -0
- data/db/schema.rb +83 -0
- data/lib/jazz_model/base.rb +13 -6
- data/lib/jazz_model/chord.rb +50 -70
- data/lib/jazz_model/chord_collection.rb +21 -45
- data/lib/jazz_model/chord_quality.rb +5 -6
- data/lib/jazz_model/chord_scale.rb +13 -13
- data/lib/jazz_model/chord_symbol.rb +14 -12
- data/lib/jazz_model/chord_symbol_collection.rb +3 -10
- data/lib/jazz_model/chord_tone.rb +20 -21
- data/lib/jazz_model/definition.rb +18 -18
- data/lib/jazz_model/definitions/default.rb +316 -321
- data/lib/jazz_model/definitions/keys.rb +36 -36
- data/lib/jazz_model/definitions.rb +3 -0
- data/lib/jazz_model/key.rb +22 -25
- data/lib/jazz_model/key_context.rb +31 -22
- data/lib/jazz_model/mode.rb +30 -35
- data/lib/jazz_model/mode_context.rb +22 -26
- data/lib/jazz_model/mode_sequence.rb +13 -12
- data/lib/jazz_model/notes_collection.rb +64 -71
- data/lib/jazz_model/scale.rb +63 -85
- data/lib/jazz_model/scale_tone.rb +14 -15
- data/lib/jazz_model/tone.rb +47 -48
- data/lib/jazz_model/tone_sequence.rb +56 -58
- data/lib/jazz_model/version.rb +2 -2
- data/lib/jazz_model/voicing.rb +6 -7
- data/lib/jazz_model/voicing_tone.rb +5 -6
- data/lib/jazz_model.rb +7 -10
- metadata +104 -141
- data/CHANGELOG.rdoc +0 -14
- data/Gemfile +0 -4
- data/README.rdoc +0 -186
- data/Rakefile +0 -14
- data/lib/jazz_model/note_sequence.rb +0 -15
- data/spec/chord_collection_spec.rb +0 -21
- data/spec/chord_quality_spec.rb +0 -27
- data/spec/chord_scale_spec.rb +0 -7
- data/spec/chord_spec.rb +0 -29
- data/spec/chord_symbol_spec.rb +0 -6
- data/spec/chord_tone_spec.rb +0 -6
- data/spec/definition_spec.rb +0 -35
- data/spec/key_context_spec.rb +0 -27
- data/spec/key_spec.rb +0 -15
- data/spec/mode_spec.rb +0 -9
- data/spec/notes_collection_spec.rb +0 -25
- data/spec/scale_spec.rb +0 -42
- data/spec/scale_tone_spec.rb +0 -6
- data/spec/spec_helper.rb +0 -12
- data/spec/tone_sequence_spec.rb +0 -17
- data/spec/tone_spec.rb +0 -4
- data/spec/voicing_spec.rb +0 -6
- data/spec/voicing_tone_spec.rb +0 -6
data/spec/key_context_spec.rb
DELETED
|
@@ -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,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
|
data/spec/scale_tone_spec.rb
DELETED
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
|
data/spec/tone_sequence_spec.rb
DELETED
|
@@ -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
data/spec/voicing_spec.rb
DELETED