No internet connection
  1. Home
  2. How to

Extend a clip by 0.25 frames start and end and apply a 0.50 fade at both ends.

By Tony Gibson @Tony_Gibson
    2023-05-04 14:54:25.586Z

    Hey all, been trying to make a script to do this but am having a bit of trouble. Anyone have something that will help?

    • 3 replies
      1. TTony Gibson @Tony_Gibson
          2023-05-04 17:32:34.731Z

          Thanks Chris, will have a read.

        • T
          In reply toTony_Gibson:
          Tony Gibson @Tony_Gibson
            2023-05-04 21:13:40.699Z

            They seem to be having the same problems as I am, this is how far i got with the code. But I cant seem to get it to switch the nudge to 0.25 and back after it has completed the task. At the moment its extending by 1 frame and doing a 1 frame fade.

            function extendAndFade() {
            // Activate Pro Tools window
            sf.ui.proTools.appActivateMainWindow();

            // Get original selection in samples
            const originalSel = sf.ui.proTools.selectionGetInSamples();
            
            // Extend selection on both sides by 0.25 frames
            sf.keyboard.press({ keys: 'alt+numpad minus', repetitions: 1 });
            sf.keyboard.press({ keys: 'cmd+numpad plus', repetitions: 1 });
            
            // Create fade in and fade out
            const fadeLength = 120; // 0.5 frames in samples at 48000Hz
            sf.ui.proTools.selectionSetInSamples({
                mainCounter: originalSel.selectionEnd,
                startCounter: Math.max(0, originalSel.selectionEnd - fadeLength),
                endCounter: originalSel.selectionEnd
            });
            sf.ui.proTools.menuClick({ menuPath: ["Edit", "Fades", "Fade to End"] });
            
            sf.ui.proTools.selectionSetInSamples({
                mainCounter: originalSel.selectionStart,
                startCounter: originalSel.selectionStart,
                endCounter: Math.min(originalSel.lengthInSamples, originalSel.selectionStart + fadeLength)
            });
            sf.ui.proTools.menuClick({ menuPath: ["Edit", "Fades", "Fade to Start"] });
            

            }

            extendAndFade();

            1. Progress
            2. T@Tony_Gibson closed this topic 2023-05-04 21:20:49.982Z.