Old 09-11-2019, 08:37 AM   #1
lunker
Human being with feelings
 
lunker's Avatar
 
Join Date: Nov 2007
Location: Lucas, TX, USA (via Luleň, Sweden)
Posts: 956
Default How To Intercept/Manipulate MIDI Controller Data ?

I hope this isn't a crazy/stupid question.

I know how to write a JSFX to read MIDI input going to a track and have the JSFX manipulate the MIDI data in some way.

Is there a way to do something similar for MIDI data that is being sent to plugins via the MIDI learn function? I want to intercept it and alter it before it gets to the plugin.

Or maybe you can suggest a different solution to my problem:

I have a MIDI controller with endless rotary encoders, which I have assigned to knobs in a plugin using relative increment/decrement mode. The encoders send out roughly 100 increment (or decrement) commands for each 360░ turn of the encoder.

The VST knob I want to control goes from 0.0 to 100.0 in 0.1 steps, so there are 1000 steps from the minimum value to the maximum value. Thus it takes roughly 10 full 360░ turns of the rotary encoder to go from the minimum value to the maximum value. With my slow fingers, it takes me roughly 5-6 seconds to turn the encoder 10 full turns, which is WAY too slow to get decent control of the plugin parameters.

I would like to intercept the MIDI data from the controller, and measure the time between successive increment (or decrement) events. If the time between events is short, it means the encoder is being turned quickly. The shorter the time between events, the faster the encoder is being turned. When the encoder is being turned really fast, I would like to output extra increment (or decrement) events to create a pseudo acceleration factor for the encoder. At high acceleration, I could have it output maybe 9 extra events for every one it receives, which would result in 1000 increment (or decrement) events for a single very fast turn of the encoder. That would give me the kind of quick control I want for the plugin knobs.

I know how I would write this as a JSFX to intercept MIDI data going to a track. I just don't know how I would write something to intercept MIDI learn data before it gets to a plugin. Could I do it with a Lua script that is continuously running in the background? If so how? (I'm familiar with Lua scripts, but not with using them to intercept and manipulate MIDI controller data).
__________________
Best Regards, Ernie "lunker" Lundqvist
BDSM (Bad Dog Studio Musicians)
Windows 10 running on Z390 + i7-8700

Last edited by lunker; 09-11-2019 at 08:42 AM.
lunker is offline   Reply With Quote
Old 09-11-2019, 12:10 PM   #2
kenm
Human being with feelings
 
Join Date: Dec 2011
Location: San Jose, CA, USA
Posts: 84
Default

Subscribed.

I too am interested in doing something similar. I'm trying to integrate a Presonus ATOM pad controller with Reaper and I need to be able to pre-process the MIDI data coming from it. So far I've only been able to locate CreateMIDIInput() which is only available in the C++ API.
kenm is offline   Reply With Quote
Old 09-11-2019, 12:43 PM   #3
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,238
Default

JSFX are just effects, so they can't reach outside the normal signal flow to grab the MIDI before it hits the track. You could, however, have your effect as an input FX on the track to allow reading/rewriting the MIDI before it's recorded.
Lokasenna is online now   Reply With Quote
Old 09-11-2019, 12:57 PM   #4
lunker
Human being with feelings
 
lunker's Avatar
 
Join Date: Nov 2007
Location: Lucas, TX, USA (via Luleň, Sweden)
Posts: 956
Default

Thanks. Yes, I realize that JSFX is not what I need in this situation. The MIDI controller is not assigned to send data to any tracks.

But is there a different/ReaScript way to do the same type of thing that a JSFX would do, only have it apply to controller data going straight to a plugin via MIDI learn?
__________________
Best Regards, Ernie "lunker" Lundqvist
BDSM (Bad Dog Studio Musicians)
Windows 10 running on Z390 + i7-8700
lunker is offline   Reply With Quote
Old 09-11-2019, 01:15 PM   #5
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,238
Default

I don't think so - ReaScripts don't have access to incoming MIDI at all.
Lokasenna is online now   Reply With Quote
Old 09-11-2019, 01:21 PM   #6
lunker
Human being with feelings
 
lunker's Avatar
 
Join Date: Nov 2007
Location: Lucas, TX, USA (via Luleň, Sweden)
Posts: 956
Default

OK. I wasn't sure if ReaScript could or not.

Do you know if a C++ extension to Reaper would be able to intercept this kind of MIDI input? I think writing something like that is probably outside my range of interest. But if it's possible ...
__________________
Best Regards, Ernie "lunker" Lundqvist
BDSM (Bad Dog Studio Musicians)
Windows 10 running on Z390 + i7-8700
lunker is offline   Reply With Quote
Old 09-11-2019, 01:22 PM   #7
ThrashJazzAssassin
Human being with feelings
 
ThrashJazzAssassin's Avatar
 
Join Date: Oct 2010
Location: Scotland
Posts: 357
Default

You could process your MIDI using a JSFX then send it to REAPER's control path using MIDItoReaControlPath https://forum.cockos.com/showthread.php?t=43741
__________________
TJA MIDI JSFX | REAPER-OSC-panels | erthoide
ThrashJazzAssassin is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 10:45 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.