Class: InevitableCacophony::OctaveStructure::Scale
- Inherits:
-
NoteSequence
- Object
- NoteSequence
- InevitableCacophony::OctaveStructure::Scale
- Defined in:
- lib/inevitable_cacophony/octave_structure.rb
Overview
As above, but also tracks the chords that make up the scale.
Instance Attribute Summary
Attributes inherited from NoteSequence
Instance Method Summary collapse
-
#initialize(chords, note_scalings = nil) ⇒ Scale
constructor
A new instance of Scale.
-
#open ⇒ Scale
Convert this scale to an “open” one – i.e.
Methods inherited from NoteSequence
Constructor Details
#initialize(chords, note_scalings = nil) ⇒ Scale
Returns a new instance of Scale.
37 38 39 40 |
# File 'lib/inevitable_cacophony/octave_structure.rb', line 37 def initialize(chords, note_scalings=nil) @chords = chords super(note_scalings || chords.map(&:note_scalings).flatten) end |
Instance Method Details
#open ⇒ Scale
Convert this scale to an “open” one – i.e. one not including the last note of the octave.
This form is more convenient when concatenating scales together.
48 49 50 51 52 53 54 55 56 57 |
# File 'lib/inevitable_cacophony/octave_structure.rb', line 48 def open if note_scalings.last == OCTAVE_RATIO # -1 is the last note; we want to end on the one before that, so -2 Scale.new(@chords, note_scalings[0..-2]) else # This scale is already open. self end end |