Archaeopteryx

Making Music With Ruby

Hello I have been working on a Computer Generated Music Program in Ruby I wanted a way to randomly generate send random midi notes to random Channel within reason and so I created a simple Dry Code Music Generator here is the code... Using nothing more than the LiveMIDI

count=0
# sets the number of times to play all the way through
play = rand(25)+16
midi = LiveMIDI.new
while count < play
# Sub_Pattern Channel / Note / Velocity
rand(15).times do
midi.note_on(ch=rand(5),nt=rand(48)+48,vlc=rand(75)+25);sleep(rand(3));midi.note_off(ch,nt,0)
end
count = count + 1
puts "This the #{count} loop"
end

Share

Reply to This

Badge

Loading…

© 2009   Created by Giles on Ning.   Create a Ning Network!

Badges  |  Report an Issue  |  Privacy  |  Terms of Service