No internet connection
  1. Home
  2. How to

Clear automation on unused areas.

By sharaasharaa1975 @sharaasharaa1975
    2023-03-03 15:03:47.177Z

    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.

    • 4 replies
    1. Brenden @nednednerb
        2023-03-06 00:19:27.428Z

        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;
        }};
        
        1. Ssharaasharaa1975 @sharaasharaa1975
            2023-03-06 09:38:20.786Z

            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

            1. Brenden @nednednerb
                2023-03-06 21:31:29.920Z

                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.

            2. Brenden @nednednerb
                2023-03-09 00:42:49.651Z

                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();
                }};