class MusicTheory::Third
Attributes
all_notes[RW]
scale[RW]
Public Class Methods
new(scale)
click to toggle source
# File lib/music_theory/third.rb, line 8 def initialize(scale) @scale = scale @all_notes = [scale.scale_notes.first] current = 0 double_scale_notes = scale.scale_notes * 2 scale.mode.in_groups_of(2, false) do |group| current += group.sum all_notes << double_scale_notes[current] end all_notes.compact.uniq {|note| note.frequency}.sort_by! {|note| note.frequency} end
Public Instance Methods
arpeggio()
click to toggle source
# File lib/music_theory/third.rb, line 28 def arpeggio arpeggio ||= MusicTheory::Arpeggio.new self.dup end
chord()
click to toggle source
# File lib/music_theory/third.rb, line 24 def chord chord ||= MusicTheory::Chord.new self.dup end
output_file_name()
click to toggle source
# File lib/music_theory/third.rb, line 32 def output_file_name scale.output_file_name || 'thirds' end
samples()
click to toggle source
# File lib/music_theory/third.rb, line 20 def samples all_notes.map(&:samples).flatten end