I would like to know how can i send MIDI Control Change messages from a Python script to an application called rakarrack, which receives MIDI messages to change volumes, turn on/off FX's, etc. All this done via JACK/ALSA.
At this point i just try with the library python-rtmidi (the code i wrote is based on the example provided there), but when i try to send the messages, rakarrack doesn't do anything. I think because is not receiving anything. I already check the Preference in the application and the MIDI In device (which is created from Python) is listed as 'rtmidi' and selected.
import time
import rtmidi
midiout = rtmidi.MidiOut()
available_ports = midiout.get_ports()
if available_ports:
midiout.open_port(0)
else:
midiout.open_virtual_port("My virtual output")
control = [0x74, 116, 124]
midiout.send_message(control)
del midiout
As you can see, I'm trying to send one control message [0x74, 116, 124] , I took those numbers from here: http://rakarrack.sourceforge.net/midiic.html
1 Answer 1
I need to send a "Chan 1 Control/Mode Change" message as the first byte, which is "0xb0", then 0x74 which is the control that i want change, and finally the value "124", which is turn on/off FX:
control = [0xb0, 0x74, 124]
-
Stumbled across the same problem. The
rtmidi
lib has constants for those. You canfrom rtmidi.midiconstants import CONTROL_CHANGE
which equals to0xB0
, for example. There are many more useful constants in there.mefiX– mefiX2023年08月28日 10:20:19 +00:00Commented Aug 28, 2023 at 10:20