No internet connection
  1. Home
  2. How to

Getting an error in "How to control volume faders in Pro Tools using a MIDI controller. "

By Ryan Allam @Ryan_Allam
    2021-12-21 03:29:05.436Z

    Hey,

    I went through the step by step on how to control the volume faders with midi, but when I run the command I get the following error:

    • 13 replies
    1. Hi Ryan,

      I just checked your account. It looks like you may be trying to run this script by clicking Run Command?

      The idea is that you need to add a MIDI trigger to the command (MIDI Faders) so that the script will be run every time MIDI is received.

      You're seeing this error because the script tries to read which MIDI was received, but it can't since it's not being run by a MIDI trigger.

      1. RRyan Allam @Ryan_Allam
          2021-12-21 17:00:59.011Z

          Thanks!!!!!!!!

        • R
          In reply toRyan_Allam:
          Ryan Allam @Ryan_Allam
            2021-12-21 17:41:00.679Z

            Hey Chris,

            My first CC number is 74 instead of 7. So I replaced that in your code and now only the first fader is working. The reason being, my faders aren't numbered with a + 1 increment. My numbers are the following:
            Fader 1: 74
            Fader 2: 71
            Fader 3: 81
            Fader 4: 91
            Fader 5: 16
            Fader 6: 80
            Fader 7: 19
            Fader 8: 2

            I'm assuming that this part of the code is giving number 75 to the second fader correct?

            But my 2nd midi number is 71 instead.
            I changed it to the following but it stopped working and now when I move fader one I get an error

            error is:

            1. Gotcha, yea we can fix that. Can I get you to copy/paste the code in here so I can take a look?

              (see this for help: How to quote code in the SoundFlow forum. )

              1. Nevermind, I wrote it from the image you sent and made some changes so that it should support faders with arbitrary CC numbers.

                
                const ccNumbers = [
                    74, 71, 81, 91, 16, 80, 19, 2
                ];
                
                let m = event.trigger.midiBytes;
                let m0 = m[0], m1 = m[1], m2 = m[2];
                
                if (m0 == 0xB0)
                {
                
                    let ccIndex = ccNumbers.indexOf(m1);
                    if (ccIndex >= 0)
                    {
                        let val = m2 * 127;
                
                        sf.midi.huiFader({
                            faderNum: ccIndex + 1,
                            value: val,
                            touchAndRelease: true,
                        });
                    }
                
                }
                
            2. R
              In reply toRyan_Allam:
              Ryan Allam @Ryan_Allam
                2021-12-21 17:46:57.374Z

                That's your original code.

                const firstFaderCC = 74;
                const numberOfFaders = 8;

                let m = event.trigger.midiBytes;
                let m1 = m[0], m2 = m[1], m3 = m[2];

                if (m1 == 0xb0 && m2 >= firstFaderCC && m2 <= (firstFaderCC + numberOfFaders - 1)) {
                let val = m3 * 127;

                sf.midi.huiFader({
                faderNum: m2 - firstFaderCC + 1,
                value: val,
                touchAndRelease: true,
                });
                }

                1. R
                  In reply toRyan_Allam:
                  Ryan Allam @Ryan_Allam
                    2021-12-21 17:47:30.520Z

                    that's what I tried to do:

                    const firstFaderCC = 74;
                    const numberOfFaders = 8;

                    let m = event.trigger.midiBytes;
                    let m1 = m[0], m2 = m[1], m3 = m[2];

                    if (m1 == 0xb0 && m2 >= firstFaderCC && m2 <= (firstFaderCC + numberOfFaders - 1)) {
                    let val = m3 * 127;

                    sf.midi.huiFader({
                    faderNum: m2 - firstFaderCC - 3,
                    value: val,
                    touchAndRelease: true,
                    });
                    }

                    1. R
                      In reply toRyan_Allam:
                      Ryan Allam @Ryan_Allam
                        2021-12-21 18:18:34.097Z

                        Thanks for the code!

                        Still, only the one fader work whenever I "Ctrl" + "Shift" + Click BUT here's the new thing :
                        It's always the midi trigger that works. For example, If I use my 3rd midi knob (that has a value 81) for the midi trigger, then only the 3rd fader will work. If I use the first midi knob then it's only the first fader that works.

                        1. It sounds like you're using the RECORD button when you create your MIDI trigger. That would bind the MIDI trigger to a specific fader. Make sure that All Channels and All Events is selected

                        2. R
                          In reply toRyan_Allam:
                          Ryan Allam @Ryan_Allam
                            2021-12-21 23:59:09.229Z

                            No, I got All channels. The way I resoled it is by creating 8 different Midi scripts one for each fader. It worked :) I know it's not ideal but for now it's fine.
                            Quick question, is it possible to link midi knobs to the EQ7 in Pro Tools? I would need that much more than volume. Is it doable?

                            1. Hi Ryan,

                              There's no need to create more than one script. Your MIDI triggers here haven't selected All Channels and All Events. Note that "All Events" is the most important one here.

                              The only thing that should be selected in your trigger is the MIDI Device.

                              1. Your entire trigger should look like this:

                                1. For now, changing plugins from MIDI is not possible, but watch this space, we may have something coming soon :) (I can't say any more though)