Created
August 3, 2023 11:46
-
-
Save onyx-and-iris/30b47b473946c827b020e3b119817a6b to your computer and use it in GitHub Desktop.
Control Voicemeeter Gainlayers using Korg NanoControl2 sliders
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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