Skip to content

Instantly share code, notes, and snippets.

@onyx-and-iris
Last active June 17, 2025 17:44
Show Gist options
  • Save onyx-and-iris/c72f94e3861c3e9336ba77d5e234d9a2 to your computer and use it in GitHub Desktop.
Save onyx-and-iris/c72f94e3861c3e9336ba77d5e234d9a2 to your computer and use it in GitHub Desktop.
Control Voicemeeter App Volume with Midi Slider
import logging
import voicemeeterlib
logging.basicConfig(level=logging.DEBUG)
class MidiObserver:
"""A simple observer to handle MIDI events."""
def __init__(self, vm):
self.vm = vm
self.vm.observer.add(self.on_midi)
def on_midi(self):
"""Callback for MIDI events."""
current_input = self.vm.midi.current
current_value = self.vm.midi.get(current_input)
match current_input:
case 0: # corresponds to the leftmost MIDI fader (Korg NanoKontrol 2)
self.vm.strip[5].appgain('Spotify', current_value / 127)
def main():
KIND_ID = 'potato'
with voicemeeterlib.api(KIND_ID, midi=True) as vm:
MidiObserver(vm)
while _ := input('Press <Enter> to exit\n'):
pass
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment