Class: MusicTheory::Arpeggio
- Inherits:
-
Object
- Object
- MusicTheory::Arpeggio
- Includes:
- Output
- Defined in:
- lib/music_theory/arpeggio.rb
Instance Attribute Summary collapse
-
#all_notes ⇒ Object
Returns the value of attribute all_notes.
-
#duration ⇒ Object
Returns the value of attribute duration.
-
#output_file_name ⇒ Object
Returns the value of attribute output_file_name.
-
#third ⇒ Object
Returns the value of attribute third.
Instance Method Summary collapse
- #arpeggionate ⇒ Object
-
#initialize(third, options = {}) ⇒ Arpeggio
constructor
A new instance of Arpeggio.
- #samples ⇒ Object
Methods included from Output
#buffer_format, #format, #output_track, #play, #sample_rate
Constructor Details
#initialize(third, options = {}) ⇒ Arpeggio
Returns a new instance of Arpeggio.
9 10 11 12 13 |
# File 'lib/music_theory/arpeggio.rb', line 9 def initialize(third, = {}) @duration = [:duration] || 0.25 @third = third @output_file_name = [:output_file_name] || 'chord' # File name to write (without extension) end |
Instance Attribute Details
#all_notes ⇒ Object
Returns the value of attribute all_notes.
7 8 9 |
# File 'lib/music_theory/arpeggio.rb', line 7 def all_notes @all_notes end |
#duration ⇒ Object
Returns the value of attribute duration.
7 8 9 |
# File 'lib/music_theory/arpeggio.rb', line 7 def duration @duration end |
#output_file_name ⇒ Object
Returns the value of attribute output_file_name.
7 8 9 |
# File 'lib/music_theory/arpeggio.rb', line 7 def output_file_name @output_file_name end |
#third ⇒ Object
Returns the value of attribute third.
7 8 9 |
# File 'lib/music_theory/arpeggio.rb', line 7 def third @third end |
Instance Method Details
#arpeggionate ⇒ Object
15 16 17 18 |
# File 'lib/music_theory/arpeggio.rb', line 15 def arpeggionate third.all_notes.each {|note| note.duration = duration} third.all_notes += [third.all_notes[2], third.all_notes[1], third.all_notes[0], third.all_notes[1]] end |
#samples ⇒ Object
20 21 22 |
# File 'lib/music_theory/arpeggio.rb', line 20 def samples arpeggionate.map(&:samples).flatten end |