Class: Coltrane::Representation::Piano

Inherits:
Object
  • Object
show all
Defined in:
lib/coltrane/representation/piano.rb,
lib/coltrane/representation/piano/note_set.rb

Defined Under Namespace

Classes: NoteSet

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializePiano

Returns a new instance of Piano.



30
31
32
# File 'lib/coltrane/representation/piano.rb', line 30

def initialize
  @octaves
end

Instance Attribute Details

#octavesObject (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_notesObject



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_notesObject



24
25
26
# File 'lib/coltrane/representation/piano.rb', line 24

def white_notes
  Theory::Scale.major.notes
end