Class: Coltrane::Representation::Piano
- Inherits:
-
Object
- Object
- Coltrane::Representation::Piano
- Defined in:
- lib/coltrane/representation/piano.rb,
lib/coltrane/representation/piano/note_set.rb
Defined Under Namespace
Classes: NoteSet
Instance Attribute Summary collapse
-
#octaves ⇒ Object
readonly
Returns the value of attribute octaves.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Piano
constructor
A new instance of Piano.
Constructor Details
#initialize ⇒ Piano
Returns a new instance of Piano.
30 31 32 |
# File 'lib/coltrane/representation/piano.rb', line 30 def initialize @octaves end |
Instance Attribute Details
#octaves ⇒ Object (readonly)
Returns the value of attribute octaves.
6 7 8 |
# File 'lib/coltrane/representation/piano.rb', line 6 def octaves @octaves end |
Class Method Details
.black_notes ⇒ Object
20 21 22 |
# File 'lib/coltrane/representation/piano.rb', line 20 def black_notes Theory::Scale.pentatonic_major('C#', 4).notes end |
.chord(chord) ⇒ Object
14 15 16 17 18 |
# File 'lib/coltrane/representation/piano.rb', line 14 def chord(chord) find_notes( chord.is_a?(Chord) ? chord.notes : Chord.new(name: chord).notes ) end |
.find_notes(notes) ⇒ Object
10 11 12 |
# File 'lib/coltrane/representation/piano.rb', line 10 def find_notes(notes) Piano::NoteSet.new(notes, piano: new) end |
.white_notes ⇒ Object
24 25 26 |
# File 'lib/coltrane/representation/piano.rb', line 24 def white_notes Theory::Scale.major.notes end |