No internet connection
  1. Home
  2. How to

Fader control via HUI Emulation | Two questions

By COLLIN WARREN @COLLIN_WARREN7
    2019-10-29 18:59:38.853Z

    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

    • 22 replies

    There are 22 replies. Estimated reading time: 8 minutes

    1. 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.

      1. Are your knobs endless/virtual (can they rotate all the way around)?

      2. C
        In reply toCOLLIN_WARREN7:
        COLLIN WARREN @COLLIN_WARREN7
          2019-10-30 14:44:57.694Z2019-10-30 14:45:42.297Z

          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,
              });
          }
          
          1. 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?

            1. CCOLLIN WARREN @COLLIN_WARREN7
                2019-10-30 14:57:59.479Z

                Yes, so when I program them controlling plugins:
                the "down" values are 61,62,63
                and the "up" values are 65, 66, 67

                1. 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 do var delta = m2 - 64; and your delta would then be in the range -3 .. 3.

                  1. CCOLLIN WARREN @COLLIN_WARREN7
                      2019-10-30 15:04:22.196Z

                      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...

                      1. 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.

                      2. In reply tochrscheuer:

                        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,
                            });
                        }
                        
                        1. CCOLLIN WARREN @COLLIN_WARREN7
                            2019-10-30 15:07:30.629Z

                            Let's give it a whirl!

                            1. 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.

                              1. CCOLLIN WARREN @COLLIN_WARREN7
                                  2019-10-30 15:13:11.127Z

                                  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 moves

                                  1. Hmmmm

                                    1. And this is with relative 61, 62, 63, 65, 66, 67 messages?

                                      1. You might want to add a log(delta); line after the var delta = m3 - 64; line to check that it's correctly showing something between -3 and 3.

                                        1. CCOLLIN WARREN @COLLIN_WARREN7
                                            2019-10-30 15:19:09.396Z

                                            Hmm... So, adding that is throwing a bunch of notifications now. I'm not sure where I view them though

                                            1. 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.

                                              1. CCOLLIN WARREN @COLLIN_WARREN7
                                                  2019-10-30 15:21:52.755Z

                                                  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

                                                  1. 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}`);
                                                    
                        2. C
                          In reply toCOLLIN_WARREN7:
                          Collin Warren @Collin_Warren
                            2019-10-30 23:14:43.840Z

                            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

                            1. 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-5

                              1. 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 .