class Dodecaphony::Calculator

Attributes

row[RW]

Public Class Methods

new(row) click to toggle source
# File lib/calculator.rb, line 6
def initialize row
  self.row = row
end

Public Instance Methods

i0() click to toggle source
# File lib/calculator.rb, line 10
def i0
  row.each_with_object([]) { |pitch, new_row|
    new_row << row.intervals[((row.intervals.key(pitch) - 12).abs)].name
  }
end

Private Instance Methods

starting_pitch() click to toggle source
# File lib/calculator.rb, line 48
def starting_pitch
  row.pitches[0]
end
transpose(interval, pitch) click to toggle source
# File lib/calculator.rb, line 44
def transpose interval, pitch
  (starting_pitch.distance_from(pitch) + interval) % 12
end