Class: Juicy::Scale
Overview
0 1 2 3 4 5 6 7 8 9 10 11 12
|- |- |- |- |- |- |- |- |- |- |- |- |
do di re ri mi fa fi so si la li ti do
chromatic |- |- |- |- |- |- |- |- |- |- |- |- |
do re mi fa so la ti do
diatonic |- - |- - |- |- - |- - |- - |- |
do re mi so la do
pentatonic |- - |- - |- - - |- - |- - - |
do re mi fi si li do
whole note |- - |- - |- - |- - |- - |- - |
do re ri fa fi si la ti do
octotonic |- - |- |- - |- |- - |- |- - |- |
Instance Method Summary collapse
- #[](element) ⇒ Object
- #each {|| ... } ⇒ Object
- #each_note ⇒ Object
-
#initialize(type = :major, root = Note.new) ⇒ Scale
constructor
A new instance of Scale.
- #mode=(type) ⇒ Object
- #play ⇒ Object
- #root=(root) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(type = :major, root = Note.new) ⇒ Scale
Returns a new instance of Scale.
28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/juicy/scale.rb', line 28 def initialize(type = :major, root = Note.new) case type when :major @type = :diatonic when :minor @type = :diatonic else @type = type end @mode = Mode.new(type) @root = root generate_notes end |
Instance Method Details
#[](element) ⇒ Object
47 48 49 |
# File 'lib/juicy/scale.rb', line 47 def[](element) end |
#each {|| ... } ⇒ Object
65 66 67 |
# File 'lib/juicy/scale.rb', line 65 def each yield SCALE_TYPES[@type] end |
#each_note ⇒ Object
69 70 71 72 73 |
# File 'lib/juicy/scale.rb', line 69 def each_note (SCALE_TYPES[@type].size+1).times do yield @notes.next end end |
#mode=(type) ⇒ Object
55 56 57 58 |
# File 'lib/juicy/scale.rb', line 55 def mode=(type) @mode = Mode.new(type) generate_notes end |
#play ⇒ Object
51 52 53 |
# File 'lib/juicy/scale.rb', line 51 def play end |
#root=(root) ⇒ Object
60 61 62 63 |
# File 'lib/juicy/scale.rb', line 60 def root=(root) @root = root generate_notes end |
#to_s ⇒ Object
43 44 45 |
# File 'lib/juicy/scale.rb', line 43 def to_s "scale type: #{@type}, mode: #{@mode}, root: #{@root}" end |