Skip to content

Instantly share code, notes, and snippets.

@onyx-and-iris
Created August 3, 2023 11:46
Show Gist options
  • Save onyx-and-iris/30b47b473946c827b020e3b119817a6b to your computer and use it in GitHub Desktop.
Save onyx-and-iris/30b47b473946c827b020e3b119817a6b to your computer and use it in GitHub Desktop.
Control Voicemeeter Gainlayers using Korg NanoControl2 sliders
require_relative "../../lib/voicemeeter"
class Main
GAINLAYER = 0
def initialize(vm)
@vm = vm
@vm.register(method(:on_midi)
end
def run
puts "press <Enter> to quit"
loop { break if gets.chomp.empty? }
end
def on_midi
current = @vm.midi.current
midi_handler(current, @vm.midi.get(current))
end
def midi_handler(i, val)
if i.between?(0, 7)
@vm.strip[i].gainlayer[GAINLAYER].gain = (val * 72 / 127) - 60
end
end
end
if $PROGRAM_NAME == __FILE__
Voicemeeter::Remote.new(:potato, midi: true).run do |vm|
Main.new(vm).run
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment