For easy BG editing -- just looking to make a selection of checkerboarded clips and have the script take care of extending and fading.
- OOwen Granich-Young @Owen_Granich_Young
Built 2 ways.
- AAMPM101 @AMPM101
This is great. However it uses batch fades -- is there a version that uses an exact 2 frame fade in and fade out? It would probably have to go clip by clip and extend, then move the cursor two frames, fade-in, tab to the end, move the cursor two frames in, fade-out, move to next clip, etc.
Also, the replies at the bottom of the above suggest the script no longer works in the latest versions of PT?
- OOwen Granich-Young @Owen_Granich_Young
I don't have PT right now (left the ilok at work) but try this... it's basically @samuel_henriques script except it tries to use set selection instead of batch fade for the fades. 100% untested...
/** * @param {number} extendFrames */ function tirmAndFade(extendFrames) { const frameRate = 23.976 const sampleRate = 48000 const extendAmount = sampleRate / frameRate * extendFrames const currentSelection = sf.ui.proTools.selectionGetInSamples() sf.ui.proTools.selectionSetInSamples({ selectionStart: +currentSelection.selectionStart - extendAmount, selectionEnd: +currentSelection.selectionEnd + extendAmount, }); sf.ui.proTools.menuClick({ menuPath: ["Edit", "Trim Clip", "To Fill Selection"] }); sf.ui.proTools.selectionSetInSamples({ selectionStart: +currentSelection.selectionStart + extendAmount, selectionLength: 0, }) sf.keyboard.press({ keys: "d" }); sf.wait({ intervalMs: 50 }) sf.ui.proTools.selectionSetInSamples({ selectionStart: +currentSelection.selectionEnd - extendAmount, selectionLength: 0, }) sf.keyboard.press({ keys: "g" }); sf.wait({ intervalMs: 50 }) }; function main() { sf.ui.proTools.appActivateMainWindow(); sf.ui.proTools.invalidate(); //Get selected tracks const originalTracks = sf.ui.proTools.selectedTrackNames; //Do for each track. sf.ui.proTools.selectedTracks.trackHeaders.slice().map(track => { //Select track track.trackSelect(); //Scroll track into View track.trackScrollToView(); //Do for each clip on Track sf.ui.proTools.clipDoForEachSelectedClip({ action: () => { tirmAndFade(1); }, onError: "Continue", }); }); //Restore previously selected tracks sf.ui.proTools.trackSelectByName({ names: originalTracks }); }; main();
samuel henriques @samuel_henriques
here's a slightly more stable/faster trimAndFade function.
@AMPM101, either of these scripts will extend by the length you set at line 59trimAndFade(1)
and make a fade of twice the length.
that means you'll get this, with both fades equal.If you want one frame extension and one frame fade,
you can remove
+ extendAmount
on line 19 and- extendAmount
on line 27 on Owen's script.
Or if you want the function I updated, remove the same but on lines 18 and 19.
Remember to set your frame rate and sampleRate so you get the correct frame length./** * @param {number} extendFrames */ function tirmAndFade(extendFrames) { const frameRate = 23.976 const sampleRate = 48000 const extendAmount = sampleRate / frameRate * extendFrames const currentSelection = sf.ui.proTools.selectionGetInSamples() sf.ui.proTools.selectionSetInSamples({ selectionStart: +currentSelection.selectionStart - extendAmount, selectionEnd: +currentSelection.selectionEnd + extendAmount, }); sf.ui.proTools.menuClick({ menuPath: ["Edit", "Trim Clip", "To Fill Selection"] }); sf.ui.proTools.selectionSetInSamples({ selectionStart: +currentSelection.selectionStart + extendAmount, selectionEnd: +currentSelection.selectionEnd - extendAmount, }); sf.ui.proTools.menuClick({ menuPath: ["Edit", "Fades", "Fade to Start"] }); sf.ui.proTools.menuClick({ menuPath: ["Edit", "Fades", "Fade to End"] }); }; function main() { sf.ui.proTools.appActivateMainWindow(); sf.ui.proTools.invalidate(); //Get selected tracks const originalTracks = sf.ui.proTools.selectedTrackNames; //Do for each track. sf.ui.proTools.selectedTracks.trackHeaders.slice().map(track => { //Select track track.trackSelect(); //Scroll track into View track.trackScrollToView(); //Do for each clip on Track sf.ui.proTools.clipDoForEachSelectedClip({ action: () => { tirmAndFade(1); }, onError: "Continue", }); }); //Restore previously selected tracks sf.ui.proTools.trackSelectByName({ names: originalTracks }); }; main();