<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<br>
<blockquote type="cite"
cite="mid:0a75dbfa-e5cf-34ee-aa9e-6c63056999cf@chrisarndt.de">
<blockquote type="cite">
<blockquote type="cite">Audio related things I've written
include python bindings for the jack dbus interface, a jack
application managing tool to start/stop/mute applications via
hardware buttons
<br>
</blockquote>
<br>
My 7-key SpiderIsland (USB keyboard interface, not MIDI) just
came, and I'm planning to set it up with XFCE keyboard shortcuts
to command non-mixer to do mutes and volume changes, of audio
channels in my BNR (
<a class="moz-txt-link-freetext" href="https://github.com/ponderworthy/the-box-of-no-return-3">https://github.com/ponderworthy/the-box-of-no-return-3</a> ). </blockquote>
<br>
I have an example for python-rtmidi, which does a similar thing,
i.e. you can run arbitrary commands on reception of certain MIDI
events. You can combine this with e.g. "xdotool" to send keyboard
strokes to applications.
<br>
<br>
<blockquote><a class="moz-txt-link-freetext" href="https://github.com/SpotlightKid/python-rtmidi/tree/master/examples/midi2command">https://github.com/SpotlightKid/python-rtmidi/tree/master/examples/midi2command</a><br>
</blockquote>
<br>
IIRC, non-mixer has an OSC interface, so the more direct way would
be to use a MIDI-to-OSC gateway. I have an example for that using
python-rtmidi as well
<br>
<br>
<a class="moz-txt-link-freetext" href="https://github.com/SpotlightKid/osc2rtmidi">https://github.com/SpotlightKid/osc2rtmidi</a>
<br>
<br>
... but these days I would recommend just using midimonster, which
is very powerful and an active project:
<br>
<br>
<a class="moz-txt-link-freetext" href="https://midimonster.net/">https://midimonster.net/</a> | <a class="moz-txt-link-freetext" href="https://github.com/cbdevnet/midimonster">https://github.com/cbdevnet/midimonster</a>
<br>
<br>
Chris
<br>
</blockquote>
<p>Dear Lord, midimonster is quite a monster. Looks like a very
good tool when you need it. I like your method better; simpler.
I'm using a different Python OSC library and non-midi keyboard
control so I can run with any MIDI musical keyboard easily, I
don't have to sort out MIDI events beyond the universal notes and
sustain. So the simplest test is:</p>
<blockquote>
<p>1. User hits keyboard key, starts a shortcut via distro
desktop</p>
<p>2. Shortcut starts the following applet, which talks to
non-mixer using OSC, and tells it to mute the appropriate
channel.<br>
</p>
</blockquote>
<p>import argparse<br>
import random<br>
import time<br>
<br>
from pythonosc import udp_client<br>
<br>
if __name__ == "__main__":<br>
parser = argparse.ArgumentParser()<br>
parser.add_argument("--ip", default="127.0.0.1",<br>
help="The ip of the OSC server")<br>
parser.add_argument("--port", type=int, default=7587,<br>
help="The port the OSC server is listening on")<br>
args = parser.parse_args()<br>
<br>
client = udp_client.SimpleUDPClient(args.ip, args.port)<br>
<br>
client.send_message("/strip/DistortionOutput/Gain/Mute", 1.0)<br>
<br>
</p>
</body>
</html>