Class: Coltrane::Theory::DiatonicScale
- Inherits:
-
Scale
- Object
- Scale
- Coltrane::Theory::DiatonicScale
show all
- Defined in:
- lib/coltrane/theory/diatonic_scale.rb
Direct Known Subclasses
Key
Constant Summary
ClassicScales::SCALES
Instance Attribute Summary
Attributes inherited from Scale
#interval_sequence, #tone
Instance Method Summary
collapse
Methods inherited from Scale
#&, #==, #chords, #degree, #degree_of_chord, #degree_of_note, #degrees, #id, #include_notes?, #interval, #notes, #pentads, #pretty_name, #progression, #sevenths, #size, #tertians, #triads
#fetch, #having_chords, #having_notes, #known_scales, #major, #minor, #standard_scales
Constructor Details
#initialize(tone, major: true) ⇒ DiatonicScale
Returns a new instance of DiatonicScale.
6
7
8
9
10
11
|
# File 'lib/coltrane/theory/diatonic_scale.rb', line 6
def initialize(tone, major: true)
@major = major
tone = Note[tone]
notes = CircleOfFifths.new(tone - (major? ? 0 : 9), 7).notes.sort
super notes: notes.rotate(notes.index(tone))
end
|
Instance Method Details
#major? ⇒ Boolean
29
30
31
|
# File 'lib/coltrane/theory/diatonic_scale.rb', line 29
def major?
!!@major
end
|
#minor? ⇒ Boolean
33
34
35
|
# File 'lib/coltrane/theory/diatonic_scale.rb', line 33
def minor?
!@major
end
|
#name ⇒ Object
13
14
15
|
# File 'lib/coltrane/theory/diatonic_scale.rb', line 13
def name
major? ? 'Major' : 'Natural Minor'
end
|
#relative ⇒ Object
25
26
27
|
# File 'lib/coltrane/theory/diatonic_scale.rb', line 25
def relative
major? ? relative_minor : relative_major
end
|
#relative_major ⇒ Object
21
22
23
|
# File 'lib/coltrane/theory/diatonic_scale.rb', line 21
def relative_major
major? ? self : self.class.new(@tone - 9, major: true)
end
|
#relative_minor ⇒ Object
17
18
19
|
# File 'lib/coltrane/theory/diatonic_scale.rb', line 17
def relative_minor
minor? ? self : self.class.new(@tone + 9, major: false)
end
|