No internet connection
  1. Home
  2. Support

Auto Align how to use

By Barnabas Vendli @Barnabas_Vendli
    2025-11-24 10:28:24.407Z

    Title

    Auto Align how to use

    Content type

    script

    Content name

    Auto Align_DX 1

    Content package

    Auto-Align Post

    Version info

    OS: macOS 15.6.1
    SoundFlow: 6.0.1
    Pro Tools: 25.10.0.144

    What do you expect to happen when you run the script?

    I would like to use auto-align so that it doesn’t look for DX 1 and DX 2 track names, but instead targets DIA A 1, and if nothing is there, then DIA B 1. In addition, I want it to render clip by clip the whole file, without consolidating the clips.

    Are you seeing an error?

    could not open pop up menu

    What happens when you run the script?

    How were you running this script?

    I used a Stream Deck button

    How important is this issue to you?

    5

    Details

    {
        "textExpected": "I would like to use auto-align so that it doesn’t look for DX 1 and DX 2 track names, but instead targets DIA A 1, and if nothing is there, then DIA B 1.\nIn addition, I want it to render clip by clip the whole file, without consolidating the clips.",
        "textError": "could not open pop up menu\n",
        "inputHowRun": "I used a Stream Deck button",
        "inputImportance": 5,
        "textTitle": "Auto Align how to use"
    }

    Source

    // get window
    var asWin = sf.ui.proTools.getAudioSuiteWindow("Auto-Align Post");
    
    //Open the plugin
    asWin = sf.ui.proTools.audioSuiteOpenPlugin({
        category: 'Other',
        name: "Auto-Align Post"
    }).window;
    
    //Set processing options
    asWin.audioSuiteSetOptions({
        processingInputMode: "ClipByClip",
        processingOutputMode: "CreateIndividualFiles"
    });
    
    // // Set Handle length to 4
    // asWin.textFields.whoseTitle.is('Processing Handle Length in Seconds').first.elementClick();
    // sf.keyboard.type({
    // text: "4",
    // });
    // sf.keyboard.press({
    // keys: "return",
    // });
    
    //Select Key Input
    sf.ui.proTools.firstAudioSuiteWindow.popupButtons.whoseTitle.is('Key Input').first.popupMenuSelect({
    menuPath: ["DX 1"],
    });
    
    ///Analyze
    // asWin.getFirstWithTitle("Analyze").elementClick();
    
    ///Wait till analyze done 
    // sf.ui.proTools.waitForNoModals();
    
    //Render
    asWin.audioSuiteRender();
    
    // // Close Window
    // sf.ui.proTools.viewCloseFocusedFloatingWindow();
    
    
    
    

    Links

    User UID: Sqa1dXPX32RbyMpWHxufBhmtKH33

    Feedback Key: sffeedback:Sqa1dXPX32RbyMpWHxufBhmtKH33:-OepP48oc4aivjjgkRdD

    Feedback ZIP: LxaeNsAI7L88By/9CQV8ry7GBAsz6ysPXcdwS6HXX+ekpUCl0UQ3PrrTiCF9vVY/BJG86Hk59qOaynwO6MyPYzRQAmPxaRuZQvi7Uh/8jT+/Mzo4BNPEhforRmcOGHVyO3aNbp01JMTxiV+lJLiJyBiQEKljgRbP+UOjFYtYcU9I4W4wBQO9MExnT8rq+YTvEQBDYSUBWuYvOCdxe5pw+Bq3MO+jMFuMGTc1MLW2yBNRf8lbz3XxXFOmZqiB9wxgUSLRRqVzHWsccu0DUKKgfF2s3j5l+u0zLz4PCrBvgl3vGYFElVlhDyqGQqkJ9diy5wurowurdV8H2+5joPXwZw==

    • 10 replies

    There are 10 replies. Estimated reading time: 13 minutes

    1. O

      Intersting twist on AA, so, to be clear what you mean is :

      Target 'DIA A 1' if there are no audio clips in selected range Target 'DIA B 1' , correct?

      BTW here is a good repository of other AA Scripts : Auto_Align Post Macro by @Owen_Granich_Young

      1. BBarnabas Vendli @Barnabas_Vendli
          2025-11-24 16:53:10.600Z

          Yes, I would love that. Thanks!

          1. To be clear it won't be 'SMART' if there's even a sample of fade out cross fade etc in the first track it will see that and consider it what it needs to Auto-Align to. Does that make this not useful or are you auto aligning in your workflow to never have editing overlap on there?

        • B
          In reply toBarnabas_Vendli:
          Barnabas Vendli @Barnabas_Vendli
            2025-11-24 17:09:26.576Z

            We usually separate the dialogue tracks by scene before running Auto-Align, so we end up with DX A 1, 2, etc., as well as DX B 1, 2, and so on. However, I haven’t been able to get the macro working properly. When I renamed my track to DX 1, SoundFlow recognized it, but it didn’t render the full file — I ended up losing the entire file because the clips got consolidated. My goal is to have individual Stream Deck buttons for DIA A 1, 2, 3, 4, etc., and DIA B 1, 2, 3, and so on. Does this make sense?

            Thank you!

            1. Hmm I mean I personally prefer one button to rule them all instead of hunting and pecking on the stream deck but to each their own. (Check that link for ones that will intelligently grab the first track in a selection and alight all others to that and so forth) BUT here's this twist:

              At the top name your key Track array of tracks to cycle through looking for clips. I've put your two example tracks to start. make a selection of the material you want aligned and run the script. It will check the array of tracks for first track with clips in it and choose that as the KEY Track and run auto align to it.

              //// DEFINE THE TRACKS YOU WANT TO CHECK THROUGH HERE
              
              let keyTrackArray = ['DIA A 1', 'DIA B 1']
              
              sf.ui.proTools.appActivateMainWindow();
              sf.ui.proTools.invalidate();
              
              ///GET TRACK INFO ALL
              let trckInfo = sf.app.proTools.tracks.invalidate().allItems.map(m => {
                  let mappedProps = {};
              
                  for (let prop in m) {
                      const itemsToSkip = ["Parent", "FriendlyNodeName", "SupportsAutoUpdate"];
              
                      if (!itemsToSkip.includes(prop)) {
                          const lowerCasePropName = prop.slice(0, 1).toLowerCase() + prop.slice(1);
                          mappedProps[lowerCasePropName] = m[prop];
                      }
                  }
                  return mappedProps;
              });
              
              
              /**
               * Returns the first track in keyTrackArray that contains clips.
               * If none contain clips, returns null.
               */
              function getFirstKeyTrackWithClips(keyTrackArray) {
                  for (let i = 0; i < keyTrackArray.length; i++) {
                      const trackName = keyTrackArray[i];
              
                      // Select the track
                      sf.app.proTools.selectTracksByName({ trackNames: [trackName] });
              
                      // Fetch clip info
                      const clipInfo = sf.app.proTools.getSelectedClipInfo();
              
                      // If this track has clips, return it
                      if (clipInfo.clips && clipInfo.clips.length > 0) {
                          return trackName;
                      }
                  }
              
                  // No tracks had clips
                  return null;
              }
              
              function autoAlignToTrackWithClipsFromArray(keyTrackArray) {
                  //// Get Selected Tracks as Name Only String Array
                  let slctdTrcks = trckInfo.filter(track => track.isSelected === true).map(track => track.name)
                  //// Get Keytrack from Array with Clips
                  let targetKeyTrack = getFirstKeyTrackWithClips(keyTrackArray);
                  
                  //// Reselect orginal tracks for aligning
                  sf.app.proTools.selectTracksByName({trackNames : slctdTrcks})
              
                  ///Check Status of Auto Align
                  const aApostIsOpen = sf.ui.proTools.windows.whoseTitle.is("Audio Suite: Auto-Align Post").first.exists
                  if (aApostIsOpen) {
                      sf.ui.proTools.windows.whoseTitle.is("Audio Suite: Auto-Align Post").first.elementRaise();
                  } else {
                      sf.ui.proTools.audioSuiteOpenPlugin({ category: "Other", name: "Auto-Align Post", });
                  }
              
                  /// Define Auto-Align Window
                  let win = sf.ui.proTools.firstAudioSuiteWindow
                  /// Set Processing Options
              
                  win.audioSuiteSetOptions({ processingInputMode: 'ClipByClip', processingOutputMode: `CreateIndividualFiles`, });
                  const sideChainButton = win.popupButtons.allItems[4]
                  
                  /// Set Sidechain to Target Key Track
                  if (sideChainButton.title.value != slctdTrcks[0]) { sideChainButton.popupMenuSelect({ menuPath: [targetKeyTrack] }) };
                  
                  /// Waif for computers that are too fast
                  sf.wait({ intervalMs: 100 })
              
                  /// Render Auto-Align
                  win.audioSuiteRender();
              
                  /// Wait For Render to Finish
                  sf.ui.proTools.waitForNoModals();
                  
                  /// Re-Close Auto Align if it was Open
                  if (!aApostIsOpen) { win.windowClose({}, `Could not find Audiosuite Window`); }
              }
              
              autoAlignToTrackWithClipsFromArray(keyTrackArray)
              
            2. B
              In reply toBarnabas_Vendli:
              Barnabas Vendli @Barnabas_Vendli
                2025-11-24 17:49:32.893Z

                I’m still fairly new to using SoundFlow, so I have a quick question: should I simply copy and paste the script you sent into the script that comes automatically installed with the Auto-Align package?

                What I’d like to achieve is the following: I select a track, then use the Stream Deck to choose which other track it should be aligned to — for example DX 1 or DX 2. I don’t always want everything aligned to the topmost track, because sometimes it needs to be the other way around. For instance, there are cases where I need to align the boom to the lavalier, and in my sessions the boom is usually at the top, but that’s not always the best reference in terms of dialogue intelligibility.

                1. Create a new Script and copy this entire script into it. Give it a button and give it a run. From here if you'd like multiple instances of this, the best way is to template it so you don't have to create dozens of copies. @Kitch remind me where the template walkthrough is?

                  But basically on line 3 you can see

                  //// DEFINE THE TRACKS YOU WANT TO CHECK THROUGH HERE
                  
                  let keyTrackArray = ['DIA A 1', 'DIA B 1']
                  

                  You would change your keyTrackArray to be the tracks you want checked for that version of the button.

                  Here's one that skips all this and JUST does one fixed track that you can change via Template or simply making many many duplicate copies of the script. (I highly encourage you to watch the template walkthrough as it will be very useful on your overall Soundflow journey.

                  //// CHANGE YOUR SINGLE TARGET TRACK HERE :
                  
                  let keyTrack = 'DIA A 1'
                  
                  sf.ui.proTools.appActivateMainWindow();
                  sf.ui.proTools.invalidate();
                  
                  ///Check Status of Auto Align
                  const aApostIsOpen = sf.ui.proTools.windows.whoseTitle.is("Audio Suite: Auto-Align Post").first.exists
                  if (aApostIsOpen) {
                      sf.ui.proTools.windows.whoseTitle.is("Audio Suite: Auto-Align Post").first.elementRaise();
                  } else {
                      sf.ui.proTools.audioSuiteOpenPlugin({ category: "Other", name: "Auto-Align Post", });
                  }
                  /// Define Auto-Align Window
                  let win = sf.ui.proTools.firstAudioSuiteWindow
                  /// Set Processing Options
                  win.audioSuiteSetOptions({ processingInputMode: 'ClipByClip', processingOutputMode: `CreateIndividualFiles`, });
                  const sideChainButton = win.popupButtons.allItems[4]
                  /// Set Sidechain to Work Track 1 if It's not set
                  if (sideChainButton.title.value != keyTrack) { sideChainButton.popupMenuSelect({ menuPath: [keyTrack] }) };
                  sf.wait({intervalMs : 100})
                  /// Render Auto-Align
                  win.audioSuiteRender();
                  /// Wait For Render to Finish
                  sf.ui.proTools.waitForNoModals();
                  /// Re-Close Auto Align if it was Open
                  if (!aApostIsOpen) { win.windowClose({}, `Could not find Audiosuite Window`); }
                  

                  As you can see this one is very simple just change the single KEY TRACK at the top and it will use that Fixed one accordingly. Less hoops to jump through for sure.

                  1. Kitch Membery @Kitch2025-11-24 18:09:58.927Z

                    Hi @Owen_Granich_Young

                    Here is the link to the documentation for creating Command Templates...

                    https://soundflow.org/docs/how-to/custom-commands/command-templates

                  2. In reply toBarnabas_Vendli:

                    You might enjoy this one too,

                    Select any number of tracks and SF prompts you to pick the Key Track from a list, it will then process the others to that track.

                    1. In reply toBarnabas_Vendli:

                      Actually you may like this one the best if you're using a StreamDeck