I wonder if someone successfully handled relative MIDI CC events that some hardware controllers support.
Is there a way to detect relative knob MIDI events?
The MIDI data of knob in relative mode looks like this:
I could probably guess that controllers that send the same CC value in a row are in relative mode. Not sure…
I have an Arturia minlab midi controller. It has a relative knob mode wherein it sends out controller values between 55 and 73, inclusive. As you immediately see , these values are centered round 64. It should be interpreted so as to update the current controller value with (newValue - 64), the newValue being in [55…73]. If you move the knob very slow, the controller (the Minilab) sends out 65 or 63, if you move it very briskly, it sends out 73 or 55 etc.
Note that the knob values in this relative mode is limited between 55 and 73. That makes it possible to check the mode when the user rotates a knob. Below is a small excerpt directly from the code vault…
You add the new value to the old and checks if it’s within the range [55 73]. If not you treat the controller as sending absolute values from then on. There are a few additional checks, e.g you exclude controler number 0 and 32 (bank select) as well as values the 0 and 127. Don’t remember why anymore… It’s more or less an ad hoc solution but I remeber it worked.
But I have no clue if this works for your controller as it seems to send values 1 and 127, which my Arturia never does in relative mode (hence it was possible to detect the mode), so take my example just as an… example.
if (useRelativeControls)
{
//DBG(String(lastControllerValue));
if (lastControllerValue >= 55 && lastControllerValue <= 73)
{
auto midiMsgValue = &controllerValues[lastCCChannel][lastControllerNumber];
lastControllerValue = *midiMsgValue = (int8)jlimit(0, 127, *midiMsgValue + lastControllerValue - 64);
const_cast<uint8*>(msg.data)[2] = lastControllerValue & 0x7f;
}
//Do a check if we should leave relative mode
else if (lastControllerNumber > 1 && lastControllerNumber < 121 && lastControllerNumber != 32
&& lastControllerValue != 0 && lastControllerValue != 127)
useRelativeControls = false;
}
Thanks for the information. Looks like it’s a mess. There is no real specification.
I found the following info on the Arturia web page:
Depending on the relative mode used, the values sent and the reference value will vary depending on the DAW or software used. The expected values may also differ.
Our Controllers are handling 3 different Relative modes described below:
Relative 1 : The knob will send values 61-63 when turned in a negative direction and values 65-67 when turned in a positive direction. The turn speed determines the parameter response.
Relative 2 : The knob will send values 125-127 when turned in a negative direction and values 1-3 when turned in a positive direction. The turn speed determines the parameter response.
Relative 3 : The knob will send values 13-15 when turned in a negative direction and values 17-19 when turned in a positive direction. The turn speed determines the parameter response.
Please note that a “0” value will be sent between each steps.
In relative mode 1, moving (slowly) right will send 65/64/65/64/65 etc… This addition of this “0” value has been made to prevent browsing issues in Ableton Live.
This parameter was called “knob fix” in Midi Control Center, but has been hard implemented in the last firmware versions.
I need to take a closer look at it. Think we have to decide which option we support.
Edit: Nice to see that the arturia controller sends a zero value for each new controller value with the same timestamp. This makes detection simple. Unfortunately, I can’t see this behavior with the AKAI controller.
Depending on the relative mode used, the values sent and the reference value will vary depending on the DAW or software used. The expected values may also differ.
Sounds a bit obscure to me. How would the controller know what daw I’m using?! AI?
Anyway if the daw wants to auto check which mode the controller is using, I guess you could check the value received.
If its in [61…63] the controller is using Relative 1 mode, if it’s in [1, 2, 3, 125, 126, 127] it’s mode 2 whereas [13,14,15, 17, 18, 19] it’s mode 3. Any value outside of these reveals it’s in "natural mode.
You can choose between different relative modes in Ableton Live. Or you can choose different modes in the arturia controller. No AI and no guessing.
That’s the way you have to go when you want maximal compatibility and the result of a missing MIDI specification for this feature.
Ok. Apparently what they mean is not that the mode is dependent on on the daw, but on the setting the user have made on the controller.
I would go for an automatic detection.
How would sending zeroes between every value help things?
A leading zero with the same time stamp would be an easy way to find out that the user uses a relative controller in real-time without needing to detect it while doing MIDI learning. It normally makes no sense that the controller values have the same time stamp. Unfortunately, not all controllers do this.
This may work if you give the user some instruction while doing MIDI learn. I think it’s simpler to let the user choose the mode in the plugin settings.
Yes, I also think the software has to offer the options.
This may work if you give the user some instruction while doing MIDI learn. I think it’s simpler to let the user choose the mode in the plugin settings.
I usually turn the knobs on my gear to see if everything/anything works before I engage in any serious task. Instructions would’ve been wasted on me. But that’s just me. Maybe others just power up their gear, counts down and starts record in just no time. And then gets overly perplexed when the knobs of their new controller acts funny. For a second…
Automatic detection with additional checkboxes to lock in to the other modes for those that actually reads manuals before they use new gear is the way I would deal with the matter. And a little red led indicating the mode the plugin is currently locked to.