Class: InevitableCacophony::OctaveStructure
- Inherits:
-
Object
- Object
- InevitableCacophony::OctaveStructure
- Defined in:
- lib/inevitable_cacophony/octave_structure.rb
Defined Under Namespace
Classes: Chord, NoteSequence, Scale
Constant Summary collapse
- OCTAVE_RATIO =
Frequency scaling for a difference of one whole octave
2
- OCTAVE_STRUCTURE_SENTENCE =
Regular expressions used in parsing
/Scales are constructed/
Instance Attribute Summary collapse
-
#chords ⇒ Object
readonly
Returns the value of attribute chords.
-
#scales ⇒ Object
readonly
Returns the value of attribute scales.
Instance Method Summary collapse
-
#chromatic_scale ⇒ Scale
A scale including all available notes in the octave.
-
#initialize(scale_text) ⇒ OctaveStructure
constructor
TODO: Allow contructing these without parsing text.
Constructor Details
#initialize(scale_text) ⇒ OctaveStructure
TODO: Allow contructing these without parsing text
65 66 67 68 69 70 71 72 |
# File 'lib/inevitable_cacophony/octave_structure.rb', line 65 def initialize(scale_text) description = Parser::SectionedText.new(scale_text) octave_description = description.find_paragraph(OCTAVE_STRUCTURE_SENTENCE) @octave_divisions = parse_octave_structure(octave_description) @chords = parse_chords(description) @scales = parse_scales(description, chords) end |
Instance Attribute Details
#chords ⇒ Object (readonly)
Returns the value of attribute chords.
74 75 76 |
# File 'lib/inevitable_cacophony/octave_structure.rb', line 74 def chords @chords end |
#scales ⇒ Object (readonly)
Returns the value of attribute scales.
74 75 76 |
# File 'lib/inevitable_cacophony/octave_structure.rb', line 74 def scales @scales end |