class Coltrane::Representation::Guitar

Attributes

frets[R]

A base class for operations involving Guitars

special_frets[R]

A base class for operations involving Guitars

strings[R]

A base class for operations involving Guitars

tuning[R]

A base class for operations involving Guitars

Public Class Methods

find_chord_by_notation(chord_notation) click to toggle source
# File lib/coltrane/representation/guitar.rb, line 25
def self.find_chord_by_notation(chord_notation)
  Guitar::Chord.find_by_notation(new, chord_notation)
end
find_chords(target_chord) click to toggle source
# File lib/coltrane/representation/guitar.rb, line 13
def self.find_chords(target_chord)
  unless target_chord.is_a?(Theory::Chord)
    target_chord = Theory::Chord.new(name: target_chord)
  end

  Guitar::Chord.find(target_chord, guitar: new)
end
find_notes(notes) click to toggle source
# File lib/coltrane/representation/guitar.rb, line 21
def self.find_notes(notes)
  Guitar::NoteSet.new(notes, guitar: new)
end
new(tuning: nil, frets: nil, special_frets: nil) click to toggle source
# File lib/coltrane/representation/guitar.rb, line 29
def initialize(tuning: nil, frets: nil, special_frets: nil)
  @tuning        = tuning        || %w[E2 A2 D3 G3 B3 E4]
  @special_frets = special_frets || [3, 5, 7, 9, 12, 15, 17, 19]
  @frets         = frets         || 23

  @strings = @tuning.map do |p|
    String.new(Theory::Pitch[p], guitar: self)
  end
end