Created
January 23, 2015 06:55
-
-
Save kevindjacobson/824f91b9f22f2daf28c9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "midi" | |
require "eventmachine" | |
# prompt the user to select an input and output | |
EventMachine.run do | |
@input = UniMIDI::Input.gets | |
@output = UniMIDI::Output.gets | |
EventMachine.set_timer_quantum(10); | |
MIDI.using(@output) do | |
@cc_timer = EventMachine::PeriodicTimer.new(0.02) do | |
@count ||= 1 | |
@count += 1 | |
@count %= 127 | |
@count = 1 if @count == 0 | |
puts @count | |
cc 1, @count | |
cc 93, 127 - @count | |
end | |
@note_timer = EventMachine::PeriodicTimer.new(60/ 150.0) do | |
off | |
octave 3 | |
note %w{D F G Ab A C D}[rand(7)] | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment