We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b57cd06 commit 399194fCopy full SHA for 399194f
crates/processing_pyo3/examples/midi.py
@@ -0,0 +1,26 @@
1
+from processing import *
2
+import random
3
+
4
+def setup():
5
+ size(800, 600)
6
7
+ # Refresh midi port list, and connect to first one
8
+ midi_refresh_ports()
9
+ midi_connect(0)
10
11
+def draw():
12
+ background(220)
13
14
+ fill(255, 0, 100)
15
+ stroke(1)
16
+ stroke_weight(2)
17
+ rect(100, 100, 200, 150)
18
19
+ # pick a random note value, and duration value for that note
20
+ # then send the midi command
21
+ note = random.randit(57,68)
22
+ note_duration = random.randit(25, 250)
23
+ midi_play_notes(note, note_duration)
24
25
+# TODO: this should happen implicitly on module load somehow
26
+run()
0 commit comments