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
metadata
CHANGED
|
@@ -1,111 +1,109 @@
|
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: jazz_model
|
|
3
|
-
version: !ruby/object:Gem::Version
|
|
4
|
-
|
|
5
|
-
prerelease: false
|
|
6
|
-
segments:
|
|
7
|
-
- 0
|
|
8
|
-
- 1
|
|
9
|
-
- 0
|
|
10
|
-
version: 0.1.0
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.2.0
|
|
11
5
|
platform: ruby
|
|
12
|
-
authors:
|
|
6
|
+
authors:
|
|
13
7
|
- Ben Hughes
|
|
14
|
-
autorequire:
|
|
15
8
|
bindir: bin
|
|
16
9
|
cert_chain: []
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
dependencies:
|
|
21
|
-
- !ruby/object:Gem::Dependency
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
22
13
|
name: activerecord
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
none: false
|
|
26
|
-
requirements:
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
27
16
|
- - ">="
|
|
28
|
-
- !ruby/object:Gem::Version
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
- 0
|
|
34
|
-
version: 3.0.0
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: '7.2'
|
|
19
|
+
- - "<"
|
|
20
|
+
- !ruby/object:Gem::Version
|
|
21
|
+
version: '9'
|
|
35
22
|
type: :runtime
|
|
36
|
-
version_requirements: *id001
|
|
37
|
-
- !ruby/object:Gem::Dependency
|
|
38
|
-
name: activesupport
|
|
39
23
|
prerelease: false
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
25
|
+
requirements:
|
|
26
|
+
- - ">="
|
|
27
|
+
- !ruby/object:Gem::Version
|
|
28
|
+
version: '7.2'
|
|
29
|
+
- - "<"
|
|
30
|
+
- !ruby/object:Gem::Version
|
|
31
|
+
version: '9'
|
|
32
|
+
- !ruby/object:Gem::Dependency
|
|
33
|
+
name: activesupport
|
|
34
|
+
requirement: !ruby/object:Gem::Requirement
|
|
35
|
+
requirements:
|
|
43
36
|
- - ">="
|
|
44
|
-
- !ruby/object:Gem::Version
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
- 0
|
|
50
|
-
version: 3.0.0
|
|
37
|
+
- !ruby/object:Gem::Version
|
|
38
|
+
version: '7.2'
|
|
39
|
+
- - "<"
|
|
40
|
+
- !ruby/object:Gem::Version
|
|
41
|
+
version: '9'
|
|
51
42
|
type: :runtime
|
|
52
|
-
version_requirements: *id002
|
|
53
|
-
- !ruby/object:Gem::Dependency
|
|
54
|
-
name: acts_as_list
|
|
55
43
|
prerelease: false
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
44
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
45
|
+
requirements:
|
|
46
|
+
- - ">="
|
|
47
|
+
- !ruby/object:Gem::Version
|
|
48
|
+
version: '7.2'
|
|
49
|
+
- - "<"
|
|
50
|
+
- !ruby/object:Gem::Version
|
|
51
|
+
version: '9'
|
|
52
|
+
- !ruby/object:Gem::Dependency
|
|
53
|
+
name: acts_as_list
|
|
54
|
+
requirement: !ruby/object:Gem::Requirement
|
|
55
|
+
requirements:
|
|
59
56
|
- - ">="
|
|
60
|
-
- !ruby/object:Gem::Version
|
|
61
|
-
|
|
62
|
-
segments:
|
|
63
|
-
- 0
|
|
64
|
-
- 1
|
|
65
|
-
- 2
|
|
66
|
-
version: 0.1.2
|
|
57
|
+
- !ruby/object:Gem::Version
|
|
58
|
+
version: '1.0'
|
|
67
59
|
type: :runtime
|
|
68
|
-
|
|
69
|
-
|
|
60
|
+
prerelease: false
|
|
61
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
62
|
+
requirements:
|
|
63
|
+
- - ">="
|
|
64
|
+
- !ruby/object:Gem::Version
|
|
65
|
+
version: '1.0'
|
|
66
|
+
- !ruby/object:Gem::Dependency
|
|
70
67
|
name: acts_as_tree
|
|
68
|
+
requirement: !ruby/object:Gem::Requirement
|
|
69
|
+
requirements:
|
|
70
|
+
- - ">="
|
|
71
|
+
- !ruby/object:Gem::Version
|
|
72
|
+
version: '2.9'
|
|
73
|
+
type: :runtime
|
|
71
74
|
prerelease: false
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
requirements:
|
|
75
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
76
|
+
requirements:
|
|
75
77
|
- - ">="
|
|
76
|
-
- !ruby/object:Gem::Version
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
78
|
+
- !ruby/object:Gem::Version
|
|
79
|
+
version: '2.9'
|
|
80
|
+
- !ruby/object:Gem::Dependency
|
|
81
|
+
name: sqlite3
|
|
82
|
+
requirement: !ruby/object:Gem::Requirement
|
|
83
|
+
requirements:
|
|
84
|
+
- - ">="
|
|
85
|
+
- !ruby/object:Gem::Version
|
|
86
|
+
version: '2.0'
|
|
83
87
|
type: :runtime
|
|
84
|
-
version_requirements: *id004
|
|
85
|
-
- !ruby/object:Gem::Dependency
|
|
86
|
-
name: rspec
|
|
87
88
|
prerelease: false
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
type: :development
|
|
99
|
-
version_requirements: *id005
|
|
100
|
-
description: Jazz theory is a mathematical system of concepts and relationships, why not make an ActiveModel representation of those concepts?
|
|
101
|
-
email: ben@railsgarden.com
|
|
89
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
90
|
+
requirements:
|
|
91
|
+
- - ">="
|
|
92
|
+
- !ruby/object:Gem::Version
|
|
93
|
+
version: '2.0'
|
|
94
|
+
description: Jazz theory is a mathematical system of concepts and relationships. Jazz
|
|
95
|
+
Model represents chords, scales, modes, and keys as an ActiveRecord object model
|
|
96
|
+
so you can resolve chord symbols, spell notes in any key, and traverse chord-scale
|
|
97
|
+
relationships.
|
|
98
|
+
email: me@benhughes.name
|
|
102
99
|
executables: []
|
|
103
|
-
|
|
104
100
|
extensions: []
|
|
105
|
-
|
|
106
101
|
extra_rdoc_files: []
|
|
107
|
-
|
|
108
|
-
|
|
102
|
+
files:
|
|
103
|
+
- LICENSE.txt
|
|
104
|
+
- README.md
|
|
105
|
+
- db/schema.rb
|
|
106
|
+
- lib/jazz_model.rb
|
|
109
107
|
- lib/jazz_model/base.rb
|
|
110
108
|
- lib/jazz_model/chord.rb
|
|
111
109
|
- lib/jazz_model/chord_collection.rb
|
|
@@ -115,6 +113,7 @@ files:
|
|
|
115
113
|
- lib/jazz_model/chord_symbol_collection.rb
|
|
116
114
|
- lib/jazz_model/chord_tone.rb
|
|
117
115
|
- lib/jazz_model/definition.rb
|
|
116
|
+
- lib/jazz_model/definitions.rb
|
|
118
117
|
- lib/jazz_model/definitions/default.rb
|
|
119
118
|
- lib/jazz_model/definitions/keys.rb
|
|
120
119
|
- lib/jazz_model/key.rb
|
|
@@ -122,7 +121,6 @@ files:
|
|
|
122
121
|
- lib/jazz_model/mode.rb
|
|
123
122
|
- lib/jazz_model/mode_context.rb
|
|
124
123
|
- lib/jazz_model/mode_sequence.rb
|
|
125
|
-
- lib/jazz_model/note_sequence.rb
|
|
126
124
|
- lib/jazz_model/notes_collection.rb
|
|
127
125
|
- lib/jazz_model/scale.rb
|
|
128
126
|
- lib/jazz_model/scale_tone.rb
|
|
@@ -131,64 +129,29 @@ files:
|
|
|
131
129
|
- lib/jazz_model/version.rb
|
|
132
130
|
- lib/jazz_model/voicing.rb
|
|
133
131
|
- lib/jazz_model/voicing_tone.rb
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
- spec/key_context_spec.rb
|
|
143
|
-
- spec/key_spec.rb
|
|
144
|
-
- spec/mode_spec.rb
|
|
145
|
-
- spec/notes_collection_spec.rb
|
|
146
|
-
- spec/scale_spec.rb
|
|
147
|
-
- spec/scale_tone_spec.rb
|
|
148
|
-
- spec/spec_helper.rb
|
|
149
|
-
- spec/tone_sequence_spec.rb
|
|
150
|
-
- spec/tone_spec.rb
|
|
151
|
-
- spec/voicing_spec.rb
|
|
152
|
-
- spec/voicing_tone_spec.rb
|
|
153
|
-
- CHANGELOG.rdoc
|
|
154
|
-
- Gemfile
|
|
155
|
-
- Rakefile
|
|
156
|
-
- README.rdoc
|
|
157
|
-
has_rdoc: true
|
|
158
|
-
homepage: http://github.com/rubiety/jazz_model
|
|
159
|
-
licenses: []
|
|
160
|
-
|
|
161
|
-
post_install_message:
|
|
132
|
+
homepage: https://github.com/eigenben/jazz_model
|
|
133
|
+
licenses:
|
|
134
|
+
- MIT
|
|
135
|
+
metadata:
|
|
136
|
+
homepage_uri: https://github.com/eigenben/jazz_model
|
|
137
|
+
source_code_uri: https://github.com/eigenben/jazz_model
|
|
138
|
+
bug_tracker_uri: https://github.com/eigenben/jazz_model/issues
|
|
139
|
+
rubygems_mfa_required: 'true'
|
|
162
140
|
rdoc_options: []
|
|
163
|
-
|
|
164
|
-
require_paths:
|
|
141
|
+
require_paths:
|
|
165
142
|
- lib
|
|
166
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
|
167
|
-
|
|
168
|
-
requirements:
|
|
143
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
144
|
+
requirements:
|
|
169
145
|
- - ">="
|
|
170
|
-
- !ruby/object:Gem::Version
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
version: "0"
|
|
175
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
176
|
-
none: false
|
|
177
|
-
requirements:
|
|
146
|
+
- !ruby/object:Gem::Version
|
|
147
|
+
version: '3.2'
|
|
148
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
149
|
+
requirements:
|
|
178
150
|
- - ">="
|
|
179
|
-
- !ruby/object:Gem::Version
|
|
180
|
-
|
|
181
|
-
segments:
|
|
182
|
-
- 1
|
|
183
|
-
- 3
|
|
184
|
-
- 4
|
|
185
|
-
version: 1.3.4
|
|
151
|
+
- !ruby/object:Gem::Version
|
|
152
|
+
version: '0'
|
|
186
153
|
requirements: []
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
rubygems_version: 1.3.7
|
|
190
|
-
signing_key:
|
|
191
|
-
specification_version: 3
|
|
154
|
+
rubygems_version: 3.6.7
|
|
155
|
+
specification_version: 4
|
|
192
156
|
summary: An object model of jazz theory.
|
|
193
157
|
test_files: []
|
|
194
|
-
|
data/CHANGELOG.rdoc
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
== 0.1.0 [2010-10-20] Modernization
|
|
2
|
-
* Upgraded to RSpec 2.0
|
|
3
|
-
* Ditched Controllers/Rails Application
|
|
4
|
-
* Reworked all models to use in-memory ActiveModel instead of ActiveRecord
|
|
5
|
-
* Internal Refactoring
|
|
6
|
-
* Released as a Gem
|
|
7
|
-
|
|
8
|
-
== 2008-08-24:
|
|
9
|
-
* Upgraded to Rails 2.1
|
|
10
|
-
* Refactored models to use new Rails 2.1 features.
|
|
11
|
-
|
|
12
|
-
== Old:
|
|
13
|
-
* Implemented REST Interface
|
|
14
|
-
* Added RSpec
|
data/Gemfile
DELETED
data/README.rdoc
DELETED
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
= Jazz Model
|
|
2
|
-
|
|
3
|
-
Jazz Model is full ActiveRecord model of concepts in Jazz theory, establishing relationships between chords and scales, and much more. Aside from representing jazz theory relationships in the database, jazz model can do key conversions and other operations on these jazz "objects". By default it uses an in-memory sqlite3 database, but it could be persisted elsewhere.
|
|
4
|
-
|
|
5
|
-
== Architecture Overview
|
|
6
|
-
|
|
7
|
-
The core of Jazz Toolbox is a full Ruby object model representing concepts of Jazz theory,
|
|
8
|
-
distilled to their most basic concepts and architected in a very abstract manner. The system
|
|
9
|
-
is data-centric and all "rules" (for example, the tones in a C7 chord) in theory are
|
|
10
|
-
self-contained in the database.
|
|
11
|
-
|
|
12
|
-
All chord/scale/mode/etc. definitions are stored as a mathematical system (sequences of numbers)
|
|
13
|
-
which are then used to perform calculations. For example, putting some chord in a different key
|
|
14
|
-
is a matter of adding a semitone delta and doing modulo 12.
|
|
15
|
-
|
|
16
|
-
While there are currently many chord calculators in existence, to my knowledge this project is the
|
|
17
|
-
first one that attempts to fully represent the entirety of Jazz theory as a mathematical/computational
|
|
18
|
-
system exposed through an elegant object model.
|
|
19
|
-
|
|
20
|
-
Note: the current database consists entirely of my own personal knowledge of Jazz theory. I
|
|
21
|
-
haven't yet scoured through the Jazz theory literature to formalize and expand the current database
|
|
22
|
-
of chords, scales, and chord-scales. There's still a lot of work to do and I have lots of ideas for how to expand this.
|
|
23
|
-
|
|
24
|
-
== Core Features
|
|
25
|
-
|
|
26
|
-
* Scale & Mode Enumeration
|
|
27
|
-
* Handles Variety of Notations
|
|
28
|
-
* ChordTone Enumeration
|
|
29
|
-
* Traversing ScaleChord Relationships with Strength Metric
|
|
30
|
-
* Full Understanding of Theoretic Tones (vs. only Pitches)
|
|
31
|
-
|
|
32
|
-
== Installation
|
|
33
|
-
|
|
34
|
-
Simply include the gem in your Gemfile:
|
|
35
|
-
|
|
36
|
-
gem "jazz_model"
|
|
37
|
-
|
|
38
|
-
From here you can begin using the classes under +JazzModel+ directly, but it won't be much use until you load the definitions:
|
|
39
|
-
|
|
40
|
-
JazzModel::Base.load_definitions
|
|
41
|
-
|
|
42
|
-
== Examples using Default Definitions
|
|
43
|
-
|
|
44
|
-
Everything is under the JazzModel namespace, so first do this if you want to use these classes directly:
|
|
45
|
-
|
|
46
|
-
include JazzModel
|
|
47
|
-
|
|
48
|
-
* Getting a Chord object:
|
|
49
|
-
|
|
50
|
-
Chord['maj7']
|
|
51
|
-
Chord['Bbmaj7'] # <- With Key Context
|
|
52
|
-
Chord['Abmaj7#11']
|
|
53
|
-
...
|
|
54
|
-
|
|
55
|
-
* Getting a Scale object:
|
|
56
|
-
|
|
57
|
-
Scale['Major']
|
|
58
|
-
Scale['Melodic Minor']
|
|
59
|
-
Scale['Diminished']
|
|
60
|
-
...
|
|
61
|
-
|
|
62
|
-
* Getting a particular mode of a scale:
|
|
63
|
-
|
|
64
|
-
Scale['Major'].modes['Dorian'] # By Mode Name
|
|
65
|
-
Scale['Major'].modes[2] # By Mode Index
|
|
66
|
-
|
|
67
|
-
# Or directly index the scale object (same as above):
|
|
68
|
-
Scale['Major']['Dorian']
|
|
69
|
-
Scale['Major'][2]
|
|
70
|
-
|
|
71
|
-
* Enumerate notes of a Chord:
|
|
72
|
-
|
|
73
|
-
Chord['maj'].notes # Defaults to C without specified key context
|
|
74
|
-
# => ['C', 'E', 'G']
|
|
75
|
-
|
|
76
|
-
Chord['Ebmaj7'].notes
|
|
77
|
-
# => ['Eb', 'G', 'Bb', 'D']
|
|
78
|
-
|
|
79
|
-
# Or specify key context with chained methods like this...
|
|
80
|
-
Chord['maj7'].in_key_of('Eb').notes
|
|
81
|
-
|
|
82
|
-
Chord['Bmaj7#11'].notes
|
|
83
|
-
# => ['B', 'D#', 'F#', 'A#', 'E#']
|
|
84
|
-
# Note E# - Correct theoretic value for this chord, not F
|
|
85
|
-
|
|
86
|
-
Chord['Falt'].notes
|
|
87
|
-
Chord['F7b9#9'].notes
|
|
88
|
-
# => ['F', 'A', 'Eb', 'Gb', 'G#', 'C#']
|
|
89
|
-
|
|
90
|
-
Chord['Gbmaj7'].notes
|
|
91
|
-
# => ['Gb', 'Bb', 'Db', 'F']
|
|
92
|
-
|
|
93
|
-
# But...
|
|
94
|
-
|
|
95
|
-
Chord['F#maj7'].notes
|
|
96
|
-
# => ['F#', 'A#', 'C#', 'E#']
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
* Enumerate notes of a Scale:
|
|
100
|
-
|
|
101
|
-
Scale['Major'].notes # Defaults to C without specified key context
|
|
102
|
-
# => ['C', 'D', 'E', 'F', 'G', 'A', 'B']
|
|
103
|
-
|
|
104
|
-
Scale['Eb Major'].notes
|
|
105
|
-
# => ['Eb', 'F', 'G', 'Ab', 'Bb', 'C', 'D']
|
|
106
|
-
|
|
107
|
-
# Or specify key context with chained methods like this:
|
|
108
|
-
Scale['Major'].in_key_of('Eb').notes
|
|
109
|
-
|
|
110
|
-
Scale['Whole Tone'].notes
|
|
111
|
-
# => ['C', 'D', 'E', 'F#', 'G#', 'Bb']
|
|
112
|
-
|
|
113
|
-
Scale['Bebop'].notes
|
|
114
|
-
# => ['C', 'D', 'E', 'F', 'G', 'A', 'Bb', 'B']
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
* Enumerate notes from a Scale Mode:
|
|
118
|
-
|
|
119
|
-
Scale['Major'].in_key_of('Eb').modes['Dorian'].notes
|
|
120
|
-
# => ['F', 'G', 'Ab', 'Bb', 'C', 'D', 'Eb']
|
|
121
|
-
|
|
122
|
-
Scale['Melodic Minor']['Lydian Dominant'].notes
|
|
123
|
-
# => ['F', 'G', 'A', 'B', 'C', 'D', 'Eb']
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
* Enumerate scale modes associated with a chord:
|
|
127
|
-
|
|
128
|
-
Chord['min7'].modes.names # .names == .map(&:name)
|
|
129
|
-
# => ['Dorian']
|
|
130
|
-
Chord['min7'].modes[0].scale.name
|
|
131
|
-
# => "Major"
|
|
132
|
-
|
|
133
|
-
Chord['Amin7'].modes.names
|
|
134
|
-
# => ['A Dorian']
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
* Enumerate chords associated with a scale mode:
|
|
138
|
-
|
|
139
|
-
Scale['Major']['Dorian'].chords.symbols
|
|
140
|
-
# => ['min7', 'min6']
|
|
141
|
-
|
|
142
|
-
Scale['Major'][4].chords.symbols
|
|
143
|
-
# => ['maj7#11']
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
* Ruby Example Problem:
|
|
147
|
-
Find all chords associated with the Major (Ionian) scale and print
|
|
148
|
-
each on a new line with the chord tones.
|
|
149
|
-
|
|
150
|
-
Scale['Major'].chords.map {|c| c.name + ': ' + c.notes.join(', ')} * "\n"
|
|
151
|
-
# => Major 7: C, E, G, B
|
|
152
|
-
Major 6: C, E, G, A
|
|
153
|
-
Dominant 6/9: C, E, G, Bb, D, A
|
|
154
|
-
|
|
155
|
-
These examples should show that with the power of Ruby and the elegant nature of
|
|
156
|
-
this API, extracting Jazz data from the system is a breeze (even fun!).
|
|
157
|
-
|
|
158
|
-
== Definitions Available
|
|
159
|
-
|
|
160
|
-
The default definition is just named "default" and is loaded when you run JazzModel::Base.load_definitions without argument, though you can give a custom argument to this to load a different definition:
|
|
161
|
-
|
|
162
|
-
JazzModel::Base.load_definitions(:my_custom_set)
|
|
163
|
-
|
|
164
|
-
Currently there are two definitions available:
|
|
165
|
-
* Keys - Creates the basic 12 keys. This definition should always be loaded so long as you are dealing with Western harmony.
|
|
166
|
-
* Default - The default set of data for jazz models, including many scales and chords. Any other definitions will probably want to build upon this instead of start from scratch.
|
|
167
|
-
|
|
168
|
-
== Creating Definitions
|
|
169
|
-
|
|
170
|
-
The gem has a distinction between classes such as +Chord+ and the actual definitions such as "C Major Chord". Definitions are simply packaged set of instructions for initializing the objects with data (which get put in the database). Since by default jazz model uses an in-memory sqlite3 database, definitions need to be loaded when your application loads.
|
|
171
|
-
|
|
172
|
-
To create a definition, simply do this:
|
|
173
|
-
|
|
174
|
-
JazzModel::Definition.define :my_definition => [:keys] do
|
|
175
|
-
|
|
176
|
-
end
|
|
177
|
-
|
|
178
|
-
Within the block you'll want to create whatever data is necessary to comprise your definitions. For examples of definitions, see lib/jazz_model/definitions in the project. The argument to define acts like rake tasks - use the hash value to define which dependencies your definition has. In the above case defining "my_definition" will first ensure the "keys" definition is already defined.
|
|
179
|
-
|
|
180
|
-
== Anticipated Future Features
|
|
181
|
-
|
|
182
|
-
* Chord Progression Analysis
|
|
183
|
-
* MIDI Integration
|
|
184
|
-
* User Comments & Contributions (such as Chord-Scale recommendations)
|
|
185
|
-
* Melodic Components & Licks
|
|
186
|
-
* Voicings Associated with Chords
|
data/Rakefile
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
require 'rubygems'
|
|
2
|
-
require 'rake'
|
|
3
|
-
require 'rake/rdoctask'
|
|
4
|
-
|
|
5
|
-
desc "Generate documentation for the plugin."
|
|
6
|
-
Rake::RDocTask.new(:rdoc) do |rdoc|
|
|
7
|
-
rdoc.rdoc_dir = "rdoc"
|
|
8
|
-
rdoc.title = "message_block"
|
|
9
|
-
rdoc.options << "--line-numbers" << "--inline-source"
|
|
10
|
-
rdoc.rdoc_files.include('README')
|
|
11
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
Dir["#{File.dirname(__FILE__)}/lib/tasks/*.rake"].sort.each { |ext| load ext }
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
module JazzModel
|
|
2
|
-
# Mixins for a sequence of note represented as an array.
|
|
3
|
-
module NoteSequence
|
|
4
|
-
def to_xml(options = {})
|
|
5
|
-
options[:indent] ||= 2
|
|
6
|
-
xml = options[:builder] ||= Builder::XmlMarkup.new(:indent => options[:indent])
|
|
7
|
-
xml.instruct! unless options[:skip_instruct]
|
|
8
|
-
xml.notes do
|
|
9
|
-
self.each do |note|
|
|
10
|
-
xml.tag!(:note, note.to_s)
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
end
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
require "spec_helper"
|
|
2
|
-
|
|
3
|
-
describe JazzModel::ChordCollection do
|
|
4
|
-
subject { JazzModel::Scale['Major'].modes[1].chords }
|
|
5
|
-
|
|
6
|
-
it "should emit symbols list" do
|
|
7
|
-
subject.to_s(:symbols).should be_starts_with('maj')
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
it "should emit names list" do
|
|
11
|
-
subject.to_s(:names).should be_starts_with('Major')
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
it "should resolve chord within" do
|
|
15
|
-
subject['maj'].should_not be_nil
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
it "should resolve chord within with key context" do
|
|
19
|
-
subject['Cmaj'].should_not be_nil
|
|
20
|
-
end
|
|
21
|
-
end
|
data/spec/chord_quality_spec.rb
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
require "spec_helper"
|
|
2
|
-
|
|
3
|
-
describe JazzModel::ChordQuality do
|
|
4
|
-
subject { JazzModel::ChordQuality.new }
|
|
5
|
-
|
|
6
|
-
it { should be_valid }
|
|
7
|
-
|
|
8
|
-
context "of Major" do
|
|
9
|
-
subject { JazzModel::ChordQuality.find_by_name('Major') }
|
|
10
|
-
it { should be_valid }
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
context "of Minor" do
|
|
14
|
-
subject { JazzModel::ChordQuality.find_by_name('Minor') }
|
|
15
|
-
it { should be_valid }
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
context "of Dominant" do
|
|
19
|
-
subject { JazzModel::ChordQuality.find_by_name('Dominant') }
|
|
20
|
-
it { should be_valid }
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
context "of Diminished" do
|
|
24
|
-
subject { JazzModel::ChordQuality.find_by_name('Diminished') }
|
|
25
|
-
it { should be_valid }
|
|
26
|
-
end
|
|
27
|
-
end
|
data/spec/chord_scale_spec.rb
DELETED
data/spec/chord_spec.rb
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
require "spec_helper"
|
|
2
|
-
|
|
3
|
-
describe JazzModel::Chord do
|
|
4
|
-
subject { JazzModel::Chord.new }
|
|
5
|
-
|
|
6
|
-
it { should be_valid }
|
|
7
|
-
|
|
8
|
-
pairings = {
|
|
9
|
-
'Cmaj' => %w[C E G],
|
|
10
|
-
'Cmin' => %w[C Eb G],
|
|
11
|
-
'Cmaj7' => %w[C E G B],
|
|
12
|
-
'Cmin7' => %w[C Eb G Bb],
|
|
13
|
-
'C7' => %w[C E G Bb],
|
|
14
|
-
'Cfulldim' => %w[C Eb Gb Bbb]
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
pairings.each do |chord_symbol, notes|
|
|
18
|
-
context "as #{chord_symbol}" do
|
|
19
|
-
it "should give valid notes" do
|
|
20
|
-
chord = JazzModel::Chord[chord_symbol]
|
|
21
|
-
chord.should_not be_nil
|
|
22
|
-
chord.notes.should == notes
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
data/spec/chord_symbol_spec.rb
DELETED
data/spec/chord_tone_spec.rb
DELETED
data/spec/definition_spec.rb
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
require "spec_helper"
|
|
2
|
-
|
|
3
|
-
describe JazzModel::Definition do
|
|
4
|
-
context "after creating a definition" do
|
|
5
|
-
before(:all) do
|
|
6
|
-
JazzModel::Definition.define :my_definition => [:keys] do
|
|
7
|
-
JazzModel::Scale.create!(:name => "Sample")
|
|
8
|
-
end
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
it "should have registered my_definition" do
|
|
12
|
-
JazzModel::Definition[:my_definition].should_not be_nil
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
describe "the definition" do
|
|
16
|
-
before { @definition = JazzModel::Definition[:my_definition] }
|
|
17
|
-
|
|
18
|
-
it "should list keys as an included_definition" do
|
|
19
|
-
@definition.included_definitions.should include(:keys)
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
context "when loaded" do
|
|
23
|
-
before { @definition.load }
|
|
24
|
-
|
|
25
|
-
it "should create keys" do
|
|
26
|
-
JazzModel::Key.find_by_name("C").should_not be_nil
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
it "should create sample scale" do
|
|
30
|
-
JazzModel::Scale.find_by_name("Sample").should_not be_nil
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
end
|
|
34
|
-
end
|
|
35
|
-
end
|