Fader control via HUI Emulation | Two questions
Hi friends,
I just implemented the HUI fader control script and I'm successfully controlling faders with the knobs on my Arturia Minilab. This is awesome. Two questions:
Has anyone built a command to bank faders yet?
Right now, this only works with my knobs set to output absolute data, which is a bit dodgy. Anyone figure out how to do this with relative midi data? (so that the faders don't randomly jump around when new data is recieved)
Thanks!
Collin
- Christian Scheuer @chrscheuer2019-10-29 21:06:37.880Z
Hi Collin.
That's a great question.
Can you share the script you're using now? It might be the easiest to simply append to that.Christian Scheuer @chrscheuer2019-10-29 21:09:30.618Z
Are your knobs endless/virtual (can they rotate all the way around)?
- CIn reply toCOLLIN_WARREN7⬆:COLLIN WARREN @COLLIN_WARREN7
Hi Christian,
First off, thank you for all your help. Your support and response time is dynamite!
Here is the code I'm using currently below. Yes, the knobs are continuous and they have both an Absolute setting that makes them output values between 1-127 or they have a relative setting that outputs one value for down and another for up.
Thanks,
Collin
Code:
var firstFaderCC = 12; var numberOfFaders = 16; var m = event.trigger.midiBytes; var m1 = m[0], m2 = m[1], m3 = m[2]; if (m1 == 0xb0 && m2 >= firstFaderCC && m2 <= (firstFaderCC + numberOfFaders - 1)) { var val = m3 * 127; sf.midi.huiFader({ faderNum: m2 - firstFaderCC + 1, value: val, touchAndRelease: true, }); }
Christian Scheuer @chrscheuer2019-10-30 14:46:24.584Z
Cool, let's use the relative setting then.
they have a relative setting that outputs one value for down and another for up.
Can you show me in code or in a midi debugger what those values are?
- CCOLLIN WARREN @COLLIN_WARREN7
Yes, so when I program them controlling plugins:
the "down" values are 61,62,63
and the "up" values are 65, 66, 67Christian Scheuer @chrscheuer2019-10-30 15:01:52.591Z
Cool and these are CC values right? Just to make sure I get the full picture.
I assume 61 and 67 are for big/quick moves, 62 and 66 for medium moves and 63, 65 for smaller/slower moves.
That way you could dovar delta = m2 - 64;
and your delta would then be in the range-3 .. 3
.- CCOLLIN WARREN @COLLIN_WARREN7
These are CC values. However, I don't know what the logic is of using the three numbers. I always thought that perhaps it was acting more like a round robin?? I know in CM, some of the modules only "fire" when they recieve a new or different value. So, thought maybe it functioned more on that concept...
Christian Scheuer @chrscheuer2019-10-30 15:08:03.036Z
Gotcha. See my comment here with an example. That example translates the delta to be speed-dependent, but if it's round robin we could implement that instead.
- In reply tochrscheuer⬆:
Christian Scheuer @chrscheuer2019-10-30 15:06:25.708Z
I suspect something like this should work then (wholly untested):
var firstFaderCC = 12; var numberOfFaders = 16; var m = event.trigger.midiBytes; var m1 = m[0], m2 = m[1], m3 = m[2]; if (m1 == 0xb0 && m2 >= firstFaderCC && m2 <= (firstFaderCC + numberOfFaders - 1)) { var faderNum = m2 - firstFaderCC + 1; var stateKey = 'faderValues_' + faderNum; var oldVal = globalState[stateKey]; if (oldVal === undefined) oldVal = 64; //Start mid-way if nothing is defined var delta = m3 - 64; var val = Math.max(0, Math.min(127, oldVal + delta)); globalState[stateKey] = val; //Store the new value //Calculate value in the shape HUI expects var expandedVal = val * 127; //Send HUI sf.midi.huiFader({ faderNum: faderNum, value: expandedVal, touchAndRelease: true, }); }
- CCOLLIN WARREN @COLLIN_WARREN7
Let's give it a whirl!
Christian Scheuer @chrscheuer2019-10-30 15:10:52.802Z
Please note what this script is doing is not sending relative HUI messages, since HUI does not use that.
It essentially stores internally in SoundFlow (in the globalState object) where you were located at for each of the faders.
So it's not necessarily full on what you were hoping for. But it's a start.In other words, if you change to other tracks, it won't pick up where you were on those new tracks, but pick up from where you were before.
- CCOLLIN WARREN @COLLIN_WARREN7
Gotcha. Yeah, so... the behavior I'm experiencing with this is:
If I'm starting with the fader at unity, when I turn the knob either up or down, the fader snaps to a value of -13.4dB and then no longer movesChristian Scheuer @chrscheuer2019-10-30 15:13:39.521Z
Hmmmm
Christian Scheuer @chrscheuer2019-10-30 15:14:23.100Z
And this is with relative 61, 62, 63, 65, 66, 67 messages?
Christian Scheuer @chrscheuer2019-10-30 15:15:55.662Z
You might want to add a
log(delta);
line after thevar delta = m3 - 64;
line to check that it's correctly showing something between -3 and 3.- CCOLLIN WARREN @COLLIN_WARREN7
Hmm... So, adding that is throwing a bunch of notifications now. I'm not sure where I view them though
Christian Scheuer @chrscheuer2019-10-30 15:20:15.889Z
Either click SF icon -> Open Log File, or click the top right most corner of your screen, that will show you all notifications on the system.
- CCOLLIN WARREN @COLLIN_WARREN7
Ok, so here is what I'm getting when turning the knobs:
30.10.2019 11:21:15.91 [Backend]: 0
30.10.2019 11:21:16.01 [Backend]: 0
30.10.2019 11:21:16.06 [Backend]: 0
30.10.2019 11:21:16.17 [Backend]: 0
Christian Scheuer @chrscheuer2019-10-30 15:25:46.019Z
Okay cool. That explains why we're not seeing movement. The delta value is always 0.
This indicates it might not after all be sending what we're expecting, or there's a bug in the script.Try to remove that log statement and instead add this:
log(`m1: ${m1}, m2: ${m2}, m3: ${m3}`);
- CIn reply toCOLLIN_WARREN7⬆:Collin Warren @Collin_Warren
Hey Christian,
Thanks for all your help thus far. Any thoughts on a command to bank the faders? Or even better, is there any way to have it recognize a bank of all 16 faders, instead of in groups of 8? Or does HUI always work in groups of 8? I remember people having the little sidecars along with the Mackie Universal Controls-- so I would imagine there's a way to have higher fader counts...
Collin
Christian Scheuer @chrscheuer2019-10-30 23:17:02.943Z
Yes I think banking is most easily achieved by ctrl+shift clicking the track name.
This script will do exactly that:
sf.ui.proTools.selectedTrack.trackScrollToView(); sf.ui.proTools.selectedTrack.titleButton.mouseClickElement({ isControl: true, isShift: true, });
Also see this thread:
https://forum.soundflow.org/-503#post-5Christian Scheuer @chrscheuer2019-10-30 23:21:34.077Z
To your question about groups of 8.
The HUI protocol only supports 8 faders, but you can theoretically have 4 HUI devices set up in Pro Tools peripherals page. However, SoundFlow only has a single HUI device emulation, so at the moment you're limited to 8 at a time.
I'll note this down in our todo list to take a look at .