# Designed By Gabriel Garrod
# This is a Simple example of Live ruby Music Generation Based off use of a scale.rb File
require 'music'
require 'scales'
# Main Method => 205k
def play(n,scale)
midi=LiveMIDI.new
n.times{
midi.note_on(ch=0,nt=scale[rand(scale.size)],vlc=rand(75)+25)
sleep(1)
midi.note_off(ch,nt,0)}
end
play(13,major)
# now you can create a method to play varitions of the play Method to build musical structure
def play_var()
a = rand; b = rand
if a > b
puts "played a Major"
play(5,major)
else
puts "played a Minor"
play(3,minor)
end
end