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

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 ( https://github.com/ponderworthy/the-box-of-no-return-3 ). 

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.

https://github.com/SpotlightKid/python-rtmidi/tree/master/examples/midi2command

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

https://github.com/SpotlightKid/osc2rtmidi

... but these days I would recommend just using midimonster, which is very powerful and an active project:

https://midimonster.net/ | https://github.com/cbdevnet/midimonster

Chris

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:

1.  User hits keyboard key, starts a shortcut via distro desktop

2.  Shortcut starts the following applet, which talks to non-mixer using OSC, and tells it to mute the appropriate channel.

import argparse
import random
import time

from pythonosc import udp_client

if __name__ == "__main__":
  parser = argparse.ArgumentParser()
  parser.add_argument("--ip", default="127.0.0.1",
      help="The ip of the OSC server")
  parser.add_argument("--port", type=int, default=7587,
      help="The port the OSC server is listening on")
  args = parser.parse_args()

  client = udp_client.SimpleUDPClient(args.ip, args.port)

  client.send_message("/strip/DistortionOutput/Gain/Mute", 1.0)