Class: Stave::Core::ScaleHarmoniser

Inherits:
Object
  • Object
show all
Defined in:
lib/stave/core/scale_harmoniser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(scale_type:, chord_set:) ⇒ ScaleHarmoniser

Returns a new instance of ScaleHarmoniser.



6
7
8
9
# File 'lib/stave/core/scale_harmoniser.rb', line 6

def initialize(scale_type:, chord_set:)
  @scale_type = scale_type
  @chord_set = chord_set
end

Instance Attribute Details

#chord_setObject (readonly)

Returns the value of attribute chord_set.



4
5
6
# File 'lib/stave/core/scale_harmoniser.rb', line 4

def chord_set
  @chord_set
end

#scale_typeObject (readonly)

Returns the value of attribute scale_type.



4
5
6
# File 'lib/stave/core/scale_harmoniser.rb', line 4

def scale_type
  @scale_type
end

Instance Method Details

#harmonise!Object



11
12
13
14
15
# File 'lib/stave/core/scale_harmoniser.rb', line 11

def harmonise!
  scale_type.uniq.map do |degree|
    Theory::ChordType.find_by(intervals: intervals(degree))
  end
end