No internet connection
  1. Home
  2. How to

shift clip gain by a large amount on selected clips using scroll wheel command with modifiers -

By Sean @SeanH
    2019-10-03 22:05:43.832Z

    from our conversation on fb -

    would like to make commands for +-10, +-20, +-30 clip gain on selected clips.

    was trying to do this by simulating shift+control+scroll wheel -

    but couldn't get the scroll wheel to trigger with the modifiers held down (probably because I'm not using the script right)

    this is what I tried:

    sf.keyboard.modifiers({
    isControl: true,
    isShift: true
    });
    
    sf.mouse.scroll({
        delta: -30
        });
    
    sf.keyboard.modifiers();
    

    it didn't like when I tried to combine the modifiers into the sf.mouse.scroll line either

    • 21 replies

    There are 21 replies. Estimated reading time: 12 minutes

    1. Hm yea you're right this doesn't work very well.. I think what you're doing is right, I think Pro Tools just does not recognize wheel events with large deltas any differently from those with small.

      1. This one is a little clunky but rather fun. It will simulate dragging on the clip gain slider (20 pixels down):

        
        var trackHeight = sf.ui.proTools.selectedTrack.frame.h;
        var clipPoint = sf.ui.proTools.clipCenter().clipPoint;
        var startPos = { x: clipPoint.x + 3, y: clipPoint.y + trackHeight - 15 };
        var endPos = { x: startPos.x, y: startPos.y + 20 };
        
        sf.mouse.simulateDrag({
            startPosition: startPos,
            endPosition: endPos,
        });
        
        1. This one sets the clip gain to -30 dB (at least for me, pretty untested):

          sf.keyboard.press({ keys: 'ctrl+shift+b' });
          
          var trackHeight = sf.ui.proTools.selectedTrack.frame.h;
          var clipPoint = sf.ui.proTools.clipCenter().clipPoint;
          var startPos = { x: clipPoint.x + 3, y: clipPoint.y + trackHeight - 15 };
          var endPos = { x: startPos.x, y: startPos.y + 28 };
          
          sf.mouse.down({
              position: startPos,
              isCommand: true,
          });
          sf.wait({ intervalMs: 100 });
          sf.mouse.setPosition({
              position: endPos,    
          });
          sf.wait({ intervalMs: 10 });
          sf.mouse.up({
              position: endPos,
          });
          
          1. Another way to implement this would be to have a set of pre-defined clips with pre-set clip gains somewhere out in the outskirts of the timeline.
            Send SoundFlow there (set the selection), click ctrl+shift+c to copy the clip gain, and then go back to the original selection and paste it there.

            1. SSean @SeanH
                2019-10-04 15:24:53.017Z

                cool I'll test all of these

                1. In reply tochrscheuer:
                  SSean @SeanH
                    2019-10-04 18:06:06.920Z

                    this might be the best solution — because it wouldn't rely on the position of the clip gain icon — and also you could apply it to a whole set of clips at once.

                    1. Yea I agree :)
                      Are you man for trying to write a script for it?

                      1. SSean @SeanH
                          2019-10-04 18:22:29.947Z

                          ya let me give it shot, sounds like just the right amount of challenge for me.

                          I might fail haha - but will post back here with results

                    2. In reply tochrscheuer:
                      SSean @SeanH
                        2019-10-04 18:01:40.017Z

                        so I got both the above methods to work - but they ONLY work on clips that don't have any FADES (specifically fade ins) — because when you add a fade to the clip it moves the clip gain icon over by the length of the fade.

                        but for clips without any fades - seems to work pretty well so its a good start.

                        1. SSean @SeanH
                            2019-10-04 18:02:32.967Z

                            the second script seems a little speedier - and clearing clip gain first is a good idea for setting clip gain to a specific level after!

                            1. Hmm...the above scripts are not working for me. I assume the clip should be highlighted before running the script?

                              I made a macro that simply presses the keys Shift-Control-Down Arrow 30 times. It's slow and definitely not the most elegant way to do it. But it works every time, it's a lot less keystrokes for me, and it's just about the right amount of time for a sip of coffee :)

                              I look forward to someone figuring out something better, although I will miss the extra sips of coffee.

                              1. @sbiss I think the best idea for a stable solution is the one here: https://forum.soundflow.org/-1100#post-5
                                I think @SeanH is trying to implement a script for it (I'll help when he gets stuck)

                                1. @sbiss (sorry @SeanH for overtaking the response...) here is a script that works for me:

                                  function copyClipGainFromTime(time) {
                                      sf.ui.proTools.selectionSet({
                                          mainCounter: time,
                                      });
                                      sf.ui.proTools.getMenuItem('Edit', 'Copy Special', 'Clip Gain').elementClick();
                                      sf.ui.proTools.getMenuItem('Edit', 'Restore Last Selection').elementClick();
                                      sf.ui.proTools.getMenuItem('Edit', 'Paste').elementClick();
                                  }
                                  
                                  copyClipGainFromTime('01:18:27:18');
                                  

                                  It copies clip gain from the specified time to your selection (here timecode 01:18:27:18 since my session is in timecode. if you're in F+F, specify the time in F+F).

                                  You don't have to have a full clip selected before you invoke the command, you can just be in the middle of the clip.

                                  This only works if you at the end of your timeline have a few empty clips that have the correct clip gains applied (and that you change the script's time constant to point to those clips). It works by going to the clip whose timecode/f+f you specify, copying clip gain, then restoring the selection and applying it there. It works pretty fast here.

                                  1. One way to improve this could be to use memory locations instead of time-selection. So for example it could be changed to go to memory location "950" to set to -30, "951" to set to -40, etc. You'd then have clips at those memory locations with that clip gain.

                                    1. Such a script would look like this:

                                      function copyClipGainFromMemoryLocation(memoryLocationNumber) {
                                          sf.ui.proTools.memoryLocationsGoto({ memoryLocationNumber: memoryLocationNumber });
                                          sf.ui.proTools.getMenuItem('Edit', 'Copy Special', 'Clip Gain').elementClick();
                                          sf.ui.proTools.getMenuItem('Edit', 'Restore Last Selection').elementClick();
                                          sf.ui.proTools.getMenuItem('Edit', 'Paste').elementClick();
                                      }
                                      
                                      copyClipGainFromMemoryLocation(950);
                                      
                                      1. Another note - sorry for spamming the question - these clips need to reside on all tracks where you want to perform this. We could of course make the script work to also go to a specific track for copying, and then go back, but that would make it slower - and I think we're trying to optimize for speed here.

                                        1. That's definitely a creative approach. Seems like it might be a lot to setup unless you're working in a session for a long time. I'll have to play around with it. I wonder if there's a way to script writing volume automation to a clip and then coalescing that to clip gain?

                                          1. Something like this can also work (much like you described). I've set autoConfirmation: true in the script because my PT warning dialogs are turned on. If your dialogs are turned off, set autoConfirmation to false.

                                            The script requires that the SoundFlow HUI peripheral is set up as the first peripheral.

                                            
                                            sf.ui.proTools.selectedTrack.titleButton.mouseClickElement({
                                                isControl: true,
                                                isShift: true,
                                            });
                                            
                                            sf.ui.proTools.automationPreview({ targetValue: 'Enable' });
                                            if (sf.ui.proTools.automationWindow.enableVolumeAutoButton.value.value !== "Selected")
                                                sf.ui.proTools.automationWindow.enableVolumeAutoButton.elementClick();
                                            
                                            sf.midi.huiFader({
                                                faderNum: 1,
                                                value: 4100,
                                                touchAndRelease: true,
                                            });
                                            
                                            sf.ui.proTools.automationWindow.writeAutoToSelectionButton.proToolsAutomationClickButton({ autoConfirmation: true });
                                            
                                            sf.ui.proTools.getMenuItem('Edit', 'Automation', 'Coalesce Volume Automation to Clip Gain').elementClick();
                                            
                                            sf.keyboard.press({ keys: 'ctrl+shift+c, v' });
                                            
                                    2. In reply tochrscheuer:
                                      SSean @SeanH
                                        2019-10-07 21:52:54.618Z

                                        you beat me to it. my script wouldn't have been this elegant anyway.

                                        I added one line to it so that the timeline view also jumps back to your original selection at the end.

                                        function copyClipGainFromTime(time) {
                                            sf.ui.proTools.selectionSet({
                                                mainCounter: time,
                                            });
                                            sf.ui.proTools.getMenuItem('Edit', 'Copy Special', 'Clip Gain').elementClick();
                                            sf.ui.proTools.getMenuItem('Edit', 'Restore Last Selection').elementClick();
                                            sf.ui.proTools.getMenuItem('Edit', 'Paste').elementClick();
                                            sf.keyboard.press({ keys: 'q' });
                                        }
                                        
                                        copyClipGainFromTime('20:00:00:00');
                                        

                                        maybe there is a better way to do that without relying on keyboard press, but this works.

                                        also I think the simplest way to set this up is to just create a huge vertical region group across all the tracks in your session at this distant TC, set the clip gain on that group once, and your good to go. pretty painless

                                        the other thing i noticed was you need to make this region group LONGER then whatever your TC is, so it is pulling the clip gain from being located inside on the clip rather then the first frame of the clip.

                                        1. SSean @SeanH
                                            2019-10-07 22:03:54.893Z

                                            the next challenge is to figure out a way to modify existing clip gain by a set amount on a bunch of clips at once, WITHOUT clearing any of the existing volume automation.

                                            so like say I have a bunch of BGs that all already have various different clip gain settings from the editor, and then also already have volume moves on them from a premix, that I want to keep intact. But I want to hit soundflow script and to drop all the clip gains by 20 db for each clip respective of the current clip gain levels.

                                            maybe not possible haha but could be cool.

                                            I guess the the Shift-Control-Down Arrow + coffee sipping would do that if nothing else.

                                            1. Yea I think you're right, I don't see an alternative to Ctrl+Shift+Down for that atm. Hopefully we'll get more control in the future :)