forked from SpotlightKid/python-rtmidi
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpanic.py
More file actions
28 lines (20 loc) · 765 Bytes
/
Copy pathpanic.py
File metadata and controls
28 lines (20 loc) · 765 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/env python
#
# panic.py
#
"""Send AllSoundOff and ResetAllControllers on all JACK MIDI outputs and all channels."""
from __future__ import print_function
import time
import rtmidi
from rtmidi.midiconstants import (ALL_SOUND_OFF, CONTROL_CHANGE,
RESET_ALL_CONTROLLERS)
midiout = rtmidi.MidiOut(rtapi=rtmidi.API_UNIX_JACK)
print(__doc__)
for portnum, portname in enumerate(midiout.get_ports()):
print("Port:", portname)
with midiout.open_port(portnum):
for channel in range(16):
midiout.send_message([CONTROL_CHANGE | channel, ALL_SOUND_OFF, 0])
midiout.send_message([CONTROL_CHANGE | channel, RESET_ALL_CONTROLLERS, 0])
time.sleep(0.05)
time.sleep(0.1)