Clear automation on unused areas.
Hello, i want to clear automation on empty spaces in a selection. is there any way that soundflow can dettect if there is a clip on automation line or not? i don't exactly know if that's possible.
- Brenden @nednednerb
Cool I did it. I decided to try writing a script to do this.
I start with a selection, with the waveform visible, as well as the automation line I want to change. I am unsure about writing a particular value, but I was able to make it flat!
// housekeeping sf.ui.proTools.appActivateMainWindow(); sf.ui.proTools.mainWindow.invalidate(); //get endpoint of selection const endTotalSelection = sf.ui.proTools.selectionGetInSamples().selectionEnd; // put cursor at start of selection, make first sub-selection sf.keyboard.press({ keys: "down, shift+tab", }); // loop for selection of empty space and writing flat line of automation based on first value of empty space let endCurrentSelection = sf.ui.proTools.selectionGetInSamples().selectionEnd; while (endCurrentSelection < endTotalSelection) { if (sf.ui.proTools.selectionGetInfo().isPureEmptySpace) { sf.ui.proTools.menuClick({ menuPath: ["Edit","Automation","Write to Current"],}) sf.keyboard.press({ keys: "up, shift+tab",}) endCurrentSelection = sf.ui.proTools.selectionGetInSamples().selectionEnd; } else {sf.keyboard.press({ keys: "up, shift+tab",}); endCurrentSelection = sf.ui.proTools.selectionGetInSamples().selectionEnd; }};
- Ssharaasharaa1975 @sharaasharaa1975
Thank you! that's not exactly what im looking for but it gives me a foundation of script i can modify to maybe achieve what i want
Brenden @nednednerb
Instead of the "Write to Current" command, you could try the other options on the Edit > Automation menu. Otherwise, someone with more hard hitting scripting chops might be able to help you inject "0.0" or "-inf" or etc values.
- In reply tosharaasharaa1975⬆:Brenden @nednednerb
I refactored the script. I also wanted to point out to @Kitch that his tips directly helped me to solve my issues with declaring functions with arrows, that is, once I used ChatGPT to tell me to use more parentheses in my methods! Haha
/* Script for looping through the clips and empty regioins on a timeline selection, and where there is empty space, to write a flat line of automation based on the value of the automated paramater at the onset of the empty space. */ // housekeeping sf.ui.proTools.appActivateMainWindow(); sf.ui.proTools.mainWindow.invalidate(); // declare variables and functions const endOfInitialSelection = sf.ui.proTools.selectionGetInSamples().selectionEnd; log("end of initial selection = " + endOfInitialSelection); let getEndOfCurrentSelection = () => { return sf.ui.proTools.selectionGetInSamples().selectionEnd; }; let endOfCurrentSelection; const isEmptySpaceWithoutClips = () => { return sf.ui.proTools.selectionGetInfo().isPureEmptySpace; }; const automateWriteToCurrent = () => { sf.ui.proTools.menuClick({ menuPath: ["Edit","Automation","Write to Current"], }); }; const selectNextRegion = () => { sf.keyboard.press({ keys: "up, shift+tab", }); }; // put cursor at start of selection, make first sub-selection sf.keyboard.press({ keys: "down, shift+tab", }); endOfCurrentSelection = getEndOfCurrentSelection(); log("current end of selection = " + endOfCurrentSelection); // begin loop to write automation after checking if a region has no clips while (endOfCurrentSelection < endOfInitialSelection) { // assess whether selected region is empty before doing action if (isEmptySpaceWithoutClips()) { log(isEmptySpaceWithoutClips()); automateWriteToCurrent(); selectNextRegion(); endOfCurrentSelection = getEndOfCurrentSelection(); log("current end of selection = " + endOfCurrentSelection); } else { selectNextRegion(); endOfCurrentSelection = getEndOfCurrentSelection(); }};