Skip to content

Commit

Permalink
Adds scale steps to enable chord progressions & chord scales
Browse files Browse the repository at this point in the history
  • Loading branch information
beneggett committed Mar 10, 2015
1 parent 1926252 commit f21a8fd
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/music_theory.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
require "music_theory/note"
require "music_theory/octave"
require "music_theory/scale"
require "music_theory/scale_steps"
require "music_theory/modes"
require "music_theory/third"
require "music_theory/chord"
Expand Down
3 changes: 3 additions & 0 deletions lib/music_theory/scale.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
require 'music_theory/output'
require 'music_theory/scale_steps'

module MusicTheory
class Scale
include MusicTheory::Output
include MusicTheory::ScaleSteps
attr_accessor :starting_note, :number_of_octaves, :direction, :output_file_name, :all_notes, :scale_type, :scale_notes, :distort, :duration, :frequency

def initialize(scale_type = :major, options = {})
Expand Down Expand Up @@ -56,6 +58,7 @@ def third
def chord
third.chord
end

end

end
44 changes: 44 additions & 0 deletions lib/music_theory/scale_steps.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
module MusicTheory
module ScaleSteps # Concern for Scale

def i
self
end

def ii
set_scale_step(1)
end

def iii
set_scale_step(2)
end

def iv
set_scale_step(3)
end

def v
set_scale_step(4)
end

def vi
set_scale_step(5)
end

def vii
set_scale_step(6)
end

def viii
set_scale_step(7)
end

private

def set_scale_step(jump)
new_chord_scale = MusicTheory::Scale.new scale_type, distort: distort, frequency: scale_notes[jump].frequency, duration: duration
new_chord_scale
end

end
end
2 changes: 1 addition & 1 deletion lib/music_theory/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module MusicTheory
VERSION = "0.1.0"
VERSION = "0.1.1"
end

0 comments on commit f21a8fd

Please sign in to comment.