class Juicy::ChordProgression

Attributes

chords[RW]

Public Class Methods

new(key, mode, numerals = [1,4,1,5]) click to toggle source
# File lib/juicy/chord_progression.rb, line 7
def initialize(key, mode, numerals = [1,4,1,5])

  @numerals = numerals
  
  #given a key and a mode, a number can tell me what chord.
  
  @chords = [
    Chord.new(root: "A", quality: :major),
    Chord.new(root: "D", quality: :major),
    Chord.new(root: "A", quality: :major),
    Chord.new(root: "E", quality: :major)
  ]
 #@numerals.each do |numeral|
 #  @chords << Chord.new(numeral)
 #end
  
end

Public Instance Methods

initial_play_time() click to toggle source
# File lib/juicy/chord_progression.rb, line 46
def initial_play_time
  0
end
inspect() click to toggle source
# File lib/juicy/chord_progression.rb, line 25
def inspect
  output = ""
  @chords.each do |chord|
    output += chord.inspect + ", "
  end
  output[0..-3]
end
play() click to toggle source
# File lib/juicy/chord_progression.rb, line 50
def play
  @chords.each do |chord|
    4.times {chord.play}
  end
end
to_a() click to toggle source
# File lib/juicy/chord_progression.rb, line 41
def to_a
  [Chord.new(root: "C")]
  @chords
end
to_s() click to toggle source
# File lib/juicy/chord_progression.rb, line 33
def to_s
  output = ""
  @progression.each do |scale_degree|
    output += scale_degree.to_s + ", "
  end
  output[0..-3]
end