Extend head and tail and fade 1 frame...
I downloaded the Sreesh package that has this function but it just doesn’t work - I tend to get the 1 fade frame in and then an arbitrarily long fade out if I’m selecting a single file region.
The idea for this would be to select a group of BG tracks and run the command to automatically apply 1 frame in/out fades on say a dozen tracks at once but it’s just not working - has anyone had success with this?
Linked from:
- Christian Scheuer @chrscheuer2021-04-16 07:44:17.174Z
If you have nudge set to 1 frame, simulating these keystrokes should do it (for extending selection):
sf.keyboard.press({ keys: 'shift+alt+numpad minus, shift+cmd+numpad plus' });
And for extending the selected clip (not the selection):
sf.keyboard.press({ keys: 'alt+numpad minus, cmd+numpad plus' });
Christian Scheuer @chrscheuer2021-04-16 07:47:30.071Z
Ensuring nudge is set to 1 frame (when working in TC) can be done by this:
sf.ui.proTools.nudgeSet({ value: '00:00:00:01.00' });
Christian Scheuer @chrscheuer2021-04-16 07:48:50.914Z2021-04-16 07:57:31.728Z
And here is a more complete solution, which will
- ensure nudge is set to 1 frame
- extend the selection 2 frames
- trim to your selection
- apply a batch fade preset
function ensureGridIsOneFrame() { var nudgeValueField = sf.ui.proTools.mainWindow.gridNudgeCluster.nudgeControls.nudgeValue.invalidate(); var nudgeValue = (nudgeValueField.value.value + '').trim(); if (nudgeValue.indexOf('+') >= 0) { //Feet+Frames if (nudgeValue != '0+01.00') { nudgeValueField.elementClick(); sf.keyboard.press({ keys: '0, right, 1, right, 0, enter' }); } } else { //Assume timecode if (nudgeValue != '00:00:00:01.00') { sf.ui.proTools.nudgeSet({ value: '00:00:00:01.00' }); } } } function extendSelectionOnEitherSide(frameCount) { ensureGridIsOneFrame(); sf.keyboard.press({ keys: 'alt+shift+numpad minus', repetitions: frameCount }); sf.keyboard.press({ keys: 'cmd+shift+numpad plus', repetitions: frameCount }); } function trim() { sf.ui.proTools.getMenuItem('Edit', 'Trim Clip', 'To Selection').elementClick(); } function createFade(presetNum) { sf.ui.proTools.getMenuItem('Edit', 'Fades', 'Create...').elementClick(); var win = sf.ui.proTools.windows.whoseTitle.is('Batch Fades').first.elementWaitFor({ timeout: 500 }, 'Could not find Batch Fades window').element; win.buttons.whoseTitle.is('Fade Preset Toggle').allItems[presetNum - 1].elementClick({}, 'Could not click preset button'); win.buttons.whoseTitle.is('OK').first.elementClick(); } sf.ui.proTools.appActivateMainWindow(); extendSelectionOnEitherSide(2); //Change to 5 for 5 frames trim(); createFade(1); //Change to a different number for a different Batch Fades preset.
Christian Scheuer @chrscheuer2021-04-16 07:49:40.906Z
Here's another variant, which allows you to have the script automatically select the scene (between 2 markers) and do the rest for you.
sf.ui.proTools.appActivateMainWindow(); function selectBetweenMarkers() { var markerBtnFrame = sf.ui.proTools.mainWindow.getFirstWithTitle('Add Marker/Memory Location').frame; var timelineFocusBtnFrame = sf.ui.proTools.mainWindow.timelineFocusButton.frame; var markerAreaWidth = timelineFocusBtnFrame.x - (markerBtnFrame.x + markerBtnFrame.w); var markerAreaHeight = markerBtnFrame.h; var markerAreaMidPoint = { x: Math.floor(markerBtnFrame.x + markerBtnFrame.w + markerAreaWidth / 2), y: Math.floor(markerBtnFrame.y + markerBtnFrame.h / 2) }; var selTrackNames = sf.ui.proTools.selectedTrackNames; sf.keyboard.press({ keys: 'left' }); sf.mouse.click({ position: markerAreaMidPoint, isCommand: true, }); sf.keyboard.press({ keys: 'l, shift+quote' }); sf.ui.proTools.trackSelectByName({ deselectOthers: true, names: selTrackNames }); } function ensureGridIsOneFrame() { /*var gridValueFieldValue = sf.ui.proTools.mainWindow.gridNudgeCluster.gridControls.textFields.getByTitle('Grid Value').value; if (gridValueFieldValue.invalidate().value !== '00:00:00:01.00') { sf.ui.proTools.gridSet({ gridValueName: '00:00:00:01.00' }); }*/ } function extendSelectionByTwoFramesOnEitherSide() { ensureGridIsOneFrame(); sf.keyboard.press({ keys: 'alt+shift+numpad minus, alt+shift+numpad minus, cmd+shift+numpad plus, cmd+shift+numpad plus' }); } function trim() { sf.ui.proTools.getMenuItem('Edit', 'Trim Clip', 'To Selection').elementClick(); } function createFade(presetNum) { sf.ui.proTools.getMenuItem('Edit', 'Fades', 'Create...').elementClick(); var win = sf.ui.proTools.windows.whoseTitle.is('Batch Fades').first.elementWaitFor({ timeout: 500 }, 'Could not find Batch Fades window').element; win.buttons.whoseTitle.is('Fade Preset Toggle').allItems[presetNum - 1].elementClick({}, 'Could not click preset button'); win.buttons.getByTitle('OK').elementClick(); } /*function showOutputWin() { sf.ui.proTools.selectedTrack.trackOutputToggleShow(); }*/ function goToOutputWindow() { //sf.ui.proTools.appActivateMainWindow(); function openTrackOutputWindowAndCenterMouse() { var mainTrackOutWin = sf.ui.proTools.mainTrackOutputWindow; //Først: optimistic... if (mainTrackOutWin.exists) { var f = mainTrackOutWin.frame; if (f) { sf.mouse.setPosition({ position: { x: f.x + f.w / 2, y: f.y + f.h / 2, } }); } } var doToggle = false; if (mainTrackOutWin.invalidate().exists) { var trackName = mainTrackOutWin.buttons.whoseTitle.startsWith('Track selector').first.value.value; doToggle = (trackName !== sf.ui.proTools.selectedTrackNames[0]); } else doToggle = true; if (doToggle) sf.ui.proTools.selectedTrack.outputWindowButton.elementClick(); mainTrackOutWin.invalidate().elementRaise(); var f = mainTrackOutWin.frame; sf.mouse.setPosition({ position: { x: f.x + f.w / 2, y: f.y + f.h / 2, } }); } function ensureInputOpen() { var t = sf.ui.proTools.selectedTrack; if (t.insertSelectorButtons[0].value.value !== 'open') { t.trackInsertToggleShow({ insertNumber: 1 }); } } openTrackOutputWindowAndCenterMouse(); ensureInputOpen(); } selectBetweenMarkers(); extendSelectionByTwoFramesOnEitherSide(); trim(); createFade(3); //goToOutputWindow();
Christian Scheuer @chrscheuer2021-04-16 07:57:08.756Z
The benefits of these approaches is that you start by just dropping your BGs "oversize" over the scene, so you don't have to worry yourself about hitting the scene boundary and cutting it to size.
This command will both do that and apply the fades, so placing BGs becomes much more fun :)Christian Scheuer @chrscheuer2021-04-16 07:58:27.886Z
For this very reason, I use memory locations as scene boundaries, and instead use clip groups for notes - because this allows me to both search for scenes using Ctrl+M (SF's marker search) but in particular because it speeds up BG laying.
- JJon Lipman @Jon_Lipman
Thank you I’ll try these out shortly - I used to use markers as scene boundaries.
I switched to clip groups as I now use markers to drop spotting notes in real time (car by, door close etc)
I actually just started using your notes app within SF as a second marker board so we’ll see how that works.
- In reply tochrscheuer⬆:GGabriel Lundh @Gabriel_Lundh
This is fantastic!! Thank you for your magic skills, Christian!
- In reply tochrscheuer⬆:GGray Aletter @Gray_Aletter
This is fantastic, thanks! I have a similar question if that's okay.
I'm wondering if you've created a script that when selecting a clip and running it, it would trim the head and tail by say 10-20 frames. That function along with this script would be very powerful for cutting BGs.
Thanks Christian!
- OOwen Granich-Young @Owen_Granich_Young
Hey Gray, this should really be a new post but here's one that does that (assuming 48k session 23.976 frame rate) the 2nd number on Lines 5 and 6 define the number of frames (currently 10 off each side)...
And if you want to change the Frame rate the first number defines the samples per Frame:
24fps would be 2000
23.976 is 2002
25fps is 1920
29.97fps 1602If you wanted to change frame rates... sense making?
function trimDown() { var originalSelection = sf.ui.proTools.selectionGetInSamples(); sf.ui.proTools.selectionSetInSamples({ selectionStart: Number(originalSelection.selectionStart) + 2002 * 10, ///Define head Trim Ammount Here selectionEnd: Number(originalSelection.selectionEnd) - 2002 * 10 ///Define Tail Trim Ammount Here }); sf.ui.proTools.menuClick({ menuPath: ["Edit", "Trim Clip", "To Selection"], }); } trimDown();
- GGray Aletter @Gray_Aletter
This is great Owen thank you.
I actually have posted this question before so I can tag you with your answer there!
- In reply tochrscheuer⬆:Y____1 @Yup
Hi. This script doesn't seem to work in the current version of protools. Is there a solution?
Kitch Membery @Kitch2024-06-17 17:48:37.617Z
Hi @Yup,
The best way to get help with a macro or script in SoundFlow is to use the Script Help Workflow. By doing so, the SoundFlow community and our team will get the information we need to troubleshoot the script.
To learn how to do this, please see the following article/video at the following link.
- SIn reply toJon_Lipman⬆:Sreejesh Nair @Sreejesh_Nair
sf.ui.proTools.appActivateMainWindow(); sf.ui.proTools.invalidate(); // Check if 'Tab to Transient' is selected var isTabToTransientSelected = sf.ui.proTools.getMenuItem('Options', 'Tab to Transient').exists; // Store the current nudge value var currentNudgeValue = sf.ui.proTools.mainWindow.gridNudgeCluster.nudgeControls.nudgeValue.value.value; // Function to execute the main keyboard command sequence function executeMainCommandSequence() { sf.keyboard.press({ keys: "alt+numpad minus, cmd+numpad plus, left, down, period, d, tab, comma, g", }); } // Toggle 'Tab to Transient' if it's selected if (isTabToTransientSelected) { sf.keyboard.press({ keys: "cmd+alt+tab" }); } // Change nudge value if it's different from the target value and execute the command sequence if (currentNudgeValue != '00:00:00:01.00') { sf.ui.proTools.nudgeSet({ value: '00:00:00:01.00' }); sf.wait({ intervalMs: 50 }); executeMainCommandSequence(); sf.ui.proTools.nudgeSet({ value: currentNudgeValue }); } else { // Execute the command sequence if the nudge value is already set executeMainCommandSequence(); } // Re-toggle 'Tab to Transient' to its original state if it was initially selected if (isTabToTransientSelected) { sf.keyboard.press({ keys: "cmd+alt+tab" }); }
Works in my case. Sorry I didnt see this post before!