class Negasonic::LoopedEvent::Pattern
Constants
- TYPES
Public Class Methods
new(synth, notes = [])
click to toggle source
# File lib/negasonic/looped_event/pattern.rb, line 16 def initialize(synth, notes = []) @synth = synth @notes = LoopedEvent.to_tone_notes(notes) end
Public Instance Methods
start(duration, type)
click to toggle source
# File lib/negasonic/looped_event/pattern.rb, line 21 def start(duration, type) raise 'invalid pattern type' unless TYPES.keys.include?(type) do_start(duration, TYPES[type]) do |time, note| @synth.trigger_attack_release(note, duration, time) end end
Private Instance Methods
do_start(duration, type, &block)
click to toggle source
# File lib/negasonic/looped_event/pattern.rb, line 31 def do_start(duration, type, &block) pattern = Tone::Event::Pattern.new(@notes, type, &block) pattern.interval = duration LoopedEvent.start(pattern) end