Guest User

Untitled

a guest
Dec 10th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. def drawShape(eventType, channel, data1, data2):
  2.  
  3. global window, shape1, shape2, shape3, shape4, shape5, shape6
  4.  
  5. # iicon position is random
  6. x = randint(0, getScreenWidth()) # x may be anywhere on display
  7. y = randint(0, getScreenHeight()) # y may be anywhere on display
  8.  
  9.  
  10. colors = ["Red", "Orange", "Yellow", "Green", "Blue", "Purple", "Pink", "White", "Teal"]
  11. colorIdx = (data1 / 2) % len(colors)
  12. color = colors[colorIdx]
  13.  
  14. shapeLists = [shape1, shape2, shape3, shape4, shape5, shape6]
  15. shapeListIdx = (data1 / 3) % len(shapeLists)
  16. shapeList = shapeLists[shapeListIdx]
  17. shape = shapeList[color]
  18. icon = Icon(shape,x,y)
  19. window.add(icon)
  20.  
  21. # play note
  22. Play.noteOn(data1, data2)
  23.  
  24. # establish a connection to an input MIDI device
  25. midiIn = MidiIn("Unknown Vendor Oxygen 25")
  26.  
  27.  
  28. # register a callback function to process incoming MIDI events
  29. midiIn.onNoteOn(drawShape)
Add Comment
Please, Sign In to add comment