Skip to content

Instantly share code, notes, and snippets.

@SpotlightKid
Last active November 23, 2017 10:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SpotlightKid/c3a212d0071ed78adf4507d16e74305d to your computer and use it in GitHub Desktop.
Save SpotlightKid/c3a212d0071ed78adf4507d16e74305d to your computer and use it in GitHub Desktop.
Send AllSoundOff and ResetAllControllers on all JACK MIDI ouputs on all channels.
#!/usr/bin/env python
"""Send AllSoundOff and ResetAllControllers on all JACK MIDI outputs on all channels."""
import rtmidi
from rtmidi.midiconstants import (ALL_SOUND_OFF, CONTROL_CHANGE,
RESET_ALL_CONTROLLERS)
mo = rtmidi.MidiOut(rtapi=rtmidi.API_UNIX_JACK)
print(__doc__)
for portnum, portname in enumerate(mo.get_ports()):
print("Port:", portname)
mo.open_port(portnum)
for channel in range(16):
mo.send_message([CONTROL_CHANGE & channel, ALL_SOUND_OFF, 0])
mo.send_message([CONTROL_CHANGE & channel, RESET_ALL_CONTROLLERS, 0])
mo.close_port()
@SpotlightKid
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment