Created
December 10, 2018 22:01
-
-
Save CalvinLogan/3893445557e35b48b67b3aa6977f23ae to your computer and use it in GitHub Desktop.
This file contains 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
def drawShape(eventType, channel, data1, data2): | |
global window, shape1, shape2, shape3, shape4, shape5, shape6 | |
# iicon position is random | |
x = randint(0, getScreenWidth()) # x may be anywhere on display | |
y = randint(0, getScreenHeight()) # y may be anywhere on display | |
colors = ["Red", "Orange", "Yellow", "Green", "Blue", "Purple", "Pink", "White", "Teal"] | |
colorIdx = (data1 / 2) % len(colors) | |
color = colors[colorIdx] | |
shapeLists = [shape1, shape2, shape3, shape4, shape5, shape6] | |
shapeListIdx = (data1 / 3) % len(shapeLists) | |
shapeList = shapeLists[shapeListIdx] | |
shape = shapeList[color] | |
icon = Icon(shape,x,y) | |
window.add(icon) | |
# play note | |
Play.noteOn(data1, data2) | |
# establish a connection to an input MIDI device | |
midiIn = MidiIn("Unknown Vendor Oxygen 25") | |
# register a callback function to process incoming MIDI events | |
midiIn.onNoteOn(drawShape) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment