Class: Coltrane::Theory::CircleOfFifths

Inherits:
Object
  • Object
show all
Defined in:
lib/coltrane/theory/circle_of_fifths.rb

Constant Summary collapse

LETTER_SEQUENCE =
%w[C G D A E B F].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(start_note = Note['C'], size = Float::INFINITY) ⇒ CircleOfFifths

Returns a new instance of CircleOfFifths.



10
11
12
13
14
15
# File 'lib/coltrane/theory/circle_of_fifths.rb', line 10

def initialize(start_note = Note['C'], size = Float::INFINITY)
  index  = letters.index(start_note.name[0])
  @notes = fifths(note: start_note - Interval.perfect_fifth,
                  size: size,
                  index: (index - 1) % LETTER_SEQUENCE.size)
end

Instance Attribute Details

#notesObject (readonly)

Returns the value of attribute notes.



6
7
8
# File 'lib/coltrane/theory/circle_of_fifths.rb', line 6

def notes
  @notes
end