From 543fca2a4352edadde0c522a716cfe33ed4a39f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mikol=C3=A1=C5=A1=20=C5=A0trajt?= Date: Tue, 14 Sep 2021 18:00:43 +0200 Subject: [PATCH] volume to velocity transformer I have some noname cheap MIDI controller, which has some problems with setting right velocity when playing live. I hit either too hard or too soft. This script is filter which solves this problem - it let me control velocity via volume slider/knob on my controller. This can be useful for others too IMHO. Test it with some sound which sounds very different by velocity - e.g. EPIANO2 patch for Dexed (DX7). --- ProtoplugFiles/generators/vol2vel.lua | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 ProtoplugFiles/generators/vol2vel.lua diff --git a/ProtoplugFiles/generators/vol2vel.lua b/ProtoplugFiles/generators/vol2vel.lua new file mode 100644 index 00000000..539b6a71 --- /dev/null +++ b/ProtoplugFiles/generators/vol2vel.lua @@ -0,0 +1,16 @@ +-- volume to velocity transformer +-- (c) Severak 2021 + +require "include/protoplug" + +volume = 100 + +function plugin.processBlock(samples, smax, midiBuf) + for ev in midiBuf:eachEvent() do + if ev:isNoteOn() then + ev:setVel(volume) + elseif ev:isControl() and ev:getControlNumber()==7 then + volume = ev:getControlValue() + end + end +end