Module: LousyBloopMachine
Overview
-=) warp-o-mat (=-
tune coded/composed by freQvibez
(c) 2009 Alex Brem
exclusively for why’s BloopSaphone
from Farbrausch with ♥
Defined Under Namespace
Classes: Tune
Instance Method Summary collapse
Instance Method Details
#init ⇒ Object
273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 |
# File 'ext/ruby/tune_warp.rb', line 273 def init @bloops ||= Bloops.new @bloops.tempo = Tune::BPM return if @sounds @sounds = {} YAML.load(DATA.read).each do |track,instrument| @sounds[track] = @bloops.sound instrument['sound'].split("::").inject(Object) { |c1,c2| c1.const_get(c2) } instrument.reject{|k,v| k == 'sound'}.each do |sound,value| @sounds[track].send "#{sound}=", value end end Tune::SEQUENCES.each do |track,sequences| instr = track.to_s.split('_')[0] next unless @sounds[instr] next unless Tune::PATTERNS[track] notes = '' sequences.each do |seq| seq = seq.to_i next unless Tune::PATTERNS[track][seq] notes << Tune::PATTERNS[track][seq] end @bloops.tune @sounds[instr], notes end end |
#play ⇒ Object
302 303 304 305 306 |
# File 'ext/ruby/tune_warp.rb', line 302 def play init unless @bloops @bloops.play sleep 0.05 while !@bloops.stopped? end |
#play_endless ⇒ Object
308 309 310 |
# File 'ext/ruby/tune_warp.rb', line 308 def play_endless while true do play; end end |