No internet connection
  1. Home
  2. How to

Best way of accomplishing this multi-step process.

By Eric Huergo @Eric_Huergo
    2022-10-22 01:33:57.777Z

    Hello, it's been a while!!! Hope you guys have been well!

    Was just wondering - I know it's possible to check a track's type and then process it as per @chrscheuer 's response in Delete Empty Audio Tracks in Selection is not Working.

    However, one thing I noticed about that script in particular is that it goes by and processes each track one at a time and goes down the line until the task is finished. What I'm wondering is if it would be possible to speed up the task by instead doing the process like so:

    1. User selects all tracks to be combed through.
    2. SoundFlow creates a list/index of all selected tracks that match the criteria (in this case: are audio tracks without clips in them.
    3. SoundFlow then selects only the tracks that match that criteria from the list and proceeds to delete them in one fell swoop.

    Does anyone know if this would be possible/actually significantly faster than the current method?

    Thanks for your insight!
    Best, Eric!

    • 3 replies
    1. Ryan DeRemer @Ryan_DeRemer
        2022-10-22 06:52:43.787Z

        Hi Eric,

        AFAIK the most reliable way to check if a track has clips on it is to read the track delete menu item. If it shows as Delete then there are no clips. If it shows Delete... then there are clips on the track (the track info doesn't show what clips are active or not). Thus, it has to select each track individually. Tracks don't report that information themselves.

        1. Eric Huergo @Eric_Huergo
            2022-10-24 20:44:02.856Z

            @Ryan_DeRemer - Thanks man, I think you're right about that, as far as I can tell that does seem to be the case! I am still trying to figure out however, if there was any way of speeding up the process for a whole session as I actually find it faster to do it manually than through the current script!

            My thoughts were more so that perhaps time could be saved by simply scripting a check of all tracks that does nothing but create a list/index of which tracks had no clips on them. Then, once the whole session has been checked, proceeds to select only the tracks indicated as empty and finishes by running the delete action for all of those selected tracks at the same time!

            The reason I'm trying to figure this out is because sometimes on larger sessions we might already have a lot going on so the session slows down. The deleting one track at a time is far too time consuming but I refuse to give up hope that there is a way to solve this issue!

            I guess my question now is if anyone knows how I can go about creating a list/index of tracks that don't have any clips on them, selecting them after a full check of the session and proceeding to delete. Really the hardest part is just figuring out how to generate that list!

            Any insight would be appreciated! :)

            1. Ryan DeRemer @Ryan_DeRemer
                2022-10-25 18:33:20.696Z

                Hey Eric. As I said, I believe the only way to check if a track has clips on it is to check the menu item for each track. I feel your pain. I have a script that takes a session that I'm given to mix and goes through a similar process, and that is still the part that takes the longest. However, to speed up the process of what comes after, you can have the script put take the track names of track with no clips on them, put them into an array to use in sf.ui.proTools.trackSelectByName(), select those tracks, and delete them. Something like this will delete all empty visible tracks:

                function deleteEmptyTracks() {
                    sf.ui.proTools.appActivateMainWindow();
                    sf.ui.proTools.mainWindow.invalidate();
                
                    let emptyTracks = [];
                    sf.ui.proTools.trackGetVisibleTracks().names.forEach(track => {
                
                        sf.ui.proTools.trackSelectByName({ names: [track], deselectOthers: true });
                
                        // refresh pro tools menus
                        sf.keyboard.press({ keys: 'left', repetitions: 2, fast: true });
                
                        if (sf.ui.proTools.getMenuItem('Track', 'Delete...').exists) emptyTracks.push(track);
                    });
                
                    sf.ui.proTools.trackSelectByName({ names: emptyTracks, deselectOthers: true });
                    sf.ui.proTools.menuClick({ menuPath: ['Track', 'Delete'], looseMatch: true });
                }
                
                deleteEmptyTracks();